Skip to main content

social

pop

Arduino Commands Syntax

 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();

Configures or sets a reference voltage used for analog input 


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

1. 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





Popular posts from this blog

How to Install Proteus 8 Professional: A Step-by-Step Guide

 How to Install Proteus 8 Professional: A Step-by-Step Guide Proteus 8 Professional is a powerful tool for electronic circuit design and simulation. Whether you’re a student, hobbyist, or professional engineer, following a clear installation process ensures you get started without headaches. Are you ready to start designing and simulating electronic circuits with Proteus 8 Professional!   Here’s a comprehensive, guide to installing Proteus 8 Professional on your Windows PC. Step 1: Download the Installer ·        Visit the official Labcenter Electronics website or another trusted source to download the Proteus 8 Professional installer. Avoid unofficial sources to prevent malware or corrupted files . You can download from HERE DOWNLOAD PROTEUS AND ARDUINO ·        The installer typically comes as a ZIP file. Wait for the download to finish and locate it in your Downloads folder Step 2: Extract the Installer...

Intermediate switch connection and wiring diagram

Intermediate switch An intermediate switch is a switch which permits the control of a lighting point from three positions. In order to control this lighting point from the three positions, the intermediate switch is connected together with two other 2-way switches. Application: it can be used in lighting a room or hall having 3 entrances , it can also be used in long corridors and staircases. We shall be looking at these connections. Connection diagram of intermediate switching Below is an illustration of the connection. The brown lines indicated on the diagram are the switching contacts. The switch labelled 2 is an intermediate switch . The figure below is the configuration of an intermediate switch. The switch labelled 1 and 3 in the first diagram are two-way switches.  Click here to know more about two-way switches . ON and OFF positions of intermediate switching ON positions OFF positions Staircase wiring layout using an inte...

GCE QUESTIONS AND SOLUTIONS FOR ELECTRICAL POWER SYSTEMS

 DOWNLOAD GCE PAST QUESTIONS AND SOLUTIONS FOR EPS POWER ELECTRONICS  Download 1     Download 1b Download 2     Download 2b      Download 2C Download 3 AUTOMATIC CONTROL OF ELECTRICAL MACHINES Download 1 Download 2 Download 3      Download 3b Download 4      Download 4b    2020 DESIGN OF ELECTRICAL INSTALLATION Download 1 Download 2 Download 3      Download 3b      Download 3C      Download 3D CIRCUIT ANALYSIS Download 1 Download 2 Download 3 Download 4 ENGINEERING SCIENCE Download 1 2019 Download 2 2023 paper 1 Download 3   MOCK      Download 3B  Download 4         Download 5          Download 6 Download 7   ITV ELECTRICAL AND ELECTRONIC CIRCUIT  Download 1 ELECTRICAL DIAGRAM Download 1   CAP ELECTRICAL TECHNOLOGY AND DIAGRAM Download 1 Download 2   ITV...