Difference between revisions of "Inputs and Outputs"

From robotics
(Inputs)
(Inputs)
Line 14: Line 14:
  
 
• [http://arduino.cc/en/Reference/Interrupts Interrupts]
 
• [http://arduino.cc/en/Reference/Interrupts Interrupts]
 +
 +
=== Analog ===
 +
 +
[http://arduino.cc/en/Reference/AnalogRead Analog Inputs] Vary from The voltage source to ground. With most Arduino boards they output a value between 0-1023 linearly proportional to the voltage. Example on a 5V Arduino 0V=0, 2.5v=511, 5V=1023.
 +
 +
int sensorValue = analogRead(pin #);
 +
 +
This line of code would initialize a variable type int with the name sensorValue and make it equal to the analog signal on the pin
 +
 +
 +
=== Digital Input ===
 +
 +
=== Interrupts ===

Revision as of 15:44, 7 July 2014

Inputs and Outputs (IO)

All programs work on an Input / Output basis, whether it is a PC based program taking in a joystick and outputting the commands to a game character or a microcontroller that flashes an LED when a button is pressed. Arduinos support a number of inputs and outputs.

Inputs

Inputs are essential and vary greatly.

There are several different ways to get an Input with an Arduino.

Analog Input

Digital Input

Interrupts

Analog

Analog Inputs Vary from The voltage source to ground. With most Arduino boards they output a value between 0-1023 linearly proportional to the voltage. Example on a 5V Arduino 0V=0, 2.5v=511, 5V=1023.

int sensorValue = analogRead(pin #); 

This line of code would initialize a variable type int with the name sensorValue and make it equal to the analog signal on the pin


Digital Input

Interrupts