SlideShare a Scribd company logo
1 of 112
Download to read offline
Intro to Arduino 
The Basics of Open Hardware and Circuits 
Code4LibDC 2014 
Jason Griffey 
Evenly Distributed LLC 
http://evenlydistributed.net
SSID: LibraryBox - Free Content! 
Connect to wifi signal, then launch/refresh any browser 
Folder: Code4LibDC 
http://librarybox.us
Software install?
Let’s Plug In
Open Source Hardware
Moore’s Law 
Photo by Marcin Wichary - http://flic.kr/p/4v4DSq
Koomey’s Law 
Photo by LisaW123 - http://flic.kr/p/7eiqaq
Photo by sobczak.paul - http://flic.kr/p/aDD8ep
Arduino
Photo by bjepson - http://flic.kr/p/8EVHqm
Why Arduino?
Open Hardware
Photo by dam - http://flic.kr/p/8hLXBM
Photo by dam - http://flic.kr/p/8hLXwT
Photo by dam - http://flic.kr/p/8hQcJs
Photo by dam - http://flic.kr/p/8hQcDG
Photo by dam - http://flic.kr/p/8hQcDG
Photo by Nathan Chantrell - http://flic.kr/p/aALqhd
Photo by Nathan Chantrell - http://flic.kr/p/aALqhd
Photo by antonw - http://flic.kr/p/91daJe 
Shields
A La Mode
Sensors 
http://learn.adafruit.com/system/assets/assets/000/000/426/original/FSR402_MED.jpg?1340650766
Arduino Software
Our Hardware
Fritzing
Arduino 
IDE
Our Sketch
int val; 
! 
void setup() 
{ 
pinMode(2,OUTPUT); 
pinMode(3,OUTPUT); 
pinMode(4,OUTPUT); 
pinMode(5,OUTPUT); 
Serial.begin(9600); 
} 
! 
void loop() 
{ 
Serial.println(analogRead(0)); 
val = analogRead(0); 
! 
if (val > 256) 
digitalWrite(2,HIGH); 
if (val < 256) 
digitalWrite(2,LOW); 
if (val > 512) 
digitalWrite(3,HIGH); 
if (val < 512) 
digitalWrite(3,LOW); 
! 
if (val > 768) 
digitalWrite(4,HIGH); 
if (val < 768) 
digitalWrite(4,LOW); 
! 
if (val > 769) 
digitalWrite(5,HIGH); 
if (val < 1020) 
digitalWrite(5,LOW); 
} 
Globals 
Setup 
Loop
int val; 
! 
void setup() 
{ 
pinMode(2,OUTPUT); 
pinMode(3,OUTPUT); 
pinMode(4,OUTPUT); 
pinMode(5,OUTPUT); 
Serial.begin(9600); 
} 
! 
void loop() 
{ 
Serial.println(analogRead(0)); 
val = analogRead(0); 
! 
if (val > 256) 
digitalWrite(2,HIGH); 
if (val < 256) 
digitalWrite(2,LOW); 
if (val > 512) 
digitalWrite(3,HIGH); 
if (val < 512) 
digitalWrite(3,LOW); 
! 
if (val > 768) 
digitalWrite(4,HIGH); 
if (val < 768) 
digitalWrite(4,LOW); 
! 
if (val > 769) 
digitalWrite(5,HIGH); 
if (val < 1020) 
digitalWrite(5,LOW); 
} 
Globals 
Setup 
Loop
int val; 
! 
void setup() 
{ 
pinMode(2,OUTPUT); 
pinMode(3,OUTPUT); 
pinMode(4,OUTPUT); 
pinMode(5,OUTPUT); 
Serial.begin(9600); 
} 
! 
void loop() 
{ 
Serial.println(analogRead(0)); 
val = analogRead(0); 
! 
if (val > 256) 
digitalWrite(2,HIGH); 
if (val < 256) 
digitalWrite(2,LOW); 
if (val > 512) 
digitalWrite(3,HIGH); 
if (val < 512) 
digitalWrite(3,LOW); 
! 
if (val > 768) 
digitalWrite(4,HIGH); 
if (val < 768) 
digitalWrite(4,LOW); 
! 
if (val > 769) 
digitalWrite(5,HIGH); 
if (val < 1020) 
digitalWrite(5,LOW); 
} 
Globals 
Setup 
Loop
int val; 
! 
void setup() 
{ 
pinMode(2,OUTPUT); 
pinMode(3,OUTPUT); 
pinMode(4,OUTPUT); 
pinMode(5,OUTPUT); 
Serial.begin(9600); 
} 
! 
void loop() 
{ 
Serial.println(analogRead(0)); 
val = analogRead(0); 
! 
if (val > 256) 
digitalWrite(2,HIGH); 
if (val < 256) 
digitalWrite(2,LOW); 
if (val > 512) 
digitalWrite(3,HIGH); 
if (val < 512) 
digitalWrite(3,LOW); 
! 
if (val > 768) 
digitalWrite(4,HIGH); 
if (val < 768) 
digitalWrite(4,LOW); 
! 
if (val > 769) 
digitalWrite(5,HIGH); 
if (val < 1020) 
digitalWrite(5,LOW); 
} 
Globals 
Setup 
Loop
Can you:
Can you: 
• Change one of the Pin Numbers?
Can you: 
• Change one of the Pin Numbers? 
• Re-wire the ground wires?
Can you: 
• Change one of the Pin Numbers? 
• Re-wire the ground wires? 
• Change the order the LEDs light up?
Can you: 
• Change one of the Pin Numbers? 
• Re-wire the ground wires? 
• Change the order the LEDs light up? 
• Light up 2 LEDs at once?
Can you: 
• Change one of the Pin Numbers? 
• Re-wire the ground wires? 
• Change the order the LEDs light up? 
• Light up 2 LEDs at once? 
• Add another LED?
Can you: 
• Change one of the Pin Numbers? 
• Re-wire the ground wires? 
• Change the order the LEDs light up? 
• Light up 2 LEDs at once? 
• Add another LED? 
• Swap the sensor?
Structure 
/* Each Arduino sketch must contain the 
following two functions. */ 
void setup() 
{ 
/* this code runs once at the beginning of 
the code execution. */ 
} 
void loop() 
{ 
/* this code runs repeatedly over and over 
as long as the board is powered. */ 
} 
Comments 
// this is a single line 
/* this is 
a multiline */ 
Setup 
pinMode(pin, [INPUT  OUTPUT  INPUT_PULLUP]); 
/* Sets the mode of the digital I/O pin. 
It can be set as an input, output, or an 
input with an internal pull-up resistor. 
*/ 
Control Structures 
if(condition) 
{ 
// if condition is TRUE, do something here 
} 
else 
{ 
// otherwise, do this 
} 
for(initialization; condition; increment) 
{ 
// do this 
} 
/* The ‘for’ statement is used to repeat 
a block of statements enclosed in curly 
braces. An increment counter is usually 
used to increment and terminate the loop. 
*/ 
Digital I/O 
digitalWrite(pin, val); 
/* val = HIGH or LOW. Sets the 
digital pin to either ON or OFF. */ 
int var = digitalRead(pin); 
/* Reads the voltage from a digital 
pin. Returns either HIGH or LOW. */ 
int var = digitalRead(pin); 
/* Reads the value from a specified digital 
pin, either HIGH or LOW. */ 
Analog I/O 
analogWrite(pin, val); 
/* Writes an analog voltage to a pin. 
val = integer value from 0 to 255 */ 
int var = analogRead(pin); 
/* Reads the voltage from the specified 
analog pin. */ 
int var = analogRead(pin); 
/* Reads the value from the specified 
analog pin. */ 
Time 
delay(time_ms); 
/* Pauses the program for the amount of time 
(in milliseconds). */ 
delayMicroseconds(time_us); 
/* Pauses the program for the amount of time 
(in microseconds). */ 
millis(); 
/* Returns the number of milliseconds since 
the board began running the current program. 
max: 4,294,967,295 */ 
micros(); 
/* Returns the number of microseconds since 
the board began running the current program. 
max: 4,294,967,295 */ 
Serial Communication 
Serial.begin(baudrate); 
/* Sets the data rate in bits per second 
(baud) for serial data transmission. */ 
Serial.print(""); 
/* Sets the data rate in bits per second 
(baud) for serial data transmission. */ 
Serial.print("Hello World!!"); 
/* Sends a string "Hello World!!" to the 
serial bus. This will be seen on the Serial 
Monitor in Arduino. */ 
Serial.println("Hello World!"); 
/* Identical to Serial.print(), but this 
also adds a carriage-return / line-feed to 
advance to the next line. */ 
Serial.println(""); 
/* Identical to Serial.print(), but this 
also adds a carriage-return / line-feed to 
advance to the next line. */ 
boolean Serial.available() 
/* Serial.available() returns TRUE if there 
is data available on the Serial bus. */ 
int Serial.read(); 
/* Returns a single byte of data available 
from the Serial buffer. */ 
int Serial.read(); 
/* Returns a single byte of data available 
from the Serial buffer. */ 
Data Types 
void // nothing is returned 
boolean // 0, 1, false, true 
char // 8 bits: ASCII character 
byte // 8 bits: 0 to 255, unsigned 
int // 16 bits: 32,768 to 32,767, signed 
long /* 32 bits: 2,147,483,648 
to 2,147,483,647, signed */ 
float // 32 bits, signed decimal 
Constants 
HIGH  LOW 
INPUT  OUTPUT 
true  false 
Mathematical Operators 
= // assignment 
+ // addition 
- // subtraction 
* // multiplication 
/ // division 
% // modulus 
Logical Operators 
== // boolean equal to 
!= // not equal to 
< // less than 
> // greater than 
<= // less than or equal to 
>= // greater than or equal to 
&& // Boolean AND 
|| // Boolean OR 
! // Boolean NOT 
Bitwise Operators 
& // bitwise AND 
| // bitwise OR 
^ // bitwise XOR 
~ // bitwise INVERT 
var << n // bitwise shift left by n bits 
var >> n // bitwise shift right by n bits 
Libraries 
#include <libraryname.h> 
/* this provides access to special 
additional functions for things such as 
servo motors, SD card, wifi, or bluetooth. 
*/ 
Advanced I/O 
tone(pin, freq); 
/* Generates a square wave of the specified 
frequency to a pin. Pin must be one of the 
PWM (~) pins. */ 
tone(pin, freq, duration); 
/* Generates a square wave of the specified 
frequency to a pin for a duration in 
milliseconds. Pin must be one of the PWM (~) 
pins. */ 
noTone(pin); 
// Turns off the tone on the pin. 
RedBoard: 
Power In 
LilyPad ProtoSnap Simple: 
Digital I/O 
PWM(3,5,6,9,10,11) 
ATmega328 
Microcontroller 
Temperature 
Sensor 
(Pin A1) 
Vibe Motor 
(Pin 3) 
RGB LED 
(Pins R=9, 
G=11, B=10) 
Button 
(Pin A5) 
Switch 
(Pin 2) 
Light 
Sensor 
(Pin A6) 
Buzzer/ 
Speaker 
(Pin 7) 
LEDs 
(Light Emitting Diodes) 
(Pins 5, 6, A2, A4, A3) 
Power 
5V / 3.3 / GND 
USB to Computer 
Reset 
Analog 
Inputs 
SCL/SDA 
(I2C Bus) 
ATmega328 
Microcontroller
Building Your Own Hardware
Patron Counters
$300
$280
Build One Yourself
Build One Yourself 
• Arduino - $35
Build One Yourself 
• Arduino - $35 
• Data Logger Shield - $20
Build One Yourself 
• Arduino - $35 
• Data Logger Shield - $20 
• SD Card - $10
Build One Yourself 
• Arduino - $35 
• Data Logger Shield - $20 
• SD Card - $10 
• Sensor (infrared, laser tripwire, ultrasonic, or 
PID) - $10
Build One Yourself 
• Arduino - $35 
• Data Logger Shield - $20 
• SD Card - $10 
• Sensor (infrared, laser tripwire, ultrasonic, or 
PID) - $10 
• TOTAL COST - $70
Temperature/Humidity 
Loggers
$240
$415
Build One Yourself
Build One Yourself 
• Arduino - $35
Build One Yourself 
• Arduino - $35 
• Data Logger Shield - $20
Build One Yourself 
• Arduino - $35 
• Data Logger Shield - $20 
• SD Card - $10
Build One Yourself 
• Arduino - $35 
• Data Logger Shield - $20 
• SD Card - $10 
• Temperature/Humidity Sensor - $5-10
Build One Yourself 
• Arduino - $35 
• Data Logger Shield - $20 
• SD Card - $10 
• Temperature/Humidity Sensor - $5-10 
• LCD Display screen - $15
Build One Yourself 
• Arduino - $35 
• Data Logger Shield - $20 
• SD Card - $10 
• Temperature/Humidity Sensor - $5-10 
• LCD Display screen - $15 
• TOTAL COST - $85
Other Possibilities
Other Possibilities 
• RFID Reader
Other Possibilities 
• RFID Reader 
• Barcode Scanner
Other Possibilities 
• RFID Reader 
• Barcode Scanner 
• Seat usage detector
Other Possibilities 
• RFID Reader 
• Barcode Scanner 
• Seat usage detector 
• What else?
Go Build Stuff!
Jason Griffey 
Email: griffey@gmail.com 
Site: jasongriffey.net 
gVoice: 423-443-4770 
Twitter: @griffey 
http://librarybox.us 
http://evenlydistributed.net 
! 
Founder & Principal Consultant 
http://pinboard.in/u:griffey/ Evenly Distributed LLC

