SlideShare ist ein Scribd-Unternehmen logo
1 von 19
Downloaden Sie, um offline zu lesen
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.
 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

Weitere ähnliche Inhalte

Was ist angesagt?

Arduino Workshop Day 1 - Basic Arduino
Arduino Workshop Day 1 - Basic ArduinoArduino Workshop Day 1 - Basic Arduino
Arduino Workshop Day 1 - Basic ArduinoVishnu
 
arduino-ppt
 arduino-ppt arduino-ppt
arduino-pptjhcid
 
Comparison between the FPGA vs CPLD
Comparison between the FPGA vs CPLDComparison between the FPGA vs CPLD
Comparison between the FPGA vs CPLDGowri Kishore
 
Introduction to Arduino Programming
Introduction to Arduino ProgrammingIntroduction to Arduino Programming
Introduction to Arduino ProgrammingJames Lewis
 
ESP32 IoT presentation @ dev.bg
ESP32 IoT presentation @ dev.bgESP32 IoT presentation @ dev.bg
ESP32 IoT presentation @ dev.bgMartin Harizanov
 
Vlsi lab viva question with answers
Vlsi lab viva question with answersVlsi lab viva question with answers
Vlsi lab viva question with answersAyesha Ambreen
 
Arduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIYArduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIYVishnu
 
Arduino Workshop
Arduino WorkshopArduino Workshop
Arduino Workshopatuline
 
Smart LED Notice Board
Smart LED Notice BoardSmart LED Notice Board
Smart LED Notice Boardswarnimmaurya
 
Python an-intro v2
Python an-intro v2Python an-intro v2
Python an-intro v2Arulalan T
 
Introduction To Raspberry Pi with Simple GPIO pin Control
Introduction To Raspberry Pi with Simple GPIO pin ControlIntroduction To Raspberry Pi with Simple GPIO pin Control
Introduction To Raspberry Pi with Simple GPIO pin ControlPradip Bhandari
 
Introducing the Arduino
Introducing the ArduinoIntroducing the Arduino
Introducing the ArduinoCharles A B Jr
 
Embedded system programming using Arduino microcontroller
Embedded system programming using Arduino microcontrollerEmbedded system programming using Arduino microcontroller
Embedded system programming using Arduino microcontrollerArun Kumar
 
Arduino slides
Arduino slidesArduino slides
Arduino slidessdcharle
 
Arduino Platform with C programming.
Arduino Platform with C programming.Arduino Platform with C programming.
Arduino Platform with C programming.Govind Jha
 

Was ist angesagt? (20)

Arduino Workshop Day 1 - Basic Arduino
Arduino Workshop Day 1 - Basic ArduinoArduino Workshop Day 1 - Basic Arduino
Arduino Workshop Day 1 - Basic Arduino
 
PPT ON Arduino
PPT ON Arduino PPT ON Arduino
PPT ON Arduino
 
Aurdino presentation
Aurdino presentationAurdino presentation
Aurdino presentation
 
arduino-ppt
 arduino-ppt arduino-ppt
arduino-ppt
 
Comparison between the FPGA vs CPLD
Comparison between the FPGA vs CPLDComparison between the FPGA vs CPLD
Comparison between the FPGA vs CPLD
 
Introduction to Arduino Programming
Introduction to Arduino ProgrammingIntroduction to Arduino Programming
Introduction to Arduino Programming
 
Arduino Programming Basic
Arduino Programming BasicArduino Programming Basic
Arduino Programming Basic
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
ESP32 IoT presentation @ dev.bg
ESP32 IoT presentation @ dev.bgESP32 IoT presentation @ dev.bg
ESP32 IoT presentation @ dev.bg
 
Vlsi lab viva question with answers
Vlsi lab viva question with answersVlsi lab viva question with answers
Vlsi lab viva question with answers
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Arduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIYArduino Workshop Day 2 - Advance Arduino & DIY
Arduino Workshop Day 2 - Advance Arduino & DIY
 
Arduino Workshop
Arduino WorkshopArduino Workshop
Arduino Workshop
 
