SlideShare a Scribd company logo
Programming
of
Arduino
 Arduino programs can be divided in three
main parts:
 STRUCTURE
 VALUES -VARIABLES
-CONSTANTS
 FUNCTIONS
STRUCTURE
 The basic structure of the arduino programming language is fairly
simple and runs in atleast two parts.
 These two required parts,or functions, enclose blocks of statement.
Setup()
Setup() function is called when a sketch starts
Use to initialize variables , pin modes , start using
libraries etc…
It will only run once,after each powerup or reset.
So generally it is used to prepare your ardruino serial
communication and pinmode().
It must be included in program even if no lines are there.
Example
int buttonPin = 3;
void setup()
{
Serial.begin(9600);
pinMode(buttonPin, INPUT);
}
void loop()
{
// ...
}
Loop()
After calling the setup() function, the loop() function does
precisely what its name suggests, loops consecutively
 i.e it allows us to execute a statement or group of
statements multiple times.
Allows program to change, respond and control the Arduino
board.
Example
void loop()
{
digitalWrite( pin ,HIGH ); //turns ‘pin’ on
delay(1000); //pause for one second
digitalWrite( pin ,LOW ); //turns ‘pin’ off
delay(1000); //pause for one second
}
Variables
 A variable is a way of naming and storing a numerical value for later use.
 It can be continuously changed as opposed to constants whose value never changes.
 Data types says the size of variable.
 Eg: int a,b;
 The above statement declares a variable ‘a’ whose size can be of 16 bits.
 Initializations can be done while declaring or in further part of program.
 Eg: a=20; b=10 //initializing variable
a=b; //changing variable value
 You can use same variable name in same program but it depends
on scope of variable.
Functions
 A function is a block of code that has a name and a block of statements
that are executed when the function is called.
 Custom functions can be written to perform repetitive tasks and to
reduce clutter in program.
 Functions are declared by first declaring the function type.
 Function type tells the type of value to be written by the function.
 Eg: int a() //for integer type to be returned
 If no values is to be returned the function type would be void.
 After name of function name we pass can parameters of function in
parenthesis.
Example
int delayVal()
{
int v; //create temporary variable ‘v’
v = analogRead(pot); //read potentiometer value
v /= 4; //converts 0-1024 to 0-255
return v; //return final value
}
Basic Functions Of Arduino
Digital I/O
pinMode()
digitalWrite()
digitalRead()
Analog I/O
analogReference()
analogRead()
analogWrite() - PWM
Time
millis()
micros()
delay()
delayMicroseconds()
LED BLINK
Description:
In this lesson we will,
1. Build and wire a device with one LED, resistor, and
Arduino board.
2. Program the device to “Blink the Light”
3. Identify the flow of electricity / signal in this computing unit.
4. Use the Blockly Programming system to control speed of
Blink.
 You will need:
 1. LED Light Bulb (Any Colour)
 2. 330 Ohm Resistor
 3. Red Wire
 4. White Wire
 5. Black (Or dark colored Wire)
Process:
1. Run a red Wire from the 5V Pin to the Red Rail on the
Breadboard. This will connect the current side of the
circuit.
 2. Run a black (or dark coloured wire) from the Gnd Pin of
the Arduino to the Blue Rail on the far side of the
Breadboard.
Programming with arduino
 3. Plug an LED bulb into the circuit. Note that the longer pin will face the
Arduino Board and the pins should cross the “gap” in the breadboard.
 4. This step is VERY IMPORTANT!!! Plug a 330 OHM resistor from Port B5
to Ground (The blue rail).
 An LED bulb must ALWAYS have a Resistor in the circuit. If we do not use a
Resistor, we will burn out the bulb or the Arduino
5. Now we will run the signal wire. Wire Pin 13 on the
Arduino to the Breadboard. This will carry the current from
the Arduino Pin to the LED and allow the Arduino to switch
on and off the LED.
Sketch Programming:
1. Start your Arduino Sketch Program by clicking on
the Sketch Icon.
2. Save the code by selecting “File-Save” and
naming the program “lastnameBlink”.
Programming with arduino

More Related Content

What's hot (20)

