ARDUINO COMMANDS
Basic Arduino IDE Commands
1. pinMode(x, OUTPUT);
Configure or assign the pin number x as an output pin. Where x is the digital pin number on the arduino device which you intend to use as an output.
2. pinMode(x, INPUT);
Configure or assign the pin number x as an input pin. Where x is the digital pin number on the arduino device which you intend to use as an input.
3. digitalWrite(x, HIGH);
Turn the digital pin number x ON or as HIGH. Where x is the digital pin number on the arduino device which you intend to turn ON. Note that turning it HIGH gives out a voltage of 5V at that digital pin. So this can be used to turn on or drive some devices connected at the pin e.g LED, activating relays for driving circuit, etc.
4. digitalWrite(x, LOW);
Turn the digital pin number x OFF or as LOW. Where x is the digital pin number on the arduino device which you intend to turn OFF. Note that turning it LOW gives out a voltage of 0V at that digital pin. So this can be used to turn OFF or drive some devices connected at the pin at low logic e.g LED, activating relays for driving circuit etc.
5. digitalRead(x);
Read the digital pin. Where x is the digital pin number
6. analogRead(analog pin);
Read the analog pin. Analog pin as A0 or A1 or A2, or A3 etc.
7. analogReference();
LCD Commands for Arduino
1. lcd.begin(16, 2);
Initialize the 16 x 2
lcd.begin(20, 4);
Initialize the 20 x 4 LCD
2. lcd.setCursor(x, y);
Set the cursor of LCD at a desired column and row. Where x is the column number and y is the row number on the LCD.
3. lcd.print(“EKETECH”);
Print a string “EKETECH” on the LCD
4. lcd.print(EKETECH);
printing the integer attributed in EKETECH on the LCD. So whatever integer is attributed or “stored” in EKETECH will be printed on the LCD. So in your code, EKETECH must be declared as a variable e.g as an integer, otherwise you will obtain a compilation error while running the code.
5. lcd.Clear();
Clear all the contents displayed on the LCD
Serial Communication Commands for Arduino
1. Serial.begin(baudrate);
Initialize serial communication. Set baud rate to 600 or 1200 or 2400 or 4800 or 9600 bits per second
2. Serial.print(“EKETECH”);
Serial print fixed string with a defined baud rate on the Tx line. Note Tx pin signifies transmission pin.
3. Serial.println(“EKETECH”);
Serial print fixed string EKETECH with a defined baud rate and enter command on the Tx line. Note that the ln included infront of print, gives an enter command or new line to any new or subsequents data transmitted.
4. Serial.print(EKETECH);
Serial print the integer string with a defined baud rate on the Tx line. So tyhis will print the interger attributed to EKETECH and not printing the string “EKETECH”
5. Serial.println(EKETECH);
Serial print the integer string with a defined baud rate and then the enter command on the Tx line, which enables printing on a new line
6. Serial.Write(BYTE);
Serial transfer the 1 byte on the Tx line
7. Serial.read();
Read 1 byte serial from the Rx line
Interrupts
Enable interrupts. Interrupts will cause the processor to urgently stop any other task and an immediately process another task while pending the one it was executing. So, interrupts can disrupt the timing of a code.
2. noInterrupts( )
Disable interrupts. Also, Some functions will not work with disabled interrupts. For example, incoming data communication can be ignored.
Data Types
char, array, float, bool, boolean, short, byte, long, int, double,
unsigned char, String(), string, void, unsigned int, size_t, word, unsigned long
Arduino Boolean
and the Arithmetic Operators
Next to sketch
and control, you must know some Boolean and arithmetic operators to command the
programs.
The operands: is
equal to (=), addition (+), subtraction (-), multiplication (*) and division
(/).
Advanced
operands: is not equal to (!=), less than or equal to (<=), greater than or
equal to (>=), remainder (%).
Time
delay( )
delayMicroseconds(
)
micros( )
millis( )
Boolean Operators
! (logical
not)
&&
(logical and)
|| (logical
or)
Compound Operators
%= (compound
remainder)
&=
(compound bitwise and)
*= (compound
multiplication)
++
(increment)
+= (compound
addition)
--
(decrement)
-= (compound
subtraction)
/= (compound
division)
^= (compound
bitwise xor)
|= (compound
bitwise or)
Bitwise Operators
&
(bitwise and)
<<
(bitshift left)
>>
(bitshift right)
^ (bitwise
xor)
| (bitwise
or)
~ (bitwise
not)
Control Structure
break
continue
do...while
else
for
goto
if
return
switch...case
while