Smart LED Notice Board
Smart LED Notice BoardSmart LED Notice Board
Smart LED Notice Board
 
Python an-intro v2
Python an-intro v2Python an-intro v2
Python an-intro v2
 
Introduction To Raspberry Pi with Simple GPIO pin Control
Introduction To Raspberry Pi with Simple GPIO pin ControlIntroduction To Raspberry Pi with Simple GPIO pin Control
Introduction To Raspberry Pi with Simple GPIO pin Control
 
Introducing the Arduino
Introducing the ArduinoIntroducing the Arduino
Introducing the Arduino
 
Embedded system programming using Arduino microcontroller
Embedded system programming using Arduino microcontrollerEmbedded system programming using Arduino microcontroller
Embedded system programming using Arduino microcontroller
 
Arduino slides
Arduino slidesArduino slides
Arduino slides
 
Arduino Platform with C programming.
Arduino Platform with C programming.Arduino Platform with C programming.
Arduino Platform with C programming.
 

Andere mochten auch

Arduino Full Tutorial
Arduino Full TutorialArduino Full Tutorial
Arduino Full TutorialAkshay Sharma
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduinoAhmed 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 2009Eoin Brazil
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to ArduinoRichard Rixham
 
Arduino Development For Beginners
Arduino Development For BeginnersArduino Development For Beginners
Arduino Development For BeginnersFTS 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 2009Eoin Brazil
 
Aquaponics an urban friendly farming final
Aquaponics  an urban friendly farming finalAquaponics  an urban friendly farming final
Aquaponics an urban friendly farming finalApparao Chodisetti
 
Intro to the Arduino Entrepreneurial System
Intro to the Arduino Entrepreneurial SystemIntro to the Arduino Entrepreneurial System
Intro to the Arduino Entrepreneurial Systemtodbotdotcom
 
IBC of Aquaponics
IBC of AquaponicsIBC of Aquaponics
IBC of AquaponicsArden Chan
 
Wireless Communication And Mobile Network - ZigBee
Wireless Communication And Mobile Network - ZigBeeWireless Communication And Mobile Network - ZigBee
Wireless Communication And Mobile Network - ZigBeeXaver 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 2009Eoin 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 - 2016Imagine Easy Solutions
 
Controlling an Arduino with Android
Controlling an Arduino with AndroidControlling an Arduino with Android
Controlling an Arduino with AndroidA. Hernandez
 
Aquaponics Final Presentation
Aquaponics Final PresentationAquaponics Final Presentation
Aquaponics Final Presentationthomasrey
 
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 AgrotechUpstart University
 
Assembling a Vertical Aquaponics System
Assembling a Vertical Aquaponics SystemAssembling a Vertical Aquaponics System
Assembling a Vertical Aquaponics SystemUpstart University
 

Andere mochten auch (20)

Arduino Full Tutorial
Arduino Full TutorialArduino Full Tutorial
Arduino Full Tutorial
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduino
 
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
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Arduino Development For Beginners
Arduino Development For BeginnersArduino Development For Beginners
Arduino Development For Beginners
 
Arduino
ArduinoArduino
Arduino
 
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
 
50 apps in 50 minutes
50 apps in 50 minutes50 apps in 50 minutes
50 apps in 50 minutes
 
Aquaponics an urban friendly farming final
Aquaponics  an urban friendly farming finalAquaponics  an urban friendly farming final
Aquaponics an urban friendly farming final
 
Intro to the Arduino Entrepreneurial System
Intro to the Arduino Entrepreneurial SystemIntro to the Arduino Entrepreneurial System
Intro to the Arduino Entrepreneurial System
 
IBC of Aquaponics
IBC of AquaponicsIBC of Aquaponics
IBC of Aquaponics
 
Wireless Communication And Mobile Network - ZigBee
Wireless Communication And Mobile Network - ZigBeeWireless Communication And Mobile Network - ZigBee
Wireless Communication And Mobile Network - ZigBee
 
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
 
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
 