Wi-Fi Esp8266 nodemcu
Wi-Fi Esp8266 nodemcu Wi-Fi Esp8266 nodemcu
Wi-Fi Esp8266 nodemcu
creatjet3d labs
 
Introduction to Arduino Programming
Introduction to Arduino ProgrammingIntroduction to Arduino Programming
Introduction to Arduino Programming
James Lewis
 
Nodemcu - introduction
Nodemcu - introductionNodemcu - introduction
Nodemcu - introduction
Michal Sedlak
 
Aurdino presentation
Aurdino presentationAurdino presentation
Aurdino presentation
C.Vamsi Krishna
 
What is Arduino ?
What is Arduino ?What is Arduino ?
What is Arduino ?
Niket Chandrawanshi
 
Winter traning arduino report final
Winter traning arduino report finalWinter traning arduino report final
Winter traning arduino report final
Govind Jha
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
yeokm1
 
Raspberry Pi (Introduction)
Raspberry Pi (Introduction)Raspberry Pi (Introduction)
Raspberry Pi (Introduction)
Mandeesh Singh
 
Home automation using bluetooth - Aurdino BASED
Home automation using bluetooth - Aurdino BASEDHome automation using bluetooth - Aurdino BASED
Home automation using bluetooth - Aurdino BASED
Ashish Kumar Thakur
 
Arduino programming part1
Arduino programming part1Arduino programming part1
Arduino programming part1
Amarjeetsingh Thakur
 
Introduction to Arduino.pptx
Introduction to Arduino.pptxIntroduction to Arduino.pptx
Introduction to Arduino.pptx
Akshat Bijronia
 
Arduino Workshop
Arduino WorkshopArduino Workshop
Arduino Workshop
atuline
 
OTP REVIEW (1).pptx
OTP REVIEW (1).pptxOTP REVIEW (1).pptx
OTP REVIEW (1).pptx
RakeshAnna2
 
Home automation using blynk
Home automation using blynkHome automation using blynk
Home automation using blynk
VarshithAnnavarapu1
 
Smart Door locking system using arduino
Smart Door locking system using arduinoSmart Door locking system using arduino
Smart Door locking system using arduino
BhawnaSingh351973
 
Presentation on IoT Based Home Automation using android & NodeMCU
Presentation on IoT Based Home Automation using android & NodeMCUPresentation on IoT Based Home Automation using android & NodeMCU
Presentation on IoT Based Home Automation using android & NodeMCU
Souvik Kundu
 
Ppt on six month training on embedded system & IOT
Ppt on six month training on embedded system & IOTPpt on six month training on embedded system & IOT
Ppt on six month training on embedded system & IOT
preetigill309
 
Iot based smart helmet used in mining industry
Iot based smart helmet used in mining industryIot based smart helmet used in mining industry
Iot based smart helmet used in mining industry
arrss arf
 
Home automation using IoT literature review ppt
Home automation using IoT literature review pptHome automation using IoT literature review ppt
Home automation using IoT literature review ppt
Tanujkumar101
 
Automatic doorbell with object detection
Automatic doorbell with object detectionAutomatic doorbell with object detection
Automatic doorbell with object detection
Anurag Alaria
 
Introduction to Arduino Programming
Introduction to Arduino ProgrammingIntroduction to Arduino Programming
Introduction to Arduino Programming
James Lewis
 
Nodemcu - introduction
Nodemcu - introductionNodemcu - introduction
Nodemcu - introduction
Michal Sedlak
 
Winter traning arduino report final
Winter traning arduino report finalWinter traning arduino report final
Winter traning arduino report final
Govind Jha
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
yeokm1
 
Raspberry Pi (Introduction)
Raspberry Pi (Introduction)Raspberry Pi (Introduction)
Raspberry Pi (Introduction)
Mandeesh Singh
 
Home automation using bluetooth - Aurdino BASED
Home automation using bluetooth - Aurdino BASEDHome automation using bluetooth - Aurdino BASED
Home automation using bluetooth - Aurdino BASED
Ashish Kumar Thakur
 
