What is aMicrocontroller• A small computer on a single chip• containing a processor, memory, and input/output• Typically "embedded" inside some device that they control• A microcontroller is often small and low cost• Exampleswww.mikroe.com/chapters/view/1
3.
What is aDevelopment Board• A printed circuitboard designed tofacilitate work with aparticularmicrocontroller.• Typical components include:• power circuit• programming interface• basic input; usually buttons and LEDs• I/O pins
Getting Started• Checkout: http://arduino.cc/en/Guide/HomePage1. Download & install the Arduino environment (IDE)2. Connect the board to your computer via the UBS cable3. If needed, install the drivers (not needed in lab)4. Launch the Arduino IDE5. Select your board6. Select your serial port7. Open the blink example8. Upload the program
Add an ExternalLED to pin 13• File > Examples > Digital > Blink• LED’s have polarity– Negative indicated by flat side of the housingand a short legwww.instructables.com
14.
A Little BitAbout Programming• Code is casesensitive• Statements arecommands andmust end with asemi-colon• Comments followa // or begin with /*and end with */• loop and setup
Digital I/0pinMode(pin, mode)Setspin to either INPUT or OUTPUTdigitalRead(pin)Reads HIGH or LOW from a pindigitalWrite(pin, value)Writes HIGH or LOW to a pinElectronic stuffOutput pins can provide 40 mA of currentWriting HIGH to an input pin installs a 20KΩ pullupwww.mikroe.com/chapters/view/1
18.
Arduino Timing• delay(ms)–Pauses for a few milliseconds• delayMicroseconds(us)– Pauses for a few microseconds• More commands:arduino.cc/en/Reference/HomePage
19.
Digital? Analog?• Digitalhas two values: on and off• Analog has many (infinite) values• Computers don’t really do analog, they quantize• Remember the 6 analog input pins---here’s howthey worktodbot.com/blog/bionicarduino
Putting It Together•Complete the sketch(program) below.• What output will begenerated by this program?• What if the schematic werechanged? www.ladyada.net/learn/arduino