Controlling an Arduino with Android
Controlling an Arduino with AndroidControlling an Arduino with Android
Controlling an Arduino with Android
 
Aquaponics Final Presentation
Aquaponics Final PresentationAquaponics Final Presentation
Aquaponics Final Presentation
 
Introduction to arduino!
Introduction to arduino!Introduction to arduino!
Introduction to arduino!
 
Aquaponics and Renewable Energy
Aquaponics and Renewable EnergyAquaponics and Renewable Energy
Aquaponics and Renewable Energy
 
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
 
Assembling a Vertical Aquaponics System
Assembling a Vertical Aquaponics SystemAssembling a Vertical Aquaponics System
Assembling a Vertical Aquaponics System
 

Ähnlich wie Programming with arduino

Ch_2_8,9,10.pptx
Ch_2_8,9,10.pptxCh_2_8,9,10.pptx
Ch_2_8,9,10.pptxyosikit826
 
After COMPUTING THIS IS FOR COMPUTER SCIENTISTS.pptx
After COMPUTING THIS IS FOR COMPUTER SCIENTISTS.pptxAfter COMPUTING THIS IS FOR COMPUTER SCIENTISTS.pptx
After COMPUTING THIS IS FOR COMPUTER SCIENTISTS.pptxElisée Ndjabu
 
[Apostila] programação arduíno brian w. evans
[Apostila] programação arduíno   brian w. evans[Apostila] programação arduíno   brian w. evans
[Apostila] programação arduíno brian w. evansWeb-Desegner
 
Lab 2_ Programming an Arduino.pdf
Lab 2_ Programming an Arduino.pdfLab 2_ Programming an Arduino.pdf
Lab 2_ Programming an Arduino.pdfssuser0e9cc4
 
Arduino and Circuits.docx
Arduino and Circuits.docxArduino and Circuits.docx
Arduino and Circuits.docxAjay578679
 
Arduino اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينوsalih mahmod
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3Jeni Shah
 
Arduino windows remote control
Arduino windows remote controlArduino windows remote control
Arduino windows remote controlVilayatAli5
 
Arduino Foundations
Arduino FoundationsArduino Foundations
Arduino FoundationsJohn Breslin
 
Microcontroller Programming & Hardware Introduction
Microcontroller Programming & Hardware IntroductionMicrocontroller Programming & Hardware Introduction
Microcontroller Programming & Hardware IntroductionJoseph Sanchez
 
Hello Arduino.
Hello Arduino.Hello Arduino.
Hello Arduino.mkontopo
 
Starting with Arduino
Starting with Arduino Starting with Arduino
Starting with Arduino MajdyShamasneh
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalTony Olsson.
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalTony Olsson.
 
arduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfarduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfssusere5db05
 

Ähnlich wie Programming with arduino (20)

Ch_2_8,9,10.pptx
Ch_2_8,9,10.pptxCh_2_8,9,10.pptx
Ch_2_8,9,10.pptx
 
After COMPUTING THIS IS FOR COMPUTER SCIENTISTS.pptx
After COMPUTING THIS IS FOR COMPUTER SCIENTISTS.pptxAfter COMPUTING THIS IS FOR COMPUTER SCIENTISTS.pptx
After COMPUTING THIS IS FOR COMPUTER SCIENTISTS.pptx
 
[Apostila] programação arduíno brian w. evans
[Apostila] programação arduíno   brian w. evans[Apostila] programação arduíno   brian w. evans
[Apostila] programação arduíno brian w. evans
 
Fun with arduino
Fun with arduinoFun with arduino
Fun with arduino
 
Arduino IDE
Arduino IDE Arduino IDE
Arduino IDE
 
Arduino programming
Arduino programmingArduino programming
Arduino programming
 
Lab 2_ Programming an Arduino.pdf
Lab 2_ Programming an Arduino.pdfLab 2_ Programming an Arduino.pdf
Lab 2_ Programming an Arduino.pdf
 
Arduino and Circuits.docx
Arduino and Circuits.docxArduino and Circuits.docx
Arduino and Circuits.docx
 
