SlideShare a Scribd company logo
Arduino based remote control
Its very simple method to
control outputs by using
remote control
Prepared by:
Ashokkumar Sekar
BE-EEE
Requirements
• Arduino controller (atmeg328)
• Tesop1738
• Led
• Resister
• Remote
Circuit diagram
10,11,12
13,14,15
16,17,18
19,20
• There is Tsop output pin is connected to 9th
pin of the micro controller, and led +ve pin is
connected to 3rd pin of the micro controller
• Tsop 5v supply and gnd , and also led gnd are
connected to micro controller supply pins
• After connection to upload program the
program code given below slides
Project explanation
• This projects tells about how to control load
by using IR remote controller
• There is I preparing , when I press number “1”
button led will glow after when press “1” led
will off
Power Jack
Voltage
regulator
Power Selection
Jumper
USB
FTDI USB
chip
Tx Rx leds Digital pins
Analog pinsPower pins
Microcontro
ller
ICSP
Headers
Reset
Power LED
Installing Software
Understanding software
Verify
Upload New
Open
Save Serial
Monitor
Detecting your Microcontroller
SELECTING BOARD AND COM PORT
• TOOLS > BOARDS > ARDUINO DEUMILANOVE
W/ATMEGA328
• TOOLS > SERIAL PORT > PORT NUMBER
STRUCTURE OF PROGRAM
Any program should compulsorily have these
two functions
– void setup()
{…….
}
– void loop()
{……
}
NOTE:
The common header files such as stdio.h
etc., are included in default.
Step1: Declaring Variables
Integer type variable
int ledPin = 3;
This should be declared at the very beginning of
the program (Even before void setup() and void
loop()).
Step2: Setting I/O pins
• You should set the i/o pins as either input or
output using the following function
pinMode(pin number, INPUT/OUTPUT);
• You should declare it inside void setup()
Step3: Writing an Output
To write a value to a pin:
digitalWrite(pin number, HIGH/LOW);
This and all the other functions should be
written inside void loop()
Step4: Delay function
• To specify a certain period of time for a set of
functions to be executed:
delay(value);
Eg: delay(1000);
It is very important to include this function
whenever you want to see an output, as the
microcontroller works in micro-seconds speed
Time In milliseconds
Getting input
Step 1: Declare a variable
int buttonValue;
Step 2: inside void setup(), initialize pin as input
pinMode(A4,INPUT);
Step 3: inside void loop(), read and store the value.
buttonValue = digitalRead(A4);
if-else loop
if(buttonValue == HIGH)
{
digitalWrite(ledPin,HIGH);
}
else
{
digitalWrite(ledPin,LOW);
}
Since you are checking
a condition, you have to
use 2 equal-to.
Program Code
#include <SPIRremote.h>
SPIRrecv remote(9);
int ledpin = 3;
int irValue;
int i = 0;
void setup()
{
remote.enableIR();
pinMode(ledpin, OUTPUT);
}
void loop()
{
int irValue = remote.getIRValue();
switch (irValue)
{
case 1:
if(digitalRead(ledpin) == HIGH)
{
digitalWrite(ledpin,LOW);
}
else
{
digitalWrite(ledpin,HIGH);
}
break;
}
}
Project
I attached my video here

More Related Content

What's hot

Visitor counter
Visitor counterVisitor counter
Visitor counter
Triveni Mishra
 
Boolean Algebra- Digital Logic gates
Boolean Algebra- Digital Logic gatesBoolean Algebra- Digital Logic gates
Boolean Algebra- Digital Logic gates
NTBsnull
 
Key board interfacing with 8051
Key board interfacing with 8051Key board interfacing with 8051
Key board interfacing with 8051
DominicHendry
 
Password based door locksystem
Password  based door locksystemPassword  based door locksystem
Password based door locksystem
UVSofts Technologies
 
Password based door locksystem
Password  based door locksystemPassword  based door locksystem
Password based door locksystem
UVSofts Technologies
 
Electronic code lock device
Electronic code lock deviceElectronic code lock device
Electronic code lock deviceAmitoj Kaur
 
8 bit digital code lock intercom system
8 bit digital code lock intercom system8 bit digital code lock intercom system
8 bit digital code lock intercom system
Sagnik Jana
 
