Archive for the ‘Arduino’ Category

Arduino: Getting Started

Posted: February 14, 2013 by lucmehl in Arduino

Download software for your personal computer.

Getting Started with Arduino (Banzi, pdf)

DIGITAL INPUT, DIGITAL OUTPUT

Digital input/output means ‘0 or 1,’ like on or off.

Do the exercises in lesson two: An online tutorial. Be sure to include a resistor in each LED circuit.

Figure out how to connect two LEDs. You can refer to lesson three in the link above.

Edit your sketch so that the a LED will stay on, and figure out how to add a push botton on/off switch.

Use a throw switch to toggle between two LEDs. If available, replace the throw switch with a potentiometer.

ANALOG INPUT, DIGITAL OUTPUT

Analog input can vary between 0 and 1023. The value depends on the input source: heat, light, sound, motion, etc. Analog output can have a value of 0 to 255.

Attach an analog sensor to an LED and modify the ‘Blink’ sketch so that the blink rate will be determined by the analog sensor. Refer to pg. 65 in the “Getting Started” text linked above.

MONITORING ANALOG INPUT

Your next task is to use the serial monitor application of the IDE to visualize the analog input.

void setup()
{
//the rest of your setup code here
Serial.begin(9600); //this sets up communication to the serial monitor
}

void loop()
{
//calculation code here

val = analogRead(0); //the analog sensor is wired to analog port ‘0’
Serial.print(“Value: “);
Serial.println(val);
}