This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ChatGPT to write python
#1
Anyone tried it? Might actually come in very handy--

chat.openai.com

 ask-
"write some python to receive websocket data"

reply "Here is an example of how to receive data from a websocket using the websockets library in Python:"

Code:
import asyncio
import websockets

async def receive_data(websocket):
    while True:
        data = await websocket.recv()
        print(f"Received data: {data}")

async def main(uri):
    async with websockets.connect(uri) as websocket:
        await receive_data(websocket)

uri = "ws://your-websocket-url"
asyncio.get_event_loop().run_until_complete(main(uri))
Reply
#2
I wonder what will happen if I ask something like "could you make OpenPlotter 4. Please..." Smile
Reply
#3
(2023-02-01, 04:27 PM)Sailoog Wrote: I wonder what will happen if I ask something like "could you make OpenPlotter 4. Please..." Smile

Does poetry as well  Big Grin Big Grin Cool
Write an 8 line poem about sailoog and his great software called openplotter

Sailoog's name is known far and wide,
A tech genius with software in mind,
He created a tool that's simply divine,
Openplotter, making boaters shine.

With navigation and weather at hand,
It's a lifesaver for those on the water, so grand,
Sailors around the world now understand,
Openplotter is the way to command
Reply
#4
This is too funny  Big Grin Big Grin Big Grin

write a poem about the i2c address of my ina219 current sensor is wrong


My INA219 sensor's I2C address is flawed,
Its readings all incorrect and just gibberish, bawled.
I've tried everything, but to no avail,
Its values all wrong, I'm starting to pale.

I've double checked the wiring, nothing's wrong,
But still the readings are weak and just don't belong.
I thought I had everything set up with such care,
But this issue has left me feeling quite unfair.

But still I won't give up, I'll keep trying,
Until my sensor's readings are finally complying.
For I know that the solution is just within reach,
And soon my sensor's readings will be within my teach.

So here's to the journey, the ups and the downs,
To finding the solution, to fixing what's found.
For the INA219 sensor, I'll get it just right,
And bask in its glory, with readings so bright.
Reply
#5
(2023-02-02, 05:33 AM)PaddyB Wrote:
(2023-02-01, 04:27 PM)Sailoog Wrote: I wonder what will happen if I ask something like "could you make OpenPlotter 4. Please..." Smile

Does poetry as well  Big Grin Big Grin Cool
Write an 8 line poem about sailoog and his great software called openplotter

Sailoog's name is known far and wide,
A tech genius with software in mind,
He created a tool that's simply divine,
Openplotter, making boaters shine.

With navigation and weather at hand,
It's a lifesaver for those on the water, so grand,
Sailors around the world now understand,
Openplotter is the way to command

OMG! Really? this is scary... Sick
Reply
#6
and something actually useful... takes a little while to dig into the manuals and find what plugin uses what sentence in opencpn..... there is a quicker way - ask ChatGPT!

" - what nmea0183 input sentence does the konni logbook in opencpn use to get wind speed?

- The Konni Logbook plugin in OpenCPN uses the NMEA0183 input sentence "$IIMWV" to get wind speed information. This sentence provides both the wind direction and wind speed data in knots. The sentence structure is as follows:

$IIMWV, x.x, R, x.x, N, A*hh<CR><LF>

where:

x.x = Wind direction in degrees True
R = Reference, R = Relative, T = True
x.x = Wind speed in knots
N = Wind speed units, N = Knots
A = Status, A = Active
*hh = Checksum
So the wind speed information can be extracted from the third field of this sentence, which is the wind speed value in knots."

Spoke with a coding friend yesterday, he said within a month of launch his company was using chatgpt to write a large proportion of their code, he said it was like having a junior - "Go and write a function to do this..", then they would check but usually fine. Also lots of their older code was getting put through chatgpt to optimise & make it more efficient. The future is here!!! ?
Reply
#7
I've been using it for the last few weeks in my daily job to write repeatitive and boring code, like API endpoints and that kind of stuff. Also mathematical functions where I totally suck Big Grin
And lately I'm learning about how to code SignalK plugins with it.

In my opinion, if you already know enough programing to check what it writes, it's an awesome tool.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)