Presentation is loading. Please wait.

Presentation is loading. Please wait.

Microprocessors Tutorial 1: Arduino Basics

Similar presentations


Presentation on theme: "Microprocessors Tutorial 1: Arduino Basics"— Presentation transcript:

1 Microprocessors Tutorial 1: Arduino Basics

2 Agenda 1. Arduino Hardware 2. Arduino Software 3. MAKE: Blink
4. Electronics 5. MAKE: LED control 6. Analog 7. MAKE: Volume control 8. Links

3 Project Links Arduino Examples http://arduino.cc/en/Tutorial/HomePage
MAKE projects Instructables We will b using only 4 leds i think Imagine replacing input to a microphone, or headphone jack!

4 Arduino Hardware Reset button 14 Digital Pins (6 PWM) Power USB
ATMega 328 6 Analog Pins

5 Arduino Software Menu bar: set device, port, find examples Code:
setup(), set pin direction pinMode(pin, IN/OUTPUT) loop(), set pin value with digitalWrite(led, HIGH/LOW) Or get pin value with digitalRead(pin) Buttons: verify and upload code -set device under tools> boards -set port before uploading (in tools) -sketches r for LATER, write your own code! Code for BLINK uses DIGITAL methods Connect arduino, if windows not found find driver in DEVICE MANAGER, see port, then upload

6 MAKE: Blink Using built in LED, so no further electronics needed!
Connect Arduino Windows driver found? Correct port? Upload code -set device under tools> boards -set port before uploading (in tools) -sketches r for LATER, write your own code! Code for BLINK uses DIGITAL methods Connect arduino, if windows not found find driver in DEVICE MANAGER, see port, then upload

7 Electronics Breadboard: vertical connections, horizontal buses
LEDs: polarized, long == + Resistor: Color-coded. Need one for LED Push Button: completes circuit only while pushed. Use a pull down resistor! LED res: ohms law 5v , 20mA Pulldown: floating when no tpressed

8 MAKE: LED control Hardware Connect buses to bread board, 5v and GND
Connect LED output from Arduino to ground, pin->220ohm -> LED+ ->GND Connect button input from 5v to Arduino, 5v ->button ->10kohm ->GND before res ->pin Dont need arduino for this, but for educational purposes

9 MAKE: LED control Software Outside: declare 2 pins In setup():
Set direction using pinMode(pin, IN/OUTPUT) In loop(): Read button state using digitalRead(pin) If button is on, control LEDs using digitalWrite(led, HIGH/LOW)

10 Analog Digital: 0-1, On/Off LEDs, switches
digitalRead(), digitalWrite() Analog: Potentiometer, sensor, motors AnalogRead(), analogWrite() to pin +5v Potentiometer: variable resistance

11 MAKE: Volume Indicator
Hardware Add more LEDs, each going to a different pin Connect potentiometer, center connection to pin We will b using only 4 leds i think

12 MAKE: Volume Indicator
Software Add LED pin variables and set direction Add pot pin, analog pin don't need direciton Read pot value Scale from (0-1024) to number of LEDs it using map(variable, origStart, origEnd, scaledStart, scaledEnd) Turn LEDs on/off depending on value of pot. The higher the pot value the more LEDs should be on. We will b using only 4 leds i think Imagine replacing input to a microphone, or headphone jack!

13 Parts Links RobotShop (Canada) http://www.robotshop.com/ca/
Adafruit (NYC) ABRA (montreal) DigiKey (flat shipping) We will b using only 4 leds i think Imagine replacing input to a microphone, or headphone jack!

14 academics@ieee.concordia.ca ieee.concordia.ca
Questions? Comments? Suggestions? ieee.concordia.ca


Download ppt "Microprocessors Tutorial 1: Arduino Basics"

Similar presentations


Ads by Google