Variable
//data_type variable_name = value
int val = 10;
___________________________
pinMode()
pinMode(pin,mode);
pin:Arduino pin
mode:INPUT/OUTPUT
pinMode(13,OUTPUT);
________________________
digitalWrite()
Write a HIGH or a LOW to a digital pin.
digitalWrite(pin,value);
pin:Arduino pin
value:HIGH/LOW
digitalWrite(13,HIGH);
__________________________
delay()
delay(ms);
delay(1000);
_________________________
NUMERIC DATA TYPES IN ARDUINO PROGRAMMING
byte
A byte stores an 8-bit unsigned number, from 0 to 255 (maximum value
of (2^8) - 1).
Syntax
byte var = value;
var: variable name
value: the value to assign to that variable
Ex: byte var = 155;
word
A word can store an unsigned number of at least 16 bits from 0 to
65535 (maximum value of (2^16) - 1).
Syntax
word var = value;
var: variable name
value: the value to assign to that variable
Ex: word var = 2568;
short
A short is a 16-bit data-type.
A short stores a 16-bit (2-byte) value. This yields a range of -32,768 to 32,767
minimum value of -2^15 and a maximum value of (2^15) - 1).
Syntax
short var = value;
var: variable name
value: the value to assign to that variable
Ex: short var = -1552;
int
An int stores a 16-bit (2-byte) value. This yields a range of -32,768 to
32,767 (minimum value of -2M5 and a maximum value of (2M5) - 1).
Syntax
int var = value;
var: variable name
value: the value to assign to that variable
Ex: int var = -282;
long
Long variables are extended size variables for number storage, and store 32
bits (4 bytes), from -2,147,483,648 to 2,147,483,647 (minimum value of -2^31
and a maximum value of (2^31) - 1).
Syntax
long var = value;
var: variable name
value: the value to assign to that variable
Ex: long var = -25682;
TEXT DATA TYPES IN ARDUINO PROGRAMMING