CSC231 Lab 5

From dftwiki3
Revision as of 22:46, 2 October 2008 by Thiebaut (talk | contribs) (New page: Image:UnderConstruction.gif Back to CSC231 Weekly Schedule =CSC 231 Lab # 5= right © D. Thiebaut, 2008 This lab is designe...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

UnderConstruction.gif Back to CSC231 Weekly Schedule


CSC 231 Lab # 5

ArduinoStamp.jpg

© 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

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.

Pictures

CSC231 LED.gif CSC231 totemPole.jpg File:Outledlow.igf Outled.gif