Introduction to Arduino.pptx
Introduction to Arduino.pptxIntroduction to Arduino.pptx
Introduction to Arduino.pptx
Akshat Bijronia
 
Arduino Workshop
Arduino WorkshopArduino Workshop
Arduino Workshop
atuline
 
OTP REVIEW (1).pptx
OTP REVIEW (1).pptxOTP REVIEW (1).pptx
OTP REVIEW (1).pptx
RakeshAnna2
 
Smart Door locking system using arduino
Smart Door locking system using arduinoSmart Door locking system using arduino
Smart Door locking system using arduino
BhawnaSingh351973
 
Presentation on IoT Based Home Automation using android & NodeMCU
Presentation on IoT Based Home Automation using android & NodeMCUPresentation on IoT Based Home Automation using android & NodeMCU
Presentation on IoT Based Home Automation using android & NodeMCU
Souvik Kundu
 
Ppt on six month training on embedded system & IOT
Ppt on six month training on embedded system & IOTPpt on six month training on embedded system & IOT
Ppt on six month training on embedded system & IOT
preetigill309
 
Iot based smart helmet used in mining industry
Iot based smart helmet used in mining industryIot based smart helmet used in mining industry
Iot based smart helmet used in mining industry
arrss arf
 
Home automation using IoT literature review ppt
Home automation using IoT literature review pptHome automation using IoT literature review ppt
Home automation using IoT literature review ppt
Tanujkumar101
 
Automatic doorbell with object detection
Automatic doorbell with object detectionAutomatic doorbell with object detection
Automatic doorbell with object detection
Anurag Alaria
 

Viewers also liked (20)

Arduino Full Tutorial
Arduino Full TutorialArduino Full Tutorial
Arduino Full Tutorial
Akshay Sharma
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduino
Ahmed Sakr
 
Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009
Eoin Brazil
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
Richard Rixham
 
Arduino Development For Beginners
Arduino Development For BeginnersArduino Development For Beginners
Arduino Development For Beginners
FTS seminar
 
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Eoin Brazil
 
50 apps in 50 minutes
50 apps in 50 minutes50 apps in 50 minutes
50 apps in 50 minutes
Robert Schuetz
 
Aquaponics an urban friendly farming final
Aquaponics  an urban friendly farming finalAquaponics  an urban friendly farming final
Aquaponics an urban friendly farming final
Apparao Chodisetti
 
Intro to the Arduino Entrepreneurial System
Intro to the Arduino Entrepreneurial SystemIntro to the Arduino Entrepreneurial System
Intro to the Arduino Entrepreneurial System
todbotdotcom
 
IBC of Aquaponics
IBC of AquaponicsIBC of Aquaponics
IBC of Aquaponics
Arden Chan
 
Wireless Communication And Mobile Network - ZigBee
Wireless Communication And Mobile Network - ZigBeeWireless Communication And Mobile Network - ZigBee
Wireless Communication And Mobile Network - ZigBee
Xaver Y.R. Chen
 
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
Eoin Brazil
 
Future of Education Technology Conference Takeaways - 2016
Future of Education Technology Conference Takeaways - 2016Future of Education Technology Conference Takeaways - 2016
Future of Education Technology Conference Takeaways - 2016
Imagine Easy Solutions
 
Controlling an Arduino with Android
Controlling an Arduino with AndroidControlling an Arduino with Android
Controlling an Arduino with Android
A. Hernandez
 
Aquaponics Final Presentation
Aquaponics Final PresentationAquaponics Final Presentation
Aquaponics Final Presentation
thomasrey
 
Introduction to arduino!
Introduction to arduino!Introduction to arduino!
Introduction to arduino!
Makers of India
 
Aquaponics and Renewable Energy
Aquaponics and Renewable EnergyAquaponics and Renewable Energy
Aquaponics and Renewable Energy
Centre for Environment, Fisheries and Aquaculture Science (Cefas)
 
Starting a Commercial Aquaponics Farm - Bright Agrotech
Starting a Commercial Aquaponics Farm - Bright AgrotechStarting a Commercial Aquaponics Farm - Bright Agrotech
Starting a Commercial Aquaponics Farm - Bright Agrotech
Upstart University
 