More Related Content

What's hot

Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to ArduinoQtechknow
 
Arduino experimenters guide hq
Arduino experimenters guide hqArduino experimenters guide hq
Arduino experimenters guide hqAndreis Santos
 
Introducing the Arduino
Introducing the ArduinoIntroducing the Arduino
Introducing the ArduinoCharles A B Jr
 
Basics of arduino uno
Basics of arduino unoBasics of arduino uno
Basics of arduino unoRahat Sood
 
Arduino as an embedded industrial controller
Arduino as an embedded industrial controllerArduino as an embedded industrial controller
Arduino as an embedded industrial controllerJose Luis Poza Luján
 
Arduino Day 1 Presentation
Arduino Day 1 PresentationArduino Day 1 Presentation
Arduino Day 1 PresentationYogendra Tamang
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerMujahid Hussain
 
Arduino and c programming
Arduino and c programmingArduino and c programming
Arduino and c programmingPunit Goswami
 
Programming with arduino
Programming with arduinoProgramming with arduino
Programming with arduinoMakers of India
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduinoyeokm1
 
Arduino : how to get started
Arduino : how to get startedArduino : how to get started
Arduino : how to get started동호 손
 
Cassiopeia Ltd - standard Arduino workshop
Cassiopeia Ltd - standard Arduino workshopCassiopeia Ltd - standard Arduino workshop
Cassiopeia Ltd - standard Arduino workshoptomtobback
 