publish manual
publish manualpublish manual
publish manual
 
Arduino اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينو
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3
 
Arduino windows remote control
Arduino windows remote controlArduino windows remote control
Arduino windows remote control
 
Arduino.pptx
Arduino.pptxArduino.pptx
Arduino.pptx
 
Arduino Foundations
Arduino FoundationsArduino Foundations
Arduino Foundations
 
Microcontroller Programming & Hardware Introduction
Microcontroller Programming & Hardware IntroductionMicrocontroller Programming & Hardware Introduction
Microcontroller Programming & Hardware Introduction
 
Hello Arduino.
Hello Arduino.Hello Arduino.
Hello Arduino.
 
Starting with Arduino
Starting with Arduino Starting with Arduino
Starting with Arduino
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digital
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digital
 
arduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdfarduinocourse-180308074529 (1).pdf
arduinocourse-180308074529 (1).pdf
 

Mehr von Makers of India

Mehr von Makers of India (7)

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

Kürzlich hochgeladen

MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFEPART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFEMISSRITIMABIOLOGYEXP
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...Nguyen Thanh Tu Collection
 
How to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command LineHow to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command LineCeline George
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptxmary850239
 
Shark introduction Morphology and its behaviour characteristics
Shark introduction Morphology and its behaviour characteristicsShark introduction Morphology and its behaviour characteristics
Shark introduction Morphology and its behaviour characteristicsArubSultan
 
Employablity presentation and Future Career Plan.pptx
Employablity presentation and Future Career Plan.pptxEmployablity presentation and Future Career Plan.pptx
Employablity presentation and Future Career Plan.pptxryandux83rd
 
Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17Celine George
 
An Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERPAn Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERPCeline George
 
Sulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesSulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesVijayaLaxmi84
 
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...Nguyen Thanh Tu Collection
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6Vanessa Camilleri
 
The Emergence of Legislative Behavior in the Colombian Congress
The Emergence of Legislative Behavior in the Colombian CongressThe Emergence of Legislative Behavior in the Colombian Congress
The Emergence of Legislative Behavior in the Colombian CongressMaria Paula Aroca
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQuiz Club NITW
 

Kürzlich hochgeladen (20)

MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFEPART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
 
Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...
Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...
Plagiarism,forms,understand about plagiarism,avoid plagiarism,key significanc...
 
How to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command LineHow to Uninstall a Module in Odoo 17 Using Command Line
How to Uninstall a Module in Odoo 17 Using Command Line
 
4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx4.9.24 School Desegregation in Boston.pptx
4.9.24 School Desegregation in Boston.pptx
 
Shark introduction Morphology and its behaviour characteristics
Shark introduction Morphology and its behaviour characteristicsShark introduction Morphology and its behaviour characteristics
Shark introduction Morphology and its behaviour characteristics
 
Employablity presentation and Future Career Plan.pptx
Employablity presentation and Future Career Plan.pptxEmployablity presentation and Future Career Plan.pptx
Employablity presentation and Future Career Plan.pptx
 
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
Mattingly "AI & Prompt Design" - Introduction to Machine Learning"
 
Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17Tree View Decoration Attribute in the Odoo 17
Tree View Decoration Attribute in the Odoo 17
 
An Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERPAn Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERP
 
Sulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesSulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their uses
 
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN THEO CÂU CHO HỌC SINH LỚP 12 ĐỂ ĐẠT ĐIỂM 5+ THI TỐT NGHIỆP THPT ...
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6
 
The Emergence of Legislative Behavior in the Colombian Congress
The Emergence of Legislative Behavior in the Colombian CongressThe Emergence of Legislative Behavior in the Colombian Congress
The Emergence of Legislative Behavior in the Colombian Congress
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
Chi-Square Test Non Parametric Test Categorical Variable
Chi-Square Test Non Parametric Test Categorical VariableChi-Square Test Non Parametric Test Categorical Variable
Chi-Square Test Non Parametric Test Categorical Variable
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
 

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.
  • 15.
  • 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”.