Assembling a Vertical Aquaponics System
Assembling a Vertical Aquaponics SystemAssembling a Vertical Aquaponics System
Assembling a Vertical Aquaponics System
Upstart University
 
Manual basico de practicas con Arduino uno
Manual basico de practicas con Arduino unoManual basico de practicas con Arduino uno
Manual basico de practicas con Arduino uno
Ramiro Hernandez Michua
 
Arduino Full Tutorial
Arduino Full TutorialArduino Full Tutorial
Arduino Full Tutorial
Akshay Sharma
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduino
Ahmed Sakr
 
Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009
Eoin Brazil
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
Richard Rixham
 
Arduino Development For Beginners
Arduino Development For BeginnersArduino Development For Beginners
Arduino Development For Beginners
FTS seminar
 
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Eoin Brazil
 
Aquaponics an urban friendly farming final
Aquaponics  an urban friendly farming finalAquaponics  an urban friendly farming final
Aquaponics an urban friendly farming final
Apparao Chodisetti
 
Intro to the Arduino Entrepreneurial System
Intro to the Arduino Entrepreneurial SystemIntro to the Arduino Entrepreneurial System
Intro to the Arduino Entrepreneurial System
todbotdotcom
 
IBC of Aquaponics
IBC of AquaponicsIBC of Aquaponics
IBC of Aquaponics
Arden Chan
 
Wireless Communication And Mobile Network - ZigBee
Wireless Communication And Mobile Network - ZigBeeWireless Communication And Mobile Network - ZigBee
Wireless Communication And Mobile Network - ZigBee
Xaver Y.R. Chen
 
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
Eoin Brazil
 
Future of Education Technology Conference Takeaways - 2016
Future of Education Technology Conference Takeaways - 2016Future of Education Technology Conference Takeaways - 2016
Future of Education Technology Conference Takeaways - 2016
Imagine Easy Solutions
 
Controlling an Arduino with Android
Controlling an Arduino with AndroidControlling an Arduino with Android
Controlling an Arduino with Android
A. Hernandez
 
Aquaponics Final Presentation
Aquaponics Final PresentationAquaponics Final Presentation
Aquaponics Final Presentation
thomasrey
 
Introduction to arduino!
Introduction to arduino!Introduction to arduino!
Introduction to arduino!
Makers of India
 
Starting a Commercial Aquaponics Farm - Bright Agrotech
Starting a Commercial Aquaponics Farm - Bright AgrotechStarting a Commercial Aquaponics Farm - Bright Agrotech
Starting a Commercial Aquaponics Farm - Bright Agrotech
Upstart University
 
Assembling a Vertical Aquaponics System
Assembling a Vertical Aquaponics SystemAssembling a Vertical Aquaponics System
Assembling a Vertical Aquaponics System
Upstart University
 
Manual basico de practicas con Arduino uno
Manual basico de practicas con Arduino unoManual basico de practicas con Arduino uno
Manual basico de practicas con Arduino uno
Ramiro Hernandez Michua
 
Ad

Similar to Programming with arduino (20)

Arduino and Circuits.docx
Arduino and Circuits.docxArduino and Circuits.docx
Arduino and Circuits.docx
Ajay578679
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino Microcontroller
Mujahid Hussain
 
Arduino programming
Arduino programmingArduino programming
Arduino programming
MdAshrafulAlam47
 
01 Intro to the Arduino and it's basics.ppt
01 Intro to the Arduino and it's basics.ppt01 Intro to the Arduino and it's basics.ppt
01 Intro to the Arduino and it's basics.ppt
pindi2197
 
Arduino Programming Basic
Arduino Programming BasicArduino Programming Basic
Arduino Programming Basic
LITS IT Ltd,LASRC.SPACE,SAWDAGOR BD,FREELANCE BD,iREV,BD LAW ACADEMY,SMART AVI,HEA,HFSAC LTD.
 
02 Sensors and Actuators Understand .pdf
02 Sensors and Actuators Understand .pdf02 Sensors and Actuators Understand .pdf
02 Sensors and Actuators Understand .pdf
engsharaf2025
 
