View
831
Download
3
Category
Preview:
DESCRIPTION
An introduction to the Arduino microcontroller for the Washington, DC Kids & Technology Meetup. Processing software, Arduino hardware were discussed. Several Arduino projects were demonstrated. Resources are posted here: https://www.evernote.com/shard/s89/sh/6fd6ce79-c0b2-495e-b6f8-a4c4335cd284/9b1d07121e9f4b89106bcfcba6463bdf
Citation preview
Introduction to Arduino
Kids & Technology MeetupApril 6, 2013
Washington, DC
2
What is the Arduino?• A microcontroller• Hardware + software• You can program it, make projects with it
Arduino
Your program (sketch)
Inputs/Sensors• Light• Motion• GPS
Outputs: Make things happen• Light up LEDs• Move wheels• Tweet
3
The Arduino’s PartsDigital Pins (0 – 13) inputs & outputs
Micro-processor
USB - sketch - power
AnalogInputs (0-5)Power
Sockets
ExternalPower (battery)
4
Some Components
LEDs – light emitting diodes
ResistorsBreadboard
5
Programming
Variables
Setup – runs once
Loop – main program that repeats
A Processing “Sketch”3 main sketch areas
6
Basic Processing Structure// this is a comment - make notes to yourself and to others
int led = 13; // we will connect an LED to pin # 13 – and 13 is an integer // end lines with semicolons
void setup () // place things here that need to be set up at the beginning{ // curly braces { } define blocks of code
pinMode(led, OUTPUT); // digital pin 13 will be an output – OUTPUT is a key word}
void loop() // main sketch code goes here. It will repeat until the board is turned off.{ digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) – HIGH = key word delay(1000); // wait for one second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW – LOW = key word delay(1000); // wait for one second}
7
Processing Language Basic Interactive Functions
pinMode(pin, mode): set a digital pin to input or output mode (INPUT or OUTPUT).
digitalRead(pin): returns the value of a digital pin, either LOW or HIGH
digitalWrite(pin, value): writes LOW or HIGH to a digital pin.
analogRead(pin): returns the value of an analog input (from 0 to 1023).
analogWrite(pin, value): writes an analog value (PWM wave) to a digital pin that supports it (pins 3, 5, 6, 9, 10, and 11); value should be from 0 (always off) to 255 (always on).
delay(time in milliseconds): pauses the code for the amount of time in milliseconds (1 second = 1000 milliseconds)
More terms, syntax, functions: http://arduino.cc/en/Reference/HomePage
ArduBlocks
• It is a tool to use block programming with Arduino
It is similar to Scratch
The classic blink script
11
Project Demonstrations
• We will demonstrate several projects– Interactive game (Simon Says)– ArduBlocks – Light sensor input– Arduino + Scratch– Drawbot – a drawing robot
12
Videos of Other Projects for Inspiration
• LED cube: – http://www.youtube.com/watch?v=GUcX41pokZY
• Turn signal cycling jacket:– http://www.youtube.com/watch?v=ZtNEPkwCfxA
• Robot controlled by iPhone: – http://www.youtube.com/watch?v=ZgMHxu6gS40
• Quadcopter: – https://www.youtube.com/watch?v=eKWboJ0RJtQ
Search for other ideas!
13
Links• Start here: http://arduino.cc/ • We have compiled links for:
– Project ideas – lists and videos– How to program– The videos of the demos projects– Places to learn
• HacDC http://www.meetup.com/hac-dc/• Nova Labs http://www.meetup.com/NOVA-Makers/
– Places to buy Arduinos and components
• All of these links will be posted at the Kids Tech Meetup site (http://www.meetup.com/Kids-and-Technology/) and this public EverNote notebook: https://www.evernote.com/pub/greenmoonart/arduino
14
Raffle
• We have a few prizes to give away– Arduinos– Breadboards– Patches
15
Questions?
• Feel free to contact us– John Dukovich – twitter: @JohnDukovich– Hugo Estrada – Google+– Phil Shapiro – twitter: @PhilShapiro
• Stay in touch with the MeetUp: – http://www.meetup.com/Kids-and-Technology/
Recommended