Difference between revisions of "CSC231 Lab 5"
Line 13: | Line 13: | ||
Stay tuned for a presentation at the board of the following basic principles: | Stay tuned for a presentation at the board of the following basic principles: | ||
+ | [[Image:CSC231_switchPullUp.png]] | ||
+ | [[Image:CSC231_LED.gif]] | ||
+ | [[Image:CSC231_totemPole.jpg]] | ||
+ | [[Image:outledlow.gif]] | ||
+ | [[Image:outled.gif]] | ||
* The output of a logic gate: high and low voltages | * The output of a logic gate: high and low voltages | ||
* Resistors | * Resistors | ||
* Diodes | * Diodes | ||
* switches | * switches | ||
+ | * buzzer | ||
Do not move on to the next section until this section has been presented | Do not move on to the next section until this section has been presented | ||
Line 67: | Line 73: | ||
=Misc. References= | =Misc. References= | ||
* [http://www.bioinspired.com/users/ajg112/electronics/debounce.shtml Debouncing] a switch, from www.bioinspired.com | * [http://www.bioinspired.com/users/ajg112/electronics/debounce.shtml Debouncing] a switch, from www.bioinspired.com | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
Revision as of 07:03, 3 October 2008
Back to CSC231 Weekly Schedule
Contents
CSC 231 Lab # 5
© D. Thiebaut, 2008
This lab is designed to make you interface simple input and output devices to the Arduino.
Introduction to Electricity and Electronics
Stay tuned for a presentation at the board of the following basic principles:
- The output of a logic gate: high and low voltages
- Resistors
- Diodes
- switches
- buzzer
Do not move on to the next section until this section has been presented
Lab report
Write up your lab report as part of your 231a Wiki page. Feel free to take pictures of your kits and use them to illustrate your report.
Resistors
Find a good reference for the color coding of resistor. The first person to find a good reference should share it with the class by adding it to the reference section of the CSC231 Wiki portal.
Connecting an LED to Pin 13
Option 1: Output to resistor to LED to GND
- Turn off the Arduino.
- Once you have your circuit wired up, power up the Arduino and download the Blink sketch. Does your LED blink? If not, turn it around and reverse its polarity.
- Does it blink in phase or out of phase with the on-board LED?
Option 2: Vcc to resistor to LED to output
Same steps as in Option 1, but use connect the LED between the output pin and Vcc (using a resistor to limit the current).
Connecting an LED to Pin 11
- Change the sketch so that it make your LED blink.
- Modify the sketch so that the on-board LED blinks at 0.5 Hz and your new LED blinks at 1 Hz.
- Make your LED blink as fast as possible. How fast is it blinking? How can you find out? How can you measure this frequency precisely? Be imaginative
Replace the LED and Resistor with a buzzer
Connect a switch to Pin 11
- First disconnect all hardware from your Arduino
- Modify your sketch and make Pin 11 an input pin.
- Download your sketch to the Arduino
- Now that the pin is programmed as an input, use the circuit we will have seen in class to connect a switch (with a resistor) to the Pin 11.
- Change your sketch so that you can turn the LED connected to Pin 13 ON or OFF with the switch.
- Make the sketch increment a counter every time your switch is found to have changed state. Make the Arduino display the counter on the PC screen. Activate the switch ON and OFF quickly. Is the Arduino keeping the right count? Why or why not?
Misc. References
- Debouncing a switch, from www.bioinspired.com