Ch_2_8,9,10.pptx
Ch_2_8,9,10.pptxCh_2_8,9,10.pptx
Ch_2_8,9,10.pptx
yosikit826
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
baabtra.com - No. 1 supplier of quality freshers
 
Arduino Slides With Neopixels
Arduino Slides With NeopixelsArduino Slides With Neopixels
Arduino Slides With Neopixels
sdcharle
 
Arduino Day 1 Presentation
Arduino Day 1 PresentationArduino Day 1 Presentation
Arduino Day 1 Presentation
Yogendra Tamang
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3
Jeni Shah
 
Lesson-4-Arduino-Programming-dsBasics.pdf
Lesson-4-Arduino-Programming-dsBasics.pdfLesson-4-Arduino-Programming-dsBasics.pdf
Lesson-4-Arduino-Programming-dsBasics.pdf
unicaeli2020
 
Arduino slides
Arduino slidesArduino slides
Arduino slides
sdcharle
 
Arduino Workshop Slides
Arduino Workshop SlidesArduino Workshop Slides
Arduino Workshop Slides
mkarlin14
 
Arduino-workshop.computer engineering.pdf
Arduino-workshop.computer engineering.pdfArduino-workshop.computer engineering.pdf
Arduino-workshop.computer engineering.pdf
AbhishekGiri933736
 
Arduino Workshop (3).pptx
Arduino Workshop (3).pptxArduino Workshop (3).pptx
Arduino Workshop (3).pptx
HebaEng
 
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
Jayanthi Kannan MK
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
SAURABHKUMAR892774
 
Arduino - Module 1.pdf
Arduino - Module 1.pdfArduino - Module 1.pdf
Arduino - Module 1.pdf
razonclarence4
 
Arduino Foundations
Arduino FoundationsArduino Foundations
Arduino Foundations
John Breslin
 
Arduino and Circuits.docx
Arduino and Circuits.docxArduino and Circuits.docx
Arduino and Circuits.docx
Ajay578679
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino Microcontroller
Mujahid Hussain
 
01 Intro to the Arduino and it's basics.ppt
01 Intro to the Arduino and it's basics.ppt01 Intro to the Arduino and it's basics.ppt
01 Intro to the Arduino and it's basics.ppt
pindi2197
 
02 Sensors and Actuators Understand .pdf
02 Sensors and Actuators Understand .pdf02 Sensors and Actuators Understand .pdf
02 Sensors and Actuators Understand .pdf
engsharaf2025
 
Ch_2_8,9,10.pptx
Ch_2_8,9,10.pptxCh_2_8,9,10.pptx
Ch_2_8,9,10.pptx
yosikit826
 
Arduino Slides With Neopixels
Arduino Slides With NeopixelsArduino Slides With Neopixels
Arduino Slides With Neopixels
sdcharle
 
Arduino Day 1 Presentation
Arduino Day 1 PresentationArduino Day 1 Presentation
Arduino Day 1 Presentation
Yogendra Tamang
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3
Jeni Shah
 
Lesson-4-Arduino-Programming-dsBasics.pdf
Lesson-4-Arduino-Programming-dsBasics.pdfLesson-4-Arduino-Programming-dsBasics.pdf
Lesson-4-Arduino-Programming-dsBasics.pdf
unicaeli2020
 
Arduino slides
Arduino slidesArduino slides
Arduino slides
sdcharle
 
Arduino Workshop Slides
Arduino Workshop SlidesArduino Workshop Slides
Arduino Workshop Slides
mkarlin14
 
Arduino-workshop.computer engineering.pdf
Arduino-workshop.computer engineering.pdfArduino-workshop.computer engineering.pdf
Arduino-workshop.computer engineering.pdf
AbhishekGiri933736
 
Arduino Workshop (3).pptx
Arduino Workshop (3).pptxArduino Workshop (3).pptx
Arduino Workshop (3).pptx
HebaEng
 
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf4 IOT 18ISDE712  MODULE 4 IoT Physical Devices and End Point-Aurdino  Uno.pdf
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
Jayanthi Kannan MK
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
SAURABHKUMAR892774
 
