- Plug the USB cable into both the Arduino board and the computer.
-
Open the Arduino software on the computer.
-
Maximize the Arduino software window.
-
In the menu bar, go to "Tools", down to "Port", and then click the COM# with “Arduino/Genuino Uno” next to it.
STEM Connections
Unlike the LED Blink activity where existing code was modified to make the LED blink in different ways, this activity will require you to write code from start to finish. The first step in writing new code is to open a new programming window.
Servos do not rotate on their own. Mechanical engineers connect computers and other devices to Servos to control their movement. You will be using the computer and the Arduino board to make this connection.
Without a computer program, the Arduino board is not able to control the movement of a Servo. You will be using the Arduino software to send computer programs to the Arduino board. To make sure the Arduino board can receive the programs, first you must indicate in the Arduino software which COM port you will be using.
There are two main coding experiences for programmers. One is taking existing code and modifying it for your current specific needs and the other is to write code completely from start to finish. This Servo activity is like the latter.
If you are completing the LED Blink and Servo activities on the same day, the correct port should already be selected, but it’s good practice to always remember this step.
Any time you connect something (whether it’s an external mouse, keyboard, etc.) to your computer, your computer assigns it a unique COM#, or like a virtual door number, to know where to send different pieces of information. Connecting your Arduino board to your computer is no different. We want to make sure the information the Arduino board receives from the computer is the uploaded code. (If time has lapsed between the LED Blink and this activity, remind students they uploaded code when they did the LED blink activity.)
Another way to look at it is to think of writing code for Arduino is a lot like texting. Ask the students “how many of you have ever texted before?” This should be a very relatable analogy. Next, ask your students, “what is the first thing you do when you want to text somebody?” When you send a text, the first thing you need to do is open the Messages App. When you write code for Arduino, the first thing you need to do is open the Arduino software.
Keeping with the texting analogy, ask, “what would you do next if you were texting?” While many students will tell you to start writing your text, the next thing you would do is select the person you want to send your message to. When writing code, the next step is to select the port where you will upload your code.
At this point, if your students are working in pairs, tell them that they will share the coding responsibility, with one partner being responsible for the first half of the code and the second partner responsible for the second half. Whoever is not typing is checking the work of their partner as they go along.
The sketch has code already
- To get a new Arduino sketch window, go to "File" and click "New"
My COM# is different than the one in the video
- That is normal. Each time you connect a new USB device, it assigns it a new com (communication port) number. Yours will likely be different than the video and even different from most of your classmates.
No COM# with (Arduino/Genuino Uno)
-
Check that the USB is plugged all the way in to both the Arduino board and the USB port on the computer.
-
Click out of the menu bar and try again (sometimes it takes a while for your computer to recognize a new device).
-
Unplug and re-plug in the USB cable.
-
Restart the Arduino software.
-
Use a new Arduino Uno board.
-
Use a different USB cable.
-
Use a different computer.