I 9300
I 9300I 9300
I 9300
Adit Group
 
encoder
encoder encoder
encoder
AshikUlMoula
 
Digital clock
Digital clockDigital clock
Digital clock
Abi Malik
 
Arduino bt mobile robot r2.0
Arduino bt mobile robot r2.0Arduino bt mobile robot r2.0
Arduino bt mobile robot r2.0
Fajar Baskoro
 
Password based wireless door opener security system
Password based wireless door opener security systemPassword based wireless door opener security system
Password based wireless door opener security system
pragyajain53
 
8051 training an interactive tutorial
8051 training an interactive tutorial8051 training an interactive tutorial
8051 training an interactive tutorial
Futura infotech
 
Manikandan circuit
Manikandan circuitManikandan circuit
Manikandan circuit
nmanikandan
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051Rashmi
 
PLC input and output devices
PLC input and output devices PLC input and output devices
PLC input and output devices
Ameen San
 
Keypad Interfacing with 8051 Microcontroller
Keypad Interfacing with 8051 MicrocontrollerKeypad Interfacing with 8051 Microcontroller
Keypad Interfacing with 8051 Microcontroller
Sudhanshu Janwadkar
 
8051 i/o port circuit
8051 i/o port circuit8051 i/o port circuit
8051 i/o port circuit
dharmendrawaghjipur007
 

What's hot (19)

Visitor counter
Visitor counterVisitor counter
Visitor counter
 
Boolean Algebra- Digital Logic gates
Boolean Algebra- Digital Logic gatesBoolean Algebra- Digital Logic gates
Boolean Algebra- Digital Logic gates
 
Magnetic door lock
Magnetic door lockMagnetic door lock
Magnetic door lock
 
Key board interfacing with 8051
Key board interfacing with 8051Key board interfacing with 8051
Key board interfacing with 8051
 
Password based door locksystem
Password  based door locksystemPassword  based door locksystem
Password based door locksystem
 
Password based door locksystem
Password  based door locksystemPassword  based door locksystem
Password based door locksystem
 
Electronic code lock device
Electronic code lock deviceElectronic code lock device
Electronic code lock device
 
8 bit digital code lock intercom system
8 bit digital code lock intercom system8 bit digital code lock intercom system
8 bit digital code lock intercom system
 
I 9300
I 9300I 9300
I 9300
 
encoder
encoder encoder
encoder
 
Digital clock
Digital clockDigital clock
Digital clock
 
Arduino bt mobile robot r2.0
Arduino bt mobile robot r2.0Arduino bt mobile robot r2.0
Arduino bt mobile robot r2.0
 
Password based wireless door opener security system
Password based wireless door opener security systemPassword based wireless door opener security system
Password based wireless door opener security system
 
8051 training an interactive tutorial
8051 training an interactive tutorial8051 training an interactive tutorial
8051 training an interactive tutorial
 
Manikandan circuit
Manikandan circuitManikandan circuit
Manikandan circuit
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
PLC input and output devices
PLC input and output devices PLC input and output devices
PLC input and output devices
 
Keypad Interfacing with 8051 Microcontroller
Keypad Interfacing with 8051 MicrocontrollerKeypad Interfacing with 8051 Microcontroller
Keypad Interfacing with 8051 Microcontroller
 
8051 i/o port circuit
8051 i/o port circuit8051 i/o port circuit
8051 i/o port circuit
 

Viewers also liked

Josi
JosiJosi
Josi
MJML23
 
THE GOOD THE BAD AND THE UGLY
THE GOOD THE BAD AND THE UGLYTHE GOOD THE BAD AND THE UGLY
THE GOOD THE BAD AND THE UGLYLeon Jennings
 
Fisica
FisicaFisica
Fisica
MJML23
 
Física
FísicaFísica
Física
MJML23
 
La inteligencia
La inteligenciaLa inteligencia
La inteligencia
wiamemb
 
Ser o no ser empático
Ser o no ser empáticoSer o no ser empático
Ser o no ser empático
wiamemb
 
¿EXPLOTARÁ EL SOL CUANDO MUERA?
¿EXPLOTARÁ EL SOL CUANDO MUERA?¿EXPLOTARÁ EL SOL CUANDO MUERA?
¿EXPLOTARÁ EL SOL CUANDO MUERA?
MJML23
 
