Upload a sketch to your Arduino

A sketch is a program for your Arduino. Uploading means sending that program from your computer to the board. You do not need to type the whole program again when you already have a ‘sketch’ saved on your computer.

Follow these steps with your teacher. This guide uses Arduino IDE 2 and an Arduino Uno R3. If your board is different, ask your teacher which board to choose.

1. Get ready

You will need:

For a robot, leave the motor battery disconnected while uploading. Disconnect all power before changing wires, and ask your teacher to check the wiring. Use the computer’s USB connection for the board during these steps.

2. Find your saved sketch

Download the sketch from its project page if you have not saved it yet. Look in your computer’s Downloads folder, or the folder where you saved it.

For the Smart Soccer Bot, expand Code: Smart Soccer Bot on its page, then click the download link inside.

Check that the file ends in .ino, rather than .ino.txt. If you cannot find it, ask your teacher to help before downloading more copies.

3. Open the file

Open Arduino IDE, choose File → Open, and select your .ino file.

If Arduino IDE offers to create a folder for the sketch and move the file into it, accept the prompt. This is normal. The Arduino IDE expects the main sketch file to be inside a folder with a matching name. For example, smart-soccer-bot.ino should be inside a folder named smart-soccer-bot.

You should now see the program in the editor. Check the file name so you know you opened the right sketch.

4. Check the project settings

Follow the instructions on your project’s page before uploading. For the Smart Soccer Bot, set ENABLE_ULTRASONIC and ENABLE_IR_BOUNDARY to match the sensors you have connected. For motors only, set both to false.

Choose File → Save after making changes. Saving keeps the file on your computer; you still need to upload it to change the board’s program.

5. Connect the board

Plug the USB cable into the board and your computer. The board’s power light should come on. Keep the robot’s motor battery disconnected.

6. Choose the board and port

The board setting tells the IDE which model you are using. The port tells it which connection leads to your board.

Open Tools → Board and select Arduino Uno under Arduino AVR Boards for an Uno R3. Ask your teacher for help if the board package needs installing.

Open Tools → Port and choose your board’s connection. On Windows it may look like COM3; on a Mac it may look like /dev/cu.usbmodem…. Your number or name may differ.

7. Check the code

Click Verify, the tick/check-mark button. This checks whether the IDE can build the program. It does not send the program to the board or check your wiring.

If an error appears, stop and show your teacher the message.

8. Upload

Click Upload, the right-arrow button. Keep the cable connected while it works. Wait for the IDE to report that uploading has finished successfully.

The board starts running the uploaded program automatically. You do not need to press a separate Play button.

9. Try your project

Return to your project’s instructions for its first checks. For the Smart Soccer Bot, ask your teacher to secure the robot with its wheels off the ground before reconnecting motor power. It begins moving after a short startup delay.

Uploading a new sketch replaces the program already on the board. Your saved files remain on the computer, so you can open and upload an earlier sketch again later.

If something does not work

Teacher references: Arduino upload instructions, sketch folder rules, and upload troubleshooting.

Smart Soccer Bot · Arduino sketches · Lab