- Press the upload button (arrow) to upload your Servo program to the Arduino board.
STEM Connections
The upload button translates the code you wrote into a program and sends that program to the Arduino board. Immediately after the Arduino board receives this program it begins running it. Once the Servo is properly connected to the Arduino board, you will see the program’s effect on the Servo.
-
This is an opportunity for the teacher to walk around and provide technical support to individual students/teams.
-
Continuing with the Texting analogy, explain that one difference between texting and uploading code is a text allows you to send whether you have grammatical errors or not, while code will not upload if it is not written correctly.
If you are using the Thinkabit Lab Notebook:
If you decided to wait until the end to fill in the blanks in your notebook, now might be a good time to do so:
#include <Servo.h> include the Servo library
Servo myservo; name the Servo 'myservo'
void setup(){
myservo.attach(9); attach myservo to pin 9
}
void loop(){
myservo.write(0); Servo action '0'
delay(2000); wait 2 seconds
myservo.write(180); Servo action '180'
delay(2000); wait 2 seconds
}
“done compiling” is not the same as “done uploading”
- Be sure to click the “upload” button not the “compile” button.
“expected ‘ ) ‘ before ‘;’ token
-
Notice it highlights the area where there is a problem.
-
You’re missing a parenthesis somewhere, make sure every parenthesis has its match.
“expected ‘;’ before ‘_______’ ”
-
Notice that the Arduino software highlights the area where there is a problem.
-
You’re missing a ‘;’ after a line of code. Check that each line has a ‘;’ after it.
“error compiling”
-
Try clicking ‘upload’ again.
-
Double check your code to make sure everything is included from the code demonstrated in the earlier steps.
“problem uploading to board”
-
Check the most obvious first, that the Arduino board is connected to the computer with the USB cable.
-
Check that the Arduino is connected to the right COM port, then upload again.
-
To check, go to Tools > Port and see if “COM# (Arduino/Genuino Uno)” is next to the word “Port”.
-
If not, select the option mentioned above.
-
If no COM# shows “(Arduino/Genuino Uno)” next to it, make sure that your USB cable is connected to both the Arduino board and the USB port of the computer.
-
3. Try unplugging and re-plugging the USB cable and uploading again.
4. Try disconnecting all wires from the Arduino board and uploading again.
The Arduino software asks to save before uploading
- To deactivate this option, go to File > Preferences and uncheck the "save when verifying or uploading" option.