Have ChatGPT Write a Melody for Arduino Uno

by KodyR in Circuits > Arduino

1069 Views, 7 Favorites, 0 Comments

Have ChatGPT Write a Melody for Arduino Uno

Screenshot from video.webm.png

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.

Go to ChatGPT

Screenshot from 2023-01-14 10-17-35.png
Screenshot from 2023-01-14 10-47-15.png

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.

Get ChatGPT to Write the Code

Screenshot from 2023-01-14 10-03-02.png

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

Copy the Code to the Arduino IDE

Screenshot from 2023-01-14 10-37-53.png

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

Wire the Uno

IMG_20230114_102231338.jpg
IMG_20230114_102237510.jpg

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

Downloads

Upload the Code

pointing_to_upload_button.png

Listen to the Melody

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

Downloads