Arduino Lecture 1 - Introducing the Arduino
Arduino Lecture 1 - Introducing the ArduinoArduino Lecture 1 - Introducing the Arduino
Arduino Lecture 1 - Introducing the ArduinoEoin Brazil
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduinoMohamed Essam
 
Arduino Workshop
Arduino WorkshopArduino Workshop
Arduino Workshopatuline
 

What's hot (20)

Aurdino presentation
Aurdino presentationAurdino presentation
Aurdino presentation
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
 
Arduino experimenters guide hq
Arduino experimenters guide hqArduino experimenters guide hq
Arduino experimenters guide hq
 
Introducing the Arduino
Introducing the ArduinoIntroducing the Arduino
Introducing the Arduino
 
Arduino: Arduino lcd
Arduino: Arduino lcdArduino: Arduino lcd
Arduino: Arduino lcd
 
Basics of arduino uno
Basics of arduino unoBasics of arduino uno
Basics of arduino uno
 
Arduino as an embedded industrial controller
Arduino as an embedded industrial controllerArduino as an embedded industrial controller
Arduino as an embedded industrial controller
 
Arduino Day 1 Presentation
Arduino Day 1 PresentationArduino Day 1 Presentation
Arduino Day 1 Presentation
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino Microcontroller
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Arduino and c programming
Arduino and c programmingArduino and c programming
Arduino and c programming
 
