Introduction: Have ChatGPT Write a Melody for Arduino Uno

About: I am a multidisciplinary hacker in training.

In this instructable, I will produce an example of how easy it is to get ChatGPT to write Arduino code. It is a really simple example of a melody maker for a project that I am making.

Supplies

  1. Arduino Uno: https://store.arduino.cc/products/arduino-uno-rev3
  2. Buzzer: https://www.digikey.ca/en/products/detail/cui-devices/CMT-9648-85T/10326219
  3. Breadboard: https://www.digikey.ca/en/products/detail/dfrobot/FIT0096/7597069
  4. Jumper Wires: https://www.digikey.ca/en/products/detail/sparkfun-electronics/PRT-12795/5993860
  5. Arduino programming cable (Type A to Type B USB): https://www.digikey.ca/en/products/detail/cnc-tech/102-1030-BL-00200/3064828

Those are all the materials I used in this instructable. The links I gave are just suggestions and in fact, the breadboard I showed is not even the one I used. The neat fact is that if you do not have the USB cable you can probably steal one from a printer somewhere because most printers use that cable to connect to computers too.

Step 1: Go to ChatGPT

You might get a response that tells you the servers are busy and you have to wait (like one of the images attached). Hopefully, you get a message like the other image attached and you can just log in.

Step 2: Get ChatGPT to Write the Code

Then simply ask it to write a melody as I did in the image.

Step 3: Copy the Code to the Arduino IDE

Copy ChatGPT's code to the Arduino IDE (as shown in the image).

Step 4: Wire the Uno

Wire the Arduino Uno according to the attached schematic and the two included pictures

Step 5: Upload the Code

Step 6: Listen to the Melody

All that is left is to listen to the beautiful melody! The video attached plays that melody.

Anything Goes Contest

Participated in the
Anything Goes Contest