ChatGPT, the future for programmers?

From a chatGPT site. Isn’t it impressive? I haven’t tried it but it looks about right.

Question: blynk code: turn a led on using esp8266
Answer: Here is an example of code in C++ for turning on a LED using the Blynk library:

#include <BlynkSimpleEsp8266.h>

const int LED_PIN = 2;  // GPIO pin for the LED

void setup() {
  pinMode(LED_PIN, OUTPUT);
}

BLYNK_WRITE(V0) {
  int ledValue = param.asInt();  // Get the LED state from the app
  digitalWrite(LED_PIN, ledValue);  // Set the LED state
}

void loop() {
  Blynk.run();
}

In this code, V0 is a virtual pin in the Blynk app that you can use to control the state of the LED. The BLYNK_WRITE macro is triggered when the virtual pin value changes in the app, and the digitalWrite function is used to turn the LED on or off based on the value received from the app.

Not that impressive when you consider that it won’t work!

Pete.

3 Likes

It uses old code and old examples. So we’ll have to wait while it will index the latest code.

In general, yeah - ChatGPT is very powerful. I’m already using co-pilot (based on GPT 3 model) in my daily work and I must say - it’s pretty cool. It saves ~10-20% of the coding time in my case. It’s great with simple/small methods/tasks (literally it writes the code for you) and during refactorings. It won’t replace the programmers in the near future, but it’s a big step forward :wink: .

3 Likes