Purpose:
The purpose of this lab activity is to arrive at the point where you have the Arduino IDE up and running and you can successfully talk to your Arduino. Most of the time this is remarkably straightforward and takes about 10-15 min. On the other hand when something isn't right, usually the IDE doesn't recognize your Uno, it can take a remarkable amount of time to sort out what to do. Like many digital appliances it can often feel like magical incantations as we attempt to resolve whatever the problem is. After months having no problems I just had this experience myself and it took an hour to sort it out (and I'm still not sure exactly what fixed the problem?)
Procedure:
- If you completed the pre-Term Preparation you have installed the Arduino IDE on your personal computer and have verified that it will start up. Once you've done it a couple of times you'll almost never think about this stuff again.
i) Attach your USB cable to the Arduino board and to your computer. Here is a more detailed guide to powering up your Arduino and connecting it to your computer.
ii) Then open the Arduino IDE and follow the steps in this IDE Startup Guide to get the IE talking to your Arduino. Just a note of caution. This usually works easily but when the IDE can't 'see' the Arduino you have connected it can be very aggravating and take multiple attempts to resolve. Patience is important.
iii) In the Blink sketch you have open you can scroll down until you see these lines of code. I will endeavor to always put Arduino code in a window like this to indicate that it is code. Like the Jupyter notebooks I provide you can copy and past the code in these windows into your Arduino code and it should work. That is not useful here!
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}Change the delay(1000); to delay(100); in both locations. Upload the modified sketch observe what is different about the behavior of your Arduino. You will see that each delay() statement changes the behavior of your blinking LED in different ways. This is the final verification that you are successfully communicating with your Arduino.
In the next lab we will explore the structure of the sketch and how we connect the Arduino to the outside world.
- LAB DELIVERABLES:
-
I) In a short paragraph describe what each of the delay(xxxx); statements in the Arduino sketch do to the blinking of the LED on the Arduino board. Put this description in a separate section with appropriate headers in your Jupyter notebook. That's all!