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

Is AI Demonic? The Truth Behind Artificial Intelligence

Is AI Demonic? The Truth Behind Artificial Intelligence In recent years, artificial intelligence (AI) has surged into public consciousness , transforming industries and daily life. Yet, alongside excitement, a growing number of voices question the nature of AI itself—some wondering if AI is demonic or linked to supernatural forces. This article aims to explore and clarify the truth behind these fears, grounded in facts, technology, and ethical understanding. Unpacking the Myth: Why Some See AI as Demonic The notion that AI could be demonic often arises from a mix of technological misunderstanding and cultural or spiritual concerns. AI systems, such as large language models or image generation tools , can seem eerily intelligent, producing outputs that feel uncanny or beyond human comprehension. These qualities may evoke fear that AI possesses some otherworldly spirit or malevolence. Some perspectives draw connections between AI and spiritual beliefs about demons or fallen angels, ...

2023 2024 Official Textbook List for General Secondary Education in Cameroon

 2023-2024 Official Textbook List for Secondary Schools in Cameroon OFFICIAL TEXTBOOK LIST 2023/2024 Academic Year General Secondary Education: First and Second Cycles NB: Only textbooks on the official list bearing the seal of State as signed by the minister of secondary education are required of students in all public and private schools throughout the national territory FORM 1  ENGLISH LANGUAGE Title: Mastering English      Price: 3400 LITERATURE IN ENGLISH Tales From the Grassland and the Forest (Prose)   price: 2000 A questionable Culture (Drama)   Price: 1000 Authentic Poetry (Book 1)    Price: 2000 FRENCH LANGUAGE Title: Le Reseau du Français   Price: 3200 HISTORY Title: Essential History for Junior Secondary Schools    Price: 2000 GEOGRAPHY Title: Geography for Competency Development: A functional Approach to Geography Study    Price: 4000 CITIZENSHIP Title: Brighter ...