Programming with arduino
Programming with arduinoProgramming with arduino
Programming with arduino
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Different Arduino Boards
Different Arduino BoardsDifferent Arduino Boards
Different Arduino Boards
 
Arduino : how to get started
Arduino : how to get startedArduino : how to get started
Arduino : how to get started
 
Cassiopeia Ltd - standard Arduino workshop
Cassiopeia Ltd - standard Arduino workshopCassiopeia Ltd - standard Arduino workshop
Cassiopeia Ltd - standard Arduino workshop
 
Arduino Lecture 1 - Introducing the Arduino
Arduino Lecture 1 - Introducing the ArduinoArduino Lecture 1 - Introducing the Arduino
Arduino Lecture 1 - Introducing the Arduino
 
CTC - What is Arduino
CTC - What is ArduinoCTC - What is Arduino
CTC - What is Arduino
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduino
 
Arduino Workshop
Arduino WorkshopArduino Workshop
Arduino Workshop
 

Viewers also liked

Computers in libraries 2012
Computers in libraries 2012Computers in libraries 2012
Computers in libraries 2012Jason Griffey
 
The Future of Things
The Future of ThingsThe Future of Things
The Future of ThingsJason Griffey
 
The future is a platform
The future is a platformThe future is a platform
The future is a platformJason Griffey
 
SIUI - Libraries & the Post-PC Era
SIUI - Libraries & the Post-PC EraSIUI - Libraries & the Post-PC Era
SIUI - Libraries & the Post-PC EraJason Griffey
 
Maine Regional Fall Council Workshop
Maine Regional Fall Council WorkshopMaine Regional Fall Council Workshop
Maine Regional Fall Council WorkshopJason Griffey
 
Lita Forum 2009 Mobile Day One
Lita Forum 2009 Mobile Day OneLita Forum 2009 Mobile Day One
Lita Forum 2009 Mobile Day OneJason Griffey
 
Mobile - Internet Librarian 2009
Mobile - Internet Librarian 2009Mobile - Internet Librarian 2009
Mobile - Internet Librarian 2009Jason Griffey
 
Not Evenly Distributed
Not Evenly DistributedNot Evenly Distributed
Not Evenly DistributedJason Griffey
 
Lita Forum 2009 Mobile Day Two
Lita Forum 2009 Mobile Day TwoLita Forum 2009 Mobile Day Two
Lita Forum 2009 Mobile Day TwoJason Griffey
 
SANDALL: Mobile Technologies
SANDALL: Mobile TechnologiesSANDALL: Mobile Technologies
SANDALL: Mobile TechnologiesJason Griffey
 
COSLINE eBook Workshop
COSLINE eBook WorkshopCOSLINE eBook Workshop
COSLINE eBook WorkshopJason Griffey
 
Connecticut Library Association 2011 final
Connecticut Library Association 2011 finalConnecticut Library Association 2011 final
Connecticut Library Association 2011 finalJason Griffey
 
WebJunction Gadgets webinar
WebJunction Gadgets webinarWebJunction Gadgets webinar
WebJunction Gadgets webinarJason Griffey
 
Mississippi State Emerging Technologies Summit 2010
Mississippi State Emerging Technologies Summit 2010Mississippi State Emerging Technologies Summit 2010
Mississippi State Emerging Technologies Summit 2010Jason Griffey
 
Tech Trends from ALA 2010
Tech Trends from ALA 2010Tech Trends from ALA 2010
Tech Trends from ALA 2010Jason Griffey
 
Computers in Libraries 2011: Tablets & Superphones
Computers in Libraries 2011: Tablets & SuperphonesComputers in Libraries 2011: Tablets & Superphones
Computers in Libraries 2011: Tablets & SuperphonesJason Griffey
 
OLITA: Mobility & Post-mobility
OLITA: Mobility & Post-mobilityOLITA: Mobility & Post-mobility
OLITA: Mobility & Post-mobilityJason Griffey
 
IOLUG Mobile Futures Keynote
IOLUG Mobile Futures KeynoteIOLUG Mobile Futures Keynote
IOLUG Mobile Futures KeynoteJason Griffey
 

Viewers also liked (20)

Computers in libraries 2012
Computers in libraries 2012Computers in libraries 2012
Computers in libraries 2012
 
The Future of Things
The Future of ThingsThe Future of Things
The Future of Things
 
The future is a platform
The future is a platformThe future is a platform
The future is a platform
 
SIUI - Libraries & the Post-PC Era
SIUI - Libraries & the Post-PC EraSIUI - Libraries & the Post-PC Era
SIUI - Libraries & the Post-PC Era
 
Maine Regional Fall Council Workshop
Maine Regional Fall Council WorkshopMaine Regional Fall Council Workshop
Maine Regional Fall Council Workshop
 
Arduino
ArduinoArduino
Arduino
 
Lita Forum 2009 Mobile Day One
Lita Forum 2009 Mobile Day OneLita Forum 2009 Mobile Day One
Lita Forum 2009 Mobile Day One
 
Mobile - Internet Librarian 2009
Mobile - Internet Librarian 2009Mobile - Internet Librarian 2009
Mobile - Internet Librarian 2009
 
Not Evenly Distributed
Not Evenly DistributedNot Evenly Distributed
Not Evenly Distributed
 
