Tips how to get working code from chatGPT

this thread answers the question: how to get working code from chatGPT.
to get down to the point immidiately two things are important:

  1. very precise description of the wanted functionality
  2. chatGPT must find a 100,000% matching code.

In a little bit more words this means:
If your description of the wanted functionality is too foggy the code generated by chatGPT does not work
If chatGPT is unable to find a 100,000% matching code. ChatGPT makes assumptions based on probabilities.

This leads to not working code.
Based on probability-assumptions chatGPT chooses

  • a wrong library that does not match to the used hardware
  • a wrong interface that does not match the used hardware.

chatGPT is out and popular now for some weeks. From watching the codes generated by chatGPT that are fluent on the internet I can say
as long as you want something simple like
"blink an LED"
"drive a motor with PWM"
chatGPT is able to generate working code.
If you go beyond that simplyness chatGPT is just

chatting

The name is well chosen. chat (not serious professionally discuss)

As long as you give chatGPT exercises like

"write a heartwarming christmas greeting-card to my grandmother"

it doesn't matter if this or that word is chosen and in which particular order the words are written.

In programming it is very different:
each and every detail must fit to each other including the order of reserved words and their parameters.

This means you have to invest even more work into a chatGPT-request to obtain working code
than
you have to invest in "classical" asking human users in a forum like the arduino-forum by following this tutorial

Sorry all you lazybones. ChatGPT isn't even learning anymore. You can ask chatGPT for his knowledge base. ChatGPT finished "learning" in september 2021. It does

not

use actual information on the internet.

best regards Stefan

5 Likes

Well said.
image

3 Likes

Which is why when I see someone wanting help to "fix" chatGPT code I stop reading and move on to the next topic.

5 Likes

Same for me. "Will someone fix this code I am too lazy to even try to understand?"...

6 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.