Física en el mundo
Física en el mundoFísica en el mundo
Física en el mundo
MJML23
 
La evaporación
La evaporaciónLa evaporación
La evaporación
MJML23
 
Física
FísicaFísica
Física
MJML23
 

Viewers also liked (10)

Josi
JosiJosi
Josi
 
THE GOOD THE BAD AND THE UGLY
THE GOOD THE BAD AND THE UGLYTHE GOOD THE BAD AND THE UGLY
THE GOOD THE BAD AND THE UGLY
 
Fisica
FisicaFisica
Fisica
 
Física
FísicaFísica
Física
 
La inteligencia
La inteligenciaLa inteligencia
La inteligencia
 
Ser o no ser empático
Ser o no ser empáticoSer o no ser empático
Ser o no ser empático
 
¿EXPLOTARÁ EL SOL CUANDO MUERA?
¿EXPLOTARÁ EL SOL CUANDO MUERA?¿EXPLOTARÁ EL SOL CUANDO MUERA?
¿EXPLOTARÁ EL SOL CUANDO MUERA?
 
Física en el mundo
Física en el mundoFísica en el mundo
Física en el mundo
 
La evaporación
La evaporaciónLa evaporación
La evaporación
 
Física
FísicaFísica
Física
 

Similar to Remote ashok

arduino.ppt
arduino.pptarduino.ppt
arduino.ppt
sunilkumar652338
 
Module-3.pptx
Module-3.pptxModule-3.pptx
Module-3.pptx
minaljoshi19
 
arduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfarduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdf
ssusere5db05
 
Arduino course
Arduino courseArduino course
Arduino course
Ahmed Shelbaya
 
teststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptxteststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptx
ethannguyen1618
 
Itsp documentation quadcopter flight controller based on kalman filters
Itsp documentation   quadcopter flight controller based on kalman filtersItsp documentation   quadcopter flight controller based on kalman filters
Itsp documentation quadcopter flight controller based on kalman filters
Jyotirmaya Mahanta
 
Presentation
PresentationPresentation
Presentation
Abhijit Das
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
Kishor Mhaske
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
ZainIslam20
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
AkhandPratapSingh86
 
Arduino programming
Arduino programmingArduino programming
Arduino programming
MdAshrafulAlam47
 
Introduction to Microcontrollers
Introduction to MicrocontrollersIntroduction to Microcontrollers
Introduction to Microcontrollers
Venkata Sai Vamsi Penupothu
 
Arduino intro.pptx
Arduino intro.pptxArduino intro.pptx
Arduino intro.pptx
SanthanaMari11
 
20IT204-COA- Lecture 17.pptx
20IT204-COA- Lecture 17.pptx20IT204-COA- Lecture 17.pptx
20IT204-COA- Lecture 17.pptx
PerumalPitchandi
 
PLCpptFeb222017.ppt
PLCpptFeb222017.pptPLCpptFeb222017.ppt
PLCpptFeb222017.ppt
MohammadImran65702
 
arduinoedit.pptx
arduinoedit.pptxarduinoedit.pptx
arduinoedit.pptx
rajalakshmi769433
 

Similar to Remote ashok (20)

arduino.ppt
arduino.pptarduino.ppt
arduino.ppt
 
Module-3.pptx
Module-3.pptxModule-3.pptx
Module-3.pptx
 
arduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfarduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdf
 
Arduino course
Arduino courseArduino course
Arduino course
 
Final Presentation
Final PresentationFinal Presentation
Final Presentation
 
teststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptxteststststststLecture_3_2022_Arduino.pptx
teststststststLecture_3_2022_Arduino.pptx
 
Itsp documentation quadcopter flight controller based on kalman filters
Itsp documentation   quadcopter flight controller based on kalman filtersItsp documentation   quadcopter flight controller based on kalman filters
Itsp documentation quadcopter flight controller based on kalman filters
 
Presentation
PresentationPresentation
Presentation
 
Lab2ppt
Lab2pptLab2ppt
Lab2ppt
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
 
Arduino programming
Arduino programmingArduino programming
Arduino programming
 