Lita Forum 2009 Mobile Day Two
Lita Forum 2009 Mobile Day TwoLita Forum 2009 Mobile Day Two
Lita Forum 2009 Mobile Day Two
 
SANDALL: Mobile Technologies
SANDALL: Mobile TechnologiesSANDALL: Mobile Technologies
SANDALL: Mobile Technologies
 
COSLINE eBook Workshop
COSLINE eBook WorkshopCOSLINE eBook Workshop
COSLINE eBook Workshop
 
Connecticut Library Association 2011 final
Connecticut Library Association 2011 finalConnecticut Library Association 2011 final
Connecticut Library Association 2011 final
 
WebJunction Gadgets webinar
WebJunction Gadgets webinarWebJunction Gadgets webinar
WebJunction Gadgets webinar
 
Realtime Web
Realtime WebRealtime Web
Realtime Web
 
Mississippi State Emerging Technologies Summit 2010
Mississippi State Emerging Technologies Summit 2010Mississippi State Emerging Technologies Summit 2010
Mississippi State Emerging Technologies Summit 2010
 
Tech Trends from ALA 2010
Tech Trends from ALA 2010Tech Trends from ALA 2010
Tech Trends from ALA 2010
 
Computers in Libraries 2011: Tablets & Superphones
Computers in Libraries 2011: Tablets & SuperphonesComputers in Libraries 2011: Tablets & Superphones
Computers in Libraries 2011: Tablets & Superphones
 
OLITA: Mobility & Post-mobility
OLITA: Mobility & Post-mobilityOLITA: Mobility & Post-mobility
OLITA: Mobility & Post-mobility
 
IOLUG Mobile Futures Keynote
IOLUG Mobile Futures KeynoteIOLUG Mobile Futures Keynote
IOLUG Mobile Futures Keynote
 

Similar to Introduction to Arduino and Circuits

Scottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RADScottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RADlostcaggy
 
Multi Sensory Communication 2/2
Multi Sensory Communication 2/2Multi Sensory Communication 2/2
Multi Sensory Communication 2/2Satoru Tokuhisa
 
Syed IoT - module 5
Syed  IoT - module 5Syed  IoT - module 5
Syed IoT - module 5Syed Mustafa
 
Arduino windows remote control
Arduino windows remote controlArduino windows remote control
Arduino windows remote controlVilayatAli5
 
Webshield internet of things
Webshield internet of thingsWebshield internet of things
Webshield internet of thingsRaghav Shetty
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3Jeni Shah
 
What will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfWhat will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfSIGMATAX1
 
Arduino shield wifi-monitorizarelocuinta
Arduino shield wifi-monitorizarelocuintaArduino shield wifi-monitorizarelocuinta
Arduino shield wifi-monitorizarelocuintaIulius Bors
 
Arduino Slides With Neopixels
Arduino Slides With NeopixelsArduino Slides With Neopixels
Arduino Slides With Neopixelssdcharle
 
Arduino for Beginners
Arduino for BeginnersArduino for Beginners
Arduino for BeginnersSarwan Singh
 
teststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptxteststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptxethannguyen1618
 
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdfJayanthi Kannan MK
 
Magnetic door lock using arduino
Magnetic door lock using arduinoMagnetic door lock using arduino
Magnetic door lock using arduinoSravanthi Sinha
 
Arduino: Intro and Digital I/O
Arduino: Intro and Digital I/OArduino: Intro and Digital I/O
Arduino: Intro and Digital I/OJune-Hao Hou
 

Similar to Introduction to Arduino and Circuits (20)

Scottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RADScottish Ruby Conference 2010 Arduino, Ruby RAD
Scottish Ruby Conference 2010 Arduino, Ruby RAD
 
Multi Sensory Communication 2/2
Multi Sensory Communication 2/2Multi Sensory Communication 2/2
Multi Sensory Communication 2/2
 
Syed IoT - module 5
Syed  IoT - module 5Syed  IoT - module 5
Syed IoT - module 5
 
Arduino windows remote control
Arduino windows remote controlArduino windows remote control
Arduino windows remote control
 
Arduino
ArduinoArduino
Arduino
 
Webshield internet of things
Webshield internet of thingsWebshield internet of things
Webshield internet of things
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3
 
What will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdfWhat will be quantization step size in numbers and in voltage for th.pdf
What will be quantization step size in numbers and in voltage for th.pdf
 
Arduino shield wifi-monitorizarelocuinta
Arduino shield wifi-monitorizarelocuintaArduino shield wifi-monitorizarelocuinta
Arduino shield wifi-monitorizarelocuinta
 
How to use an Arduino
How to use an ArduinoHow to use an Arduino
How to use an Arduino
 
Arduino Slides With Neopixels
Arduino Slides With NeopixelsArduino Slides With Neopixels
Arduino Slides With Neopixels
 
Arduino intro.pptx
Arduino intro.pptxArduino intro.pptx
Arduino intro.pptx
 
Arduino for Beginners
Arduino for BeginnersArduino for Beginners
Arduino for Beginners
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
teststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptxteststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptx
 
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
 
Magnetic door lock using arduino
Magnetic door lock using arduinoMagnetic door lock using arduino
Magnetic door lock using arduino
 
Arduino Programming Basic
Arduino Programming BasicArduino Programming Basic
Arduino Programming Basic
 
Arduino: Intro and Digital I/O
Arduino: Intro and Digital I/OArduino: Intro and Digital I/O
Arduino: Intro and Digital I/O
 

More from Jason Griffey

