Professional Documents
Culture Documents
Bluetooth
Lily Pads!
Basic Terminology – ADC
How can it be used?
(Analog to digital converter)
• Log data (external flash card).
• Analog signal IN.
• Cheap interface to PC (via serial, wireless
• The Arduino has 10 bits of
and USB protocols). resolution when reading analog
signals.
• Control larger currents using H-Bridges
• 210 = 1024 Increments
(variable) and relays (on/off).
• Influence by also how fast you
• Serve as a cheap replacement for a DAQ. sample.
• 0 to 5 Volts.
• 28 = 255 Increments
digitalWrite digitalRead
int ledPin = 13; // LED connected to digital pin 13
int ledPin = 13; // LED connected to digital pin 13 int inPin = 7; // pushbutton connected to digital pin 7
int val = 0; // variable to store the read value
void setup()
{ void setup()
pinMode(ledPin, OUTPUT); // sets the digital pin as output {
} pinMode(ledPin, OUTPUT); // sets the digital pin 13 as output
pinMode(inPin, INPUT); // sets the digital pin 7 as input
void loop() }
{
digitalWrite(ledPin, HIGH); // sets the LED on void loop()
delay(1000); // waits for a second {
digitalWrite(ledPin, LOW); // sets the LED off val = digitalRead(inPin); // read the input pin
delay(1000); // waits for a second digitalWrite(ledPin, val); // sets the LED to the button's value
} }
analogRead analogWrite
int ledPin = 13; // LED connected to digital pin 13 int ledPin = 9; // LED connected to digital pin 9
int analogPin = 3; // potentiometer connected to analog pin 3
int val = 0; // variable to store the read value
int analogPin = 3; // potentiometer connected to analog pin 3
int threshold = 512; // threshold int val = 0; // variable to store the read value
USB
XBEE
Serial Communication Serial Communication
int incomingByte = 0; // for incoming serial data
• Serial.begin(speed)
void setup() {
• Serial.available() }
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
• Multiplexer controller.
• Outputs data to SD card or PC via wireless connection.
http://www.arduino.cc/
http://www.sparkfun.com