Introduction to Microcontrollers
Introduction to MicrocontrollersIntroduction to Microcontrollers
Introduction to Microcontrollers
 
Arduino Programming Basic
Arduino Programming BasicArduino Programming Basic
Arduino Programming Basic
 
Arduino intro.pptx
Arduino intro.pptxArduino intro.pptx
Arduino intro.pptx
 
20IT204-COA- Lecture 17.pptx
20IT204-COA- Lecture 17.pptx20IT204-COA- Lecture 17.pptx
20IT204-COA- Lecture 17.pptx
 
publish manual
publish manualpublish manual
publish manual
 
PLCpptFeb222017.ppt
PLCpptFeb222017.pptPLCpptFeb222017.ppt
PLCpptFeb222017.ppt
 
arduinoedit.pptx
arduinoedit.pptxarduinoedit.pptx
arduinoedit.pptx
 

Recently uploaded

Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
Kamal Acharya
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
Kamal Acharya
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
ssuser9bd3ba
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
PrashantGoswami42
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
Kamal Acharya
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 

Recently uploaded (20)

Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
Event Management System Vb Net Project Report.pdf
Event Management System Vb Net  Project Report.pdfEvent Management System Vb Net  Project Report.pdf
Event Management System Vb Net Project Report.pdf
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 

Remote ashok

  • 1. Arduino based remote control Its very simple method to control outputs by using remote control Prepared by: Ashokkumar Sekar BE-EEE
  • 2. Requirements • Arduino controller (atmeg328) • Tesop1738 • Led • Resister • Remote
  • 4. • There is Tsop output pin is connected to 9th pin of the micro controller, and led +ve pin is connected to 3rd pin of the micro controller • Tsop 5v supply and gnd , and also led gnd are connected to micro controller supply pins • After connection to upload program the program code given below slides
  • 5. Project explanation • This projects tells about how to control load by using IR remote controller • There is I preparing , when I press number “1” button led will glow after when press “1” led will off
  • 6. Power Jack Voltage regulator Power Selection Jumper USB FTDI USB chip Tx Rx leds Digital pins Analog pinsPower pins Microcontro ller ICSP Headers Reset Power LED
  • 10. SELECTING BOARD AND COM PORT • TOOLS > BOARDS > ARDUINO DEUMILANOVE W/ATMEGA328 • TOOLS > SERIAL PORT > PORT NUMBER
  • 11. STRUCTURE OF PROGRAM Any program should compulsorily have these two functions – void setup() {……. } – void loop() {…… } NOTE: The common header files such as stdio.h etc., are included in default.
  • 12. Step1: Declaring Variables Integer type variable int ledPin = 3; This should be declared at the very beginning of the program (Even before void setup() and void loop()).
  • 13. Step2: Setting I/O pins • You should set the i/o pins as either input or output using the following function pinMode(pin number, INPUT/OUTPUT); • You should declare it inside void setup()
  • 14. Step3: Writing an Output To write a value to a pin: digitalWrite(pin number, HIGH/LOW); This and all the other functions should be written inside void loop()
  • 15. Step4: Delay function • To specify a certain period of time for a set of functions to be executed: delay(value); Eg: delay(1000); It is very important to include this function whenever you want to see an output, as the microcontroller works in micro-seconds speed Time In milliseconds
  • 16. Getting input Step 1: Declare a variable int buttonValue; Step 2: inside void setup(), initialize pin as input pinMode(A4,INPUT); Step 3: inside void loop(), read and store the value. buttonValue = digitalRead(A4);
  • 17. if-else loop if(buttonValue == HIGH) { digitalWrite(ledPin,HIGH); } else { digitalWrite(ledPin,LOW); } Since you are checking a condition, you have to use 2 equal-to.
  • 18. Program Code #include <SPIRremote.h> SPIRrecv remote(9); int ledpin = 3; int irValue; int i = 0; void setup() { remote.enableIR(); pinMode(ledpin, OUTPUT); } void loop() { int irValue = remote.getIRValue(); switch (irValue) { case 1: if(digitalRead(ledpin) == HIGH) { digitalWrite(ledpin,LOW); } else { digitalWrite(ledpin,HIGH); } break; } }
  • 19.
  • 21. I attached my video here