State Library of New South Wales 2013
State Library of New South Wales 2013State Library of New South Wales 2013
State Library of New South Wales 2013Jason Griffey
 
KLA 2013 Mobile Technology
KLA 2013 Mobile TechnologyKLA 2013 Mobile Technology
KLA 2013 Mobile TechnologyJason Griffey
 
KLA 2013 Future Technology
KLA 2013 Future TechnologyKLA 2013 Future Technology
KLA 2013 Future TechnologyJason Griffey
 
LibraryBox and Kickstarter
LibraryBox and KickstarterLibraryBox and Kickstarter
LibraryBox and KickstarterJason Griffey
 
TN library association gadget precon 2013
TN library association gadget precon 2013TN library association gadget precon 2013
TN library association gadget precon 2013Jason Griffey
 
Open Hardware and Libraries
Open Hardware and LibrariesOpen Hardware and Libraries
Open Hardware and LibrariesJason Griffey
 
Mid-Tennessee Region Future Technology Presentation
Mid-Tennessee Region Future Technology PresentationMid-Tennessee Region Future Technology Presentation
Mid-Tennessee Region Future Technology PresentationJason Griffey
 
Mid-Tennessee Region Mobile Technology Presentation
Mid-Tennessee Region Mobile Technology PresentationMid-Tennessee Region Mobile Technology Presentation
Mid-Tennessee Region Mobile Technology PresentationJason Griffey
 
The Future is Already Here
The Future is Already HereThe Future is Already Here
The Future is Already HereJason Griffey
 
Minnesota ARLD Day 2011
Minnesota ARLD Day 2011Minnesota ARLD Day 2011
Minnesota ARLD Day 2011Jason Griffey
 
Georgia library association 2011
Georgia library association 2011Georgia library association 2011
Georgia library association 2011Jason Griffey
 
Meredith - Guest lecture on Mobile
Meredith - Guest lecture on MobileMeredith - Guest lecture on Mobile
Meredith - Guest lecture on MobileJason Griffey
 
Building a 21st Century Library
Building a 21st Century LibraryBuilding a 21st Century Library
Building a 21st Century LibraryJason Griffey
 

More from Jason Griffey (16)

Making Our Futures
Making Our FuturesMaking Our Futures
Making Our Futures
 
State Library of New South Wales 2013
State Library of New South Wales 2013State Library of New South Wales 2013
State Library of New South Wales 2013
 
KLA 2013 Mobile Technology
KLA 2013 Mobile TechnologyKLA 2013 Mobile Technology
KLA 2013 Mobile Technology
 
KLA 2013 Future Technology
KLA 2013 Future TechnologyKLA 2013 Future Technology
KLA 2013 Future Technology
 
LibraryBox and Kickstarter
LibraryBox and KickstarterLibraryBox and Kickstarter
LibraryBox and Kickstarter
 
TN library association gadget precon 2013
TN library association gadget precon 2013TN library association gadget precon 2013
TN library association gadget precon 2013
 
Open Hardware and Libraries
Open Hardware and LibrariesOpen Hardware and Libraries
Open Hardware and Libraries
 
Mid-Tennessee Region Future Technology Presentation
Mid-Tennessee Region Future Technology PresentationMid-Tennessee Region Future Technology Presentation
Mid-Tennessee Region Future Technology Presentation
 
Mid-Tennessee Region Mobile Technology Presentation
Mid-Tennessee Region Mobile Technology PresentationMid-Tennessee Region Mobile Technology Presentation
Mid-Tennessee Region Mobile Technology Presentation
 
The Future is Already Here
The Future is Already HereThe Future is Already Here
The Future is Already Here
 
Minnesota ARLD Day 2011
Minnesota ARLD Day 2011Minnesota ARLD Day 2011
Minnesota ARLD Day 2011
 
Focus on the Future
Focus on the FutureFocus on the Future
Focus on the Future
 
Georgia library association 2011
Georgia library association 2011Georgia library association 2011
Georgia library association 2011
 
Meredith - Guest lecture on Mobile
Meredith - Guest lecture on MobileMeredith - Guest lecture on Mobile
Meredith - Guest lecture on Mobile
 
Building a 21st Century Library
Building a 21st Century LibraryBuilding a 21st Century Library
Building a 21st Century Library
 
Extending your blog
Extending your blogExtending your blog
Extending your blog
 

Recently uploaded

Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 

Recently uploaded (20)

Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 

Introduction to Arduino and Circuits

  • 1. Intro to Arduino The Basics of Open Hardware and Circuits Code4LibDC 2014 Jason Griffey Evenly Distributed LLC http://evenlydistributed.net
  • 2.
  • 3. SSID: LibraryBox - Free Content! Connect to wifi signal, then launch/refresh any browser Folder: Code4LibDC http://librarybox.us
  • 4.
  • 5.
  • 6.
  • 10. Moore’s Law Photo by Marcin Wichary - http://flic.kr/p/4v4DSq
  • 11. Koomey’s Law Photo by LisaW123 - http://flic.kr/p/7eiqaq
  • 12. Photo by sobczak.paul - http://flic.kr/p/aDD8ep
  • 14. Photo by bjepson - http://flic.kr/p/8EVHqm
  • 15.
  • 18. Photo by dam - http://flic.kr/p/8hLXBM
  • 19. Photo by dam - http://flic.kr/p/8hLXwT
  • 20. Photo by dam - http://flic.kr/p/8hQcJs
  • 21. Photo by dam - http://flic.kr/p/8hQcDG
  • 22. Photo by dam - http://flic.kr/p/8hQcDG
  • 23. Photo by Nathan Chantrell - http://flic.kr/p/aALqhd
  • 24. Photo by Nathan Chantrell - http://flic.kr/p/aALqhd
  • 25.
  • 26.
  • 27. Photo by antonw - http://flic.kr/p/91daJe Shields
  • 28.
  • 29.
  • 30.
  • 33.
  • 34.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 65.
  • 68. int val; ! void setup() { pinMode(2,OUTPUT); pinMode(3,OUTPUT); pinMode(4,OUTPUT); pinMode(5,OUTPUT); Serial.begin(9600); } ! void loop() { Serial.println(analogRead(0)); val = analogRead(0); ! if (val > 256) digitalWrite(2,HIGH); if (val < 256) digitalWrite(2,LOW); if (val > 512) digitalWrite(3,HIGH); if (val < 512) digitalWrite(3,LOW); ! if (val > 768) digitalWrite(4,HIGH); if (val < 768) digitalWrite(4,LOW); ! if (val > 769) digitalWrite(5,HIGH); if (val < 1020) digitalWrite(5,LOW); } Globals Setup Loop
  • 69. int val; ! void setup() { pinMode(2,OUTPUT); pinMode(3,OUTPUT); pinMode(4,OUTPUT); pinMode(5,OUTPUT); Serial.begin(9600); } ! void loop() { Serial.println(analogRead(0)); val = analogRead(0); ! if (val > 256) digitalWrite(2,HIGH); if (val < 256) digitalWrite(2,LOW); if (val > 512) digitalWrite(3,HIGH); if (val < 512) digitalWrite(3,LOW); ! if (val > 768) digitalWrite(4,HIGH); if (val < 768) digitalWrite(4,LOW); ! if (val > 769) digitalWrite(5,HIGH); if (val < 1020) digitalWrite(5,LOW); } Globals Setup Loop
  • 70. int val; ! void setup() { pinMode(2,OUTPUT); pinMode(3,OUTPUT); pinMode(4,OUTPUT); pinMode(5,OUTPUT); Serial.begin(9600); } ! void loop() { Serial.println(analogRead(0)); val = analogRead(0); ! if (val > 256) digitalWrite(2,HIGH); if (val < 256) digitalWrite(2,LOW); if (val > 512) digitalWrite(3,HIGH); if (val < 512) digitalWrite(3,LOW); ! if (val > 768) digitalWrite(4,HIGH); if (val < 768) digitalWrite(4,LOW); ! if (val > 769) digitalWrite(5,HIGH); if (val < 1020) digitalWrite(5,LOW); } Globals Setup Loop
  • 71. int val; ! void setup() { pinMode(2,OUTPUT); pinMode(3,OUTPUT); pinMode(4,OUTPUT); pinMode(5,OUTPUT); Serial.begin(9600); } ! void loop() { Serial.println(analogRead(0)); val = analogRead(0); ! if (val > 256) digitalWrite(2,HIGH); if (val < 256) digitalWrite(2,LOW); if (val > 512) digitalWrite(3,HIGH); if (val < 512) digitalWrite(3,LOW); ! if (val > 768) digitalWrite(4,HIGH); if (val < 768) digitalWrite(4,LOW); ! if (val > 769) digitalWrite(5,HIGH); if (val < 1020) digitalWrite(5,LOW); } Globals Setup Loop
  • 72.
  • 74. Can you: • Change one of the Pin Numbers?
  • 75. Can you: • Change one of the Pin Numbers? • Re-wire the ground wires?
  • 76. Can you: • Change one of the Pin Numbers? • Re-wire the ground wires? • Change the order the LEDs light up?
  • 77. Can you: • Change one of the Pin Numbers? • Re-wire the ground wires? • Change the order the LEDs light up? • Light up 2 LEDs at once?
  • 78. Can you: • Change one of the Pin Numbers? • Re-wire the ground wires? • Change the order the LEDs light up? • Light up 2 LEDs at once? • Add another LED?
  • 79. Can you: • Change one of the Pin Numbers? • Re-wire the ground wires? • Change the order the LEDs light up? • Light up 2 LEDs at once? • Add another LED? • Swap the sensor?
  • 80. Structure /* Each Arduino sketch must contain the following two functions. */ void setup() { /* this code runs once at the beginning of the code execution. */ } void loop() { /* this code runs repeatedly over and over as long as the board is powered. */ } Comments // this is a single line /* this is a multiline */ Setup pinMode(pin, [INPUT OUTPUT INPUT_PULLUP]); /* Sets the mode of the digital I/O pin. It can be set as an input, output, or an input with an internal pull-up resistor. */ Control Structures if(condition) { // if condition is TRUE, do something here } else { // otherwise, do this } for(initialization; condition; increment) { // do this } /* The ‘for’ statement is used to repeat a block of statements enclosed in curly braces. An increment counter is usually used to increment and terminate the loop. */ Digital I/O digitalWrite(pin, val); /* val = HIGH or LOW. Sets the digital pin to either ON or OFF. */ int var = digitalRead(pin); /* Reads the voltage from a digital pin. Returns either HIGH or LOW. */ int var = digitalRead(pin); /* Reads the value from a specified digital pin, either HIGH or LOW. */ Analog I/O analogWrite(pin, val); /* Writes an analog voltage to a pin. val = integer value from 0 to 255 */ int var = analogRead(pin); /* Reads the voltage from the specified analog pin. */ int var = analogRead(pin); /* Reads the value from the specified analog pin. */ Time delay(time_ms); /* Pauses the program for the amount of time (in milliseconds). */ delayMicroseconds(time_us); /* Pauses the program for the amount of time (in microseconds). */ millis(); /* Returns the number of milliseconds since the board began running the current program. max: 4,294,967,295 */ micros(); /* Returns the number of microseconds since the board began running the current program. max: 4,294,967,295 */ Serial Communication Serial.begin(baudrate); /* Sets the data rate in bits per second (baud) for serial data transmission. */ Serial.print(""); /* Sets the data rate in bits per second (baud) for serial data transmission. */ Serial.print("Hello World!!"); /* Sends a string "Hello World!!" to the serial bus. This will be seen on the Serial Monitor in Arduino. */ Serial.println("Hello World!"); /* Identical to Serial.print(), but this also adds a carriage-return / line-feed to advance to the next line. */ Serial.println(""); /* Identical to Serial.print(), but this also adds a carriage-return / line-feed to advance to the next line. */ boolean Serial.available() /* Serial.available() returns TRUE if there is data available on the Serial bus. */ int Serial.read(); /* Returns a single byte of data available from the Serial buffer. */ int Serial.read(); /* Returns a single byte of data available from the Serial buffer. */ Data Types void // nothing is returned boolean // 0, 1, false, true char // 8 bits: ASCII character byte // 8 bits: 0 to 255, unsigned int // 16 bits: 32,768 to 32,767, signed long /* 32 bits: 2,147,483,648 to 2,147,483,647, signed */ float // 32 bits, signed decimal Constants HIGH LOW INPUT OUTPUT true false Mathematical Operators = // assignment + // addition - // subtraction * // multiplication / // division % // modulus Logical Operators == // boolean equal to != // not equal to < // less than > // greater than <= // less than or equal to >= // greater than or equal to && // Boolean AND || // Boolean OR ! // Boolean NOT Bitwise Operators & // bitwise AND | // bitwise OR ^ // bitwise XOR ~ // bitwise INVERT var << n // bitwise shift left by n bits var >> n // bitwise shift right by n bits Libraries #include <libraryname.h> /* this provides access to special additional functions for things such as servo motors, SD card, wifi, or bluetooth. */ Advanced I/O tone(pin, freq); /* Generates a square wave of the specified frequency to a pin. Pin must be one of the PWM (~) pins. */ tone(pin, freq, duration); /* Generates a square wave of the specified frequency to a pin for a duration in milliseconds. Pin must be one of the PWM (~) pins. */ noTone(pin); // Turns off the tone on the pin. RedBoard: Power In LilyPad ProtoSnap Simple: Digital I/O PWM(3,5,6,9,10,11) ATmega328 Microcontroller Temperature Sensor (Pin A1) Vibe Motor (Pin 3) RGB LED (Pins R=9, G=11, B=10) Button (Pin A5) Switch (Pin 2) Light Sensor (Pin A6) Buzzer/ Speaker (Pin 7) LEDs (Light Emitting Diodes) (Pins 5, 6, A2, A4, A3) Power 5V / 3.3 / GND USB to Computer Reset Analog Inputs SCL/SDA (I2C Bus) ATmega328 Microcontroller
  • 81. Building Your Own Hardware
  • 83. $300
  • 84. $280
  • 85.
  • 87. Build One Yourself • Arduino - $35
  • 88. Build One Yourself • Arduino - $35 • Data Logger Shield - $20
  • 89. Build One Yourself • Arduino - $35 • Data Logger Shield - $20 • SD Card - $10
  • 90. Build One Yourself • Arduino - $35 • Data Logger Shield - $20 • SD Card - $10 • Sensor (infrared, laser tripwire, ultrasonic, or PID) - $10
  • 91. Build One Yourself • Arduino - $35 • Data Logger Shield - $20 • SD Card - $10 • Sensor (infrared, laser tripwire, ultrasonic, or PID) - $10 • TOTAL COST - $70
  • 93. $240
  • 94. $415
  • 95.
  • 96.
  • 97.
  • 98.
  • 100. Build One Yourself • Arduino - $35
  • 101. Build One Yourself • Arduino - $35 • Data Logger Shield - $20
  • 102. Build One Yourself • Arduino - $35 • Data Logger Shield - $20 • SD Card - $10
  • 103. Build One Yourself • Arduino - $35 • Data Logger Shield - $20 • SD Card - $10 • Temperature/Humidity Sensor - $5-10
  • 104. Build One Yourself • Arduino - $35 • Data Logger Shield - $20 • SD Card - $10 • Temperature/Humidity Sensor - $5-10 • LCD Display screen - $15
  • 105. Build One Yourself • Arduino - $35 • Data Logger Shield - $20 • SD Card - $10 • Temperature/Humidity Sensor - $5-10 • LCD Display screen - $15 • TOTAL COST - $85
  • 107. Other Possibilities • RFID Reader
  • 108. Other Possibilities • RFID Reader • Barcode Scanner
  • 109. Other Possibilities • RFID Reader • Barcode Scanner • Seat usage detector
  • 110. Other Possibilities • RFID Reader • Barcode Scanner • Seat usage detector • What else?
  • 112. Jason Griffey Email: griffey@gmail.com Site: jasongriffey.net gVoice: 423-443-4770 Twitter: @griffey http://librarybox.us http://evenlydistributed.net ! Founder & Principal Consultant http://pinboard.in/u:griffey/ Evenly Distributed LLC