Professional Documents
Culture Documents
Robotics
Robotics
AND RESISTOR
Variables
Example: Z=X+Y
This is an example of programming expression. x, y and z
are variables. Variables can represent numeric values,
characters, character strings, or memory addresses.
Declaration
Data Type Variable Name(Identifier) = Value;
int LED = 2;
/* int means integer, LED is a variable that will be used to
represent the device connected on the microcontroller and
assigning 2 as the value for pin 2*/
void setup( ) {
// put your setup code here, to run once:
pinMode(LED, OUTPUT);
/* pinMode is a function that prepares ALL the pins used in
the microcontroller. Variable LED is the same as 2 thus, pin 2
will be used as an OUTPUT device */
void loop( ) {
digitalWrite(LED, HIGH);
/* digitalWrite ( ) is the function in controlling digital device,