Arduino - Module 1.pdf
Arduino - Module 1.pdfArduino - Module 1.pdf
Arduino - Module 1.pdf
razonclarence4
 
Arduino Foundations
Arduino FoundationsArduino Foundations
Arduino Foundations
John Breslin
 
Ad

More from Makers of India (7)

Buzzer
BuzzerBuzzer
Buzzer
Makers of India
 
push button with led matrix
push button with led matrixpush button with led matrix
push button with led matrix
Makers of India
 
Arduino lcd display
Arduino lcd displayArduino lcd display
Arduino lcd display
Makers of India
 
Rgb
RgbRgb
Rgb
Makers of India
 
Integrated development environment
Integrated development environmentIntegrated development environment
Integrated development environment
Makers of India
 
Lm 35
Lm 35Lm 35
Lm 35
Makers of India
 
Led fade
Led  fadeLed  fade
Led fade
Makers of India
 

Recently uploaded (20)

State institute of educational technology
State institute of educational technologyState institute of educational technology
State institute of educational technology
vp5806484
 
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdfপ্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
Pragya - UEM Kolkata Quiz Club
 
Writing Research Papers: Guidance for Research Community
Writing Research Papers: Guidance for Research CommunityWriting Research Papers: Guidance for Research Community
Writing Research Papers: Guidance for Research Community
Rishi Bankim Chandra Evening College, Naihati, North 24 Parganas, West Bengal, India
 
Swachata Quiz - Prelims - 01.10.24 - Quiz Club IIT Patna
Swachata Quiz - Prelims - 01.10.24 - Quiz Club IIT PatnaSwachata Quiz - Prelims - 01.10.24 - Quiz Club IIT Patna
Swachata Quiz - Prelims - 01.10.24 - Quiz Club IIT Patna
Quiz Club, Indian Institute of Technology, Patna
 
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
RVSPSOA
 
POS Reporting in Odoo 18 - Odoo 18 Slides
POS Reporting in Odoo 18 - Odoo 18 SlidesPOS Reporting in Odoo 18 - Odoo 18 Slides
POS Reporting in Odoo 18 - Odoo 18 Slides
Celine George
 
How to Use Owl Slots in Odoo 17 - Odoo Slides
How to Use Owl Slots in Odoo 17 - Odoo SlidesHow to Use Owl Slots in Odoo 17 - Odoo Slides
How to Use Owl Slots in Odoo 17 - Odoo Slides
Celine George
 
How to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time OffHow to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time Off
Celine George
 
"Dictyoptera: The Order of Cockroaches and Mantises" Or, more specifically: ...
"Dictyoptera: The Order of Cockroaches and Mantises"  Or, more specifically: ..."Dictyoptera: The Order of Cockroaches and Mantises"  Or, more specifically: ...
"Dictyoptera: The Order of Cockroaches and Mantises" Or, more specifically: ...
Arshad Shaikh
 
STUDENT LOAN TRUST FUND DEFAULTERS GHANA
STUDENT LOAN TRUST FUND DEFAULTERS GHANASTUDENT LOAN TRUST FUND DEFAULTERS GHANA
STUDENT LOAN TRUST FUND DEFAULTERS GHANA
Kweku Zurek
 
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGYHUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
DHARMENDRA SAHU
 
Stewart Butler - OECD - How to design and deliver higher technical education ...
Stewart Butler - OECD - How to design and deliver higher technical education ...Stewart Butler - OECD - How to design and deliver higher technical education ...
Stewart Butler - OECD - How to design and deliver higher technical education ...
EduSkills OECD
 
Types of Actions in Odoo 18 - Odoo Slides
Types of Actions in Odoo 18 - Odoo SlidesTypes of Actions in Odoo 18 - Odoo Slides
Types of Actions in Odoo 18 - Odoo Slides
Celine George
 
"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx
Arshad Shaikh
 
Diana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda - A Wauconda-Based EducatorDiana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda
 
0b - THE ROMANTIC ERA: FEELINGS AND IDENTITY.pptx
0b - THE ROMANTIC ERA: FEELINGS AND IDENTITY.pptx0b - THE ROMANTIC ERA: FEELINGS AND IDENTITY.pptx
0b - THE ROMANTIC ERA: FEELINGS AND IDENTITY.pptx
Julián Jesús Pérez Fernández
 
PHYSIOLOGY & SPORTS INJURY by Diwakar Sir
PHYSIOLOGY & SPORTS INJURY by Diwakar SirPHYSIOLOGY & SPORTS INJURY by Diwakar Sir
PHYSIOLOGY & SPORTS INJURY by Diwakar Sir
Diwakar Kashyap
 
Pragya Champion's Chalice 2025 Set , General Quiz
Pragya Champion's Chalice 2025 Set , General QuizPragya Champion's Chalice 2025 Set , General Quiz
Pragya Champion's Chalice 2025 Set , General Quiz
Pragya - UEM Kolkata Quiz Club
 
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATIONTHE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
PROF. PAUL ALLIEU KAMARA
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-30-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-30-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
State institute of educational technology
State institute of educational technologyState institute of educational technology
State institute of educational technology
vp5806484
 
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdfপ্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
প্রত্যুৎপন্নমতিত্ব - Prottutponnomotittwa 2025.pdf
Pragya - UEM Kolkata Quiz Club
 
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
SEM II 3202 STRUCTURAL MECHANICS, B ARCH, REGULATION 2021, ANNA UNIVERSITY, R...
RVSPSOA
 
POS Reporting in Odoo 18 - Odoo 18 Slides
POS Reporting in Odoo 18 - Odoo 18 SlidesPOS Reporting in Odoo 18 - Odoo 18 Slides
POS Reporting in Odoo 18 - Odoo 18 Slides
Celine George
 
How to Use Owl Slots in Odoo 17 - Odoo Slides
How to Use Owl Slots in Odoo 17 - Odoo SlidesHow to Use Owl Slots in Odoo 17 - Odoo Slides
How to Use Owl Slots in Odoo 17 - Odoo Slides
Celine George
 
How to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time OffHow to Create Time Off Request in Odoo 18 Time Off
How to Create Time Off Request in Odoo 18 Time Off
Celine George
 
"Dictyoptera: The Order of Cockroaches and Mantises" Or, more specifically: ...
"Dictyoptera: The Order of Cockroaches and Mantises"  Or, more specifically: ..."Dictyoptera: The Order of Cockroaches and Mantises"  Or, more specifically: ...
"Dictyoptera: The Order of Cockroaches and Mantises" Or, more specifically: ...
Arshad Shaikh
 
STUDENT LOAN TRUST FUND DEFAULTERS GHANA
STUDENT LOAN TRUST FUND DEFAULTERS GHANASTUDENT LOAN TRUST FUND DEFAULTERS GHANA
STUDENT LOAN TRUST FUND DEFAULTERS GHANA
Kweku Zurek
 
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGYHUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
HUMAN SKELETAL SYSTEM ANATAMY AND PHYSIOLOGY
DHARMENDRA SAHU
 
Stewart Butler - OECD - How to design and deliver higher technical education ...
Stewart Butler - OECD - How to design and deliver higher technical education ...Stewart Butler - OECD - How to design and deliver higher technical education ...
Stewart Butler - OECD - How to design and deliver higher technical education ...
EduSkills OECD
 
Types of Actions in Odoo 18 - Odoo Slides
Types of Actions in Odoo 18 - Odoo SlidesTypes of Actions in Odoo 18 - Odoo Slides
Types of Actions in Odoo 18 - Odoo Slides
Celine George
 
"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx"Hymenoptera: A Diverse and Fascinating Order".pptx
"Hymenoptera: A Diverse and Fascinating Order".pptx
Arshad Shaikh
 
Diana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda - A Wauconda-Based EducatorDiana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda - A Wauconda-Based Educator
Diana Enriquez Wauconda
 
PHYSIOLOGY & SPORTS INJURY by Diwakar Sir
PHYSIOLOGY & SPORTS INJURY by Diwakar SirPHYSIOLOGY & SPORTS INJURY by Diwakar Sir
PHYSIOLOGY & SPORTS INJURY by Diwakar Sir
Diwakar Kashyap
 
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATIONTHE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
THE CHURCH AND ITS IMPACT: FOSTERING CHRISTIAN EDUCATION
PROF. PAUL ALLIEU KAMARA
 

Programming with arduino

  • 2.  Arduino programs can be divided in three main parts:  STRUCTURE  VALUES -VARIABLES -CONSTANTS  FUNCTIONS
  • 3. STRUCTURE  The basic structure of the arduino programming language is fairly simple and runs in atleast two parts.  These two required parts,or functions, enclose blocks of statement.
  • 4. Setup() Setup() function is called when a sketch starts Use to initialize variables , pin modes , start using libraries etc… It will only run once,after each powerup or reset. So generally it is used to prepare your ardruino serial communication and pinmode(). It must be included in program even if no lines are there.
  • 5. Example int buttonPin = 3; void setup() { Serial.begin(9600); pinMode(buttonPin, INPUT); } void loop() { // ... }
  • 6. Loop() After calling the setup() function, the loop() function does precisely what its name suggests, loops consecutively  i.e it allows us to execute a statement or group of statements multiple times. Allows program to change, respond and control the Arduino board.
  • 7. Example void loop() { digitalWrite( pin ,HIGH ); //turns ‘pin’ on delay(1000); //pause for one second digitalWrite( pin ,LOW ); //turns ‘pin’ off delay(1000); //pause for one second }
  • 8. Variables  A variable is a way of naming and storing a numerical value for later use.  It can be continuously changed as opposed to constants whose value never changes.  Data types says the size of variable.  Eg: int a,b;  The above statement declares a variable ‘a’ whose size can be of 16 bits.  Initializations can be done while declaring or in further part of program.  Eg: a=20; b=10 //initializing variable a=b; //changing variable value  You can use same variable name in same program but it depends on scope of variable.
  • 9. Functions  A function is a block of code that has a name and a block of statements that are executed when the function is called.  Custom functions can be written to perform repetitive tasks and to reduce clutter in program.  Functions are declared by first declaring the function type.  Function type tells the type of value to be written by the function.  Eg: int a() //for integer type to be returned  If no values is to be returned the function type would be void.  After name of function name we pass can parameters of function in parenthesis.
  • 10. Example int delayVal() { int v; //create temporary variable ‘v’ v = analogRead(pot); //read potentiometer value v /= 4; //converts 0-1024 to 0-255 return v; //return final value }
  • 11. Basic Functions Of Arduino Digital I/O pinMode() digitalWrite() digitalRead() Analog I/O analogReference() analogRead() analogWrite() - PWM Time millis() micros() delay() delayMicroseconds()
  • 12. LED BLINK Description: In this lesson we will, 1. Build and wire a device with one LED, resistor, and Arduino board. 2. Program the device to “Blink the Light” 3. Identify the flow of electricity / signal in this computing unit. 4. Use the Blockly Programming system to control speed of Blink.
  • 13.  You will need:  1. LED Light Bulb (Any Colour)  2. 330 Ohm Resistor  3. Red Wire  4. White Wire  5. Black (Or dark colored Wire)
  • 14. Process: 1. Run a red Wire from the 5V Pin to the Red Rail on the Breadboard. This will connect the current side of the circuit.  2. Run a black (or dark coloured wire) from the Gnd Pin of the Arduino to the Blue Rail on the far side of the Breadboard.
  • 16.  3. Plug an LED bulb into the circuit. Note that the longer pin will face the Arduino Board and the pins should cross the “gap” in the breadboard.  4. This step is VERY IMPORTANT!!! Plug a 330 OHM resistor from Port B5 to Ground (The blue rail).  An LED bulb must ALWAYS have a Resistor in the circuit. If we do not use a Resistor, we will burn out the bulb or the Arduino
  • 17. 5. Now we will run the signal wire. Wire Pin 13 on the Arduino to the Breadboard. This will carry the current from the Arduino Pin to the LED and allow the Arduino to switch on and off the LED.
  • 18. Sketch Programming: 1. Start your Arduino Sketch Program by clicking on the Sketch Icon. 2. Save the code by selecting “File-Save” and naming the program “lastnameBlink”.