CSc 4110/6110 Embedded Systems
Lab Experiment #1
Instructor: Dr. Michael Weeks
Blinking lights
This lab will introduce you to the Arduino.
When you learn a new programming language, one of the first things
you typically do is try a "hello world" program.
When working with a new
hardware platform, we have a similar first exercise to make a light blink.
It shows that you have control over the environment, and can make something
happen. It also gives you a way to communicate from your control software.
If nothing else, you can turn a light on/off to indicate that your software is
working.
All code that you write must have your name in it, and must be commented.
If you use someone else'e code, put that in the comments, and indicate
what you did (e.g. "based on code by", "heavily modified from code by",
"modified from code by", "lightly modified from code by", "inspired by",
"slightly altered from code by", etc.). If you use someone else's code,
add his/her/their name(s) to the comments along with other identifying
information, such as where you downloaded it.
Complete the tutorial linked below.
Do not plug the LED directly into the Arduino. Instead, put the LED and
resistor into the breadboard, and wire it to the Arduino.
Blinking LED tutorial (Blink)
Once you have completed the blinking LED tutorial, try the
Fade LED tutorial (Fade).
Questions
The Blink or Fade before the question designates which tutorial the
question addresses.
- (Blink)
Does your Arduino have an LED attached to pin 13? If so, did it blink
along with the other LED? Why (or why not)?
- (Blink)
How would you change the code to make the LED off for 2 seconds,
then on for half a second?
- (Blink)
How would you change the code to make the LED blink
on for one second, then off for one second,
then on for two seconds, then off for two seconds, then repeat?
- (Blink)
Suppose that the LED is connected to pin 10. How would you change
the code to make it work?
- (Fade) What is the difference between the
analogWrite
and
digitalWrite
commands?
- (Fade) Briefly describe what you observe when the delay is 30 units.
If you change the delay from 30 to 600, what do you observe when you run it?
What to Turn In
Follow the directions on Lab Report format, given on the class web-page.
Write-up what you did IN YOUR OWN WORDS. Do not simply re-word the
directions,
but explain what is going on. Avoid listing steps. Use outside sources
as appropriate, and be certain to cite your sources.
If you copy and paste ANY text, put it in double-quotes and include a
citation immediately after it.
- Include your answers to the questions.
- Include a printout of your code.
You only need to include the files that you changed.
For example, creating a new application project may in turn
create a files. If you do not
change those files, you do not need to include printouts of them.
- Clearly indicate the author (and source) of any code, such as out of a
book or from a web-page. If you modified it, clearly state this.
- Include a screen-capture of the simulator's
screen, when there is something to see.
- Turn in one report per person.
- Make sure it is stapled.
- Include on the lab when your appointment with the TA to demonstrate
your lab is (or was). It is your responsibility to demonstrate your labs
to the TA. The time you and the TA agree on is up to you. You are required
to set this up BEFORE turning in the lab.
Please see the link to the lab format.