Intro to the Arduino Topics: The Arduino Digital IO Analog IO Serial Communication
Intro to the Arduino
Topics: The ArduinoDigital IOAnalog IO Serial Communication
Topic 1: Meet Arduino Uno
Getting Started• Check out: http://arduino.cc/en/Guide/HomePage
1. Download & install the Arduino environment (IDE)(not needed in lab)
2. Connect the board to your computer via the USB cable
3. If needed, install the drivers (not needed in lab)4. Launch the Arduino IDE5. Select your board6. Select your serial port7. Open the blink example 8. Upload the program
Arduino IDE
See: http://arduino.cc/en/Guide/Environment for more information
Select Serial Port and Board
todbot.com/blog/bionicarduino
Input/Output
Image from Theory and Practice of Tangible User Interfaces at UC Berkley
Topic 2: Digital Input/Output
• Digital IO is binary valued—it’s either on or off, 1 or 0
• Internally, all microprocessors are digital, why?
1
0
Arduino Digital I/0
pinMode(pin, mode)Sets pin to either INPUT or OUTPUTdigitalRead(pin)Reads HIGH or LOW from a pindigitalWrite(pin, value)Writes HIGH or LOW to a pinElectronic stuff Output pins can provide 40 mA of currentWriting HIGH to an input pin installs a 20KΩ pullup
www.mikroe.com/chapters/view/1
Our First Program
Assignment 1: Digital IO
• Use a push-button to turn ON/Off LED
Note
• Assignments and quiz are to be submitted by 5th August 2016 on line
Some Commands• Serial.begin() - e.g., Serial.begin(9600)• Serial.print() or Serial.println() - e.g., Serial.print(value)• Serial.read()• Serial.available()• Serial.write()• Serial.parseInt()
• Example Program
Serial-to-USB chip---what does it do?
Image from Theory and Practice of Tangible User Interfaces at UC Berkley
The LilyPad and Fio Arduino require an external USB to TTY connector, such as an FTDI “cable”.In the Arduino Leonardo a single microcontroller runs the Arduino programs and handles the USB connection.
Assignment 2: Serial Communication
Modify your program from in-class exercise 2-part 2 to control the intensity of the LED attached to pin 9 based on keyboard input.
Use the Serial.parseInt() method to read numeric keyboard input as an integer.
An input of 9 should produce full intensity and an input of 0 should turn the LED off.
Arduino QuizQuestion 1:What license is Arduino distributed under?(a) Proprietary with GNU GPL Ambient user interface(b) Proprietary (c)Shareware(d) LGPL or GPL license
(a) Cross-platform(b) Mac OS X (c)Linux(d) Embedded System
Question 2: Which of the following platforms does Arduino run on?
Question 5: The Arduino IDE is a ________ application written inJava which is derived from the IDE made for the Processingprogramming language and the Wiring project.(a)(Computer(b)Linux(c)Cross-platform(d)OpenOffice.org
Question 4: A typical first program for a microcontroller is to simply blink a ________ on and off.(a)Fluorescent lamp (b)Gas-discharge lamp(c)LED lamp(d)Light-emitting diode
Question 3: They have different connectors for power and I/O, such as a series of pins on the underside of the board for use with ________ for easy prototyping, or more specific connectors.(a)Breadboard(b)Integrated circuit(c)Capacitor(d)Prototype