Friday, March 20, 2015

ARDUINO SYNTAX, INSTRUCTIONS AND CONSTANTS AT A GLANCE(UPDATE)

INSTRUCTIONS:

The instructions are case sensitive in case of compiler (Arduino 1.6.0) so use of upper case or lower case should be done properly.

 1.pinMode(pinname/pin no,direction);
this inst is used to specify the direction of the data flow
ex-1: pinMode(12,output);
This is used to declare pin no 12 as output.
ex-2: pinMode(13,input);
This is used to declare pin no 13 as input.

 2. digitalWrite(pinname/pin no,value/state); 
This instruction is used to write value to digital pins i.e (1~14 pins)
ex-1: digitalWrite(12,HIGH);
EX-2: int pinning=12
       digitalWrite(pinning,HIGH);
Both produce same output

 3. digitalRead(pinname/pin no,value/state);
This inst is used to read value from the digital pin.
ex-1: digitalRead(12);
ex-2:digitalRead(pinning);

4. analogRead(pinname/pin no,value/state);
This inst is used to read analog values from the analog pin.Its resolution is 1024 bits.
ex-1: analogRead(12);
ex-2: analogRead(pinner);

5. analogWrite(pinname/pin no,value/state);
This inst is used to write analog values to analog pin.Its resolution is 256 bits.

CONSTANTS:

1. HIGH: digital one
2. LOW: digital zero
3. INPUT: inward flow of data used at the time of pinMode.
4.OUTPUT:outward flow of data used at the time of pinMode. 

No comments:

Post a Comment