Movatterモバイル変換


[0]ホーム

URL:


PPTX, PDF491 views

Programming with arduino

The document summarizes the basics of Arduino programming. It discusses that Arduino programs have three main parts: structure, values (variables and constants), and functions. It describes the setup() and loop() functions that enclose blocks of code. Setup() initializes variables and runs once, while loop() continuously runs the main program code. It also discusses defining variables, data types, and writing custom functions. Finally, it provides an example of blinking an LED using the Arduino by wiring an LED, resistor and running a program to turn the LED on and off.

Embed presentation

Downloaded 38 times
ProgrammingofArduino
 Arduino programs can be divided in threemain parts: STRUCTURE VALUES -VARIABLES-CONSTANTS FUNCTIONS
STRUCTURE The basic structure of the arduino programming language is fairlysimple 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 usinglibraries etc…It will only run once,after each powerup or reset.So generally it is used to prepare your ardruino serialcommunication and pinmode().It must be included in program even if no lines are there.
Exampleint buttonPin = 3;void setup(){Serial.begin(9600);pinMode(buttonPin, INPUT);}void loop(){// ...}
Loop()After calling the setup() function, the loop() function doesprecisely what its name suggests, loops consecutively i.e it allows us to execute a statement or group ofstatements multiple times.Allows program to change, respond and control the Arduinoboard.
Examplevoid loop(){digitalWrite( pin ,HIGH ); //turns ‘pin’ ondelay(1000); //pause for one seconddigitalWrite( pin ,LOW ); //turns ‘pin’ offdelay(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 variablea=b; //changing variable value You can use same variable name in same program but it dependson scope of variable.
Functions A function is a block of code that has a name and a block of statementsthat are executed when the function is called. Custom functions can be written to perform repetitive tasks and toreduce 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 inparenthesis.
Exampleint delayVal(){int v; //create temporary variable ‘v’v = analogRead(pot); //read potentiometer valuev /= 4; //converts 0-1024 to 0-255return v; //return final value}
Basic Functions Of ArduinoDigital I/OpinMode()digitalWrite()digitalRead()Analog I/OanalogReference()analogRead()analogWrite() - PWMTimemillis()micros()delay()delayMicroseconds()
LED BLINKDescription:In this lesson we will,1. Build and wire a device with one LED, resistor, andArduino 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 ofBlink.
 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 theBreadboard. This will connect the current side of thecircuit. 2. Run a black (or dark coloured wire) from the Gnd Pin ofthe Arduino to the Blue Rail on the far side of theBreadboard.
 3. Plug an LED bulb into the circuit. Note that the longer pin will face theArduino Board and the pins should cross the “gap” in the breadboard. 4. This step is VERY IMPORTANT!!! Plug a 330 OHM resistor from Port B5to Ground (The blue rail). An LED bulb must ALWAYS have a Resistor in the circuit. If we do not use aResistor, we will burn out the bulb or the Arduino
5. Now we will run the signal wire. Wire Pin 13 on theArduino to the Breadboard. This will carry the current fromthe Arduino Pin to the LED and allow the Arduino to switchon and off the LED.
Sketch Programming:1. Start your Arduino Sketch Program by clicking onthe Sketch Icon.2. Save the code by selecting “File-Save” andnaming the program “lastnameBlink”.
Programming with arduino

Recommended

PPTX
Lesson sample introduction to arduino
PPTX
Ardui no
PPTX
Introduction to the Arduino
PDF
Arduino Workshop Day 1 - Basic Arduino
 
PPTX
Introduction to Arduino
PDF
Introduction to Arduino Programming
PPT
arduino
 
PPTX
Introduction to Arduino Hardware and Programming
PDF
Report on arduino
PPTX
Arduino slides
PDF
Introduction of Arduino Uno
PDF
Arduino IDE
PPT
Verilog hdl
PPTX
Arduino course
PPTX
Embedded Systems - Training ppt
PPT
Arduino
PDF
Esp8266 basics
PPTX
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauri
PPTX
Introduction to Arduino
PPTX
Arduino
PPTX
Introduction to Arduino
PPTX
PIC Microcontrollers
PPTX
Arduino: On-board components description, IDE and Programming
PPTX
Arduino Microcontroller
PPTX
Different Arduino Boards
PPTX
IoT Based Home Automation System Presantation
DOCX
Arduino Full Tutorial
PPTX
Introduction to arduino

More Related Content

PPTX
Lesson sample introduction to arduino
PPTX
Ardui no
PPTX
Introduction to the Arduino
PDF
Arduino Workshop Day 1 - Basic Arduino
 
PPTX
Introduction to Arduino
PDF
Introduction to Arduino Programming
PPT
arduino
 
PPTX
Introduction to Arduino Hardware and Programming
Lesson sample introduction to arduino
Ardui no
Introduction to the Arduino
Arduino Workshop Day 1 - Basic Arduino
 
Introduction to Arduino
Introduction to Arduino Programming
arduino
 
Introduction to Arduino Hardware and Programming

What's hot

PDF
Report on arduino
PPTX
Arduino slides
PDF
Introduction of Arduino Uno
PDF
Arduino IDE
PPT
Verilog hdl
PPTX
Arduino course
PPTX
Embedded Systems - Training ppt
PPT
Arduino
PDF
Esp8266 basics
PPTX
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauri
PPTX
Introduction to Arduino
PPTX
Arduino
PPTX
Introduction to Arduino
PPTX
PIC Microcontrollers
PPTX
Arduino: On-board components description, IDE and Programming
PPTX
Arduino Microcontroller
PPTX
Different Arduino Boards
PPTX
IoT Based Home Automation System Presantation
Report on arduino
Arduino slides
Introduction of Arduino Uno
Arduino IDE
Verilog hdl
Arduino course
Embedded Systems - Training ppt
Arduino
Esp8266 basics
Arduino for beginners- Introduction to Arduino (presentation) - codewithgauri
Introduction to Arduino
Arduino
Introduction to Arduino
PIC Microcontrollers
Arduino: On-board components description, IDE and Programming
Arduino Microcontroller
Different Arduino Boards
IoT Based Home Automation System Presantation

Viewers also liked

DOCX
Arduino Full Tutorial
PPTX
Introduction to arduino
PDF
Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009
ODP
Introduction to Arduino
PDF
Arduino Development For Beginners
PDF
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
PDF
50 apps in 50 minutes
PPTX
Aquaponics an urban friendly farming final
PPT
Intro to the Arduino Entrepreneurial System
PDF
IBC of Aquaponics
KEY
Wireless Communication And Mobile Network - ZigBee
PDF
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
PDF
Future of Education Technology Conference Takeaways - 2016
PPTX
Controlling an Arduino with Android
PDF
Aquaponics Final Presentation
PPTX
Introduction to arduino!
PDF
Starting a Commercial Aquaponics Farm - Bright Agrotech
PDF
Assembling a Vertical Aquaponics System
DOCX
Manual basico de practicas con Arduino uno
Arduino Full Tutorial
Introduction to arduino
Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009
Introduction to Arduino
Arduino Development For Beginners
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
50 apps in 50 minutes
Aquaponics an urban friendly farming final
Intro to the Arduino Entrepreneurial System
IBC of Aquaponics
Wireless Communication And Mobile Network - ZigBee
Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009
Future of Education Technology Conference Takeaways - 2016
Controlling an Arduino with Android
Aquaponics Final Presentation
Introduction to arduino!
Starting a Commercial Aquaponics Farm - Bright Agrotech
Assembling a Vertical Aquaponics System
Manual basico de practicas con Arduino uno

Similar to Programming with arduino

PPTX
Understanding Arduino Uno Code(simple coding).pptx
DOCX
Arduino and Circuits.docx
PPTX
Introduction to Arduino Microcontroller
PPTX
Arduino programming
PPT
01 Intro to the Arduino and it's basics.ppt
PDF
02 Sensors and Actuators Understand .pdf
PPTX
Ch_2_8,9,10.pptx
PPTX
Blinking a LED in ARDUINO UNO IOT TUTORIAL
PPTX
Arduino UNO Introduction for Beginers.pptx
PPTX
Arduino Slides With Neopixels
PPTX
Arduino Day 1 Presentation
PPTX
Arduino cic3
PDF
Lesson-4-Arduino-Programming-dsBasics.pdf
PPTX
Arduino Workshop Slides
PDF
Arduino-workshop.computer engineering.pdf
PPTX
IOT-UNIT 3.pptxaaaasasasasasasaasasasasas
PPTX
Arduino Workshop (3).pptx
PDF
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
PPT
Arduino_CSE ece ppt for working and principal of arduino.ppt
PDF
Arduino - Module 1.pdf
Understanding Arduino Uno Code(simple coding).pptx
Arduino and Circuits.docx
Introduction to Arduino Microcontroller
Arduino programming
01 Intro to the Arduino and it's basics.ppt
02 Sensors and Actuators Understand .pdf
Ch_2_8,9,10.pptx
Blinking a LED in ARDUINO UNO IOT TUTORIAL
Arduino UNO Introduction for Beginers.pptx
Arduino Slides With Neopixels
Arduino Day 1 Presentation
Arduino cic3
Lesson-4-Arduino-Programming-dsBasics.pdf
Arduino Workshop Slides
Arduino-workshop.computer engineering.pdf
IOT-UNIT 3.pptxaaaasasasasasasaasasasasas
Arduino Workshop (3).pptx
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino - Module 1.pdf

More from Makers of India

PPTX
Buzzer
PPTX
push button with led matrix
DOCX
Arduino lcd display
PPTX
PPTX
Integrated development environment
PDF
PPTX
Led fade
Buzzer
push button with led matrix
Arduino lcd display
Integrated development environment
Led fade

Recently uploaded

PPTX
15 December 2025 Education for human flourishing Michael Stevenson .pptx
PDF
Current Electricity for first year physiotherapy
PDF
Projecte de la porta d'i5B: Els animals marins
PPTX
Semester 6 UNIT 2 Dislocation of hip.pptx
PPTX
CHAPTER NO.08 HCP BY GG CLINICAL PHARMACY
PPTX
The Cell & Cell Cycle-detailed structure and function of organelles.pptx
PDF
The Tale of Melon City poem ppt by Sahasra
PDF
Blue / Green: Troop Leading Procedure (TLP) Overview.pdf
PPTX
Campfens "The Data Qualify Challenge: Publishers, institutions, and funders r...
PPTX
Rectal Surgery in Senior Citiizens .pptx
PDF
The Pity of War: Form, Fragment, and the Artificial Echo | Understanding War ...
PDF
DHA/HAAD/MOH/DOH OPTOMETRY MCQ PYQ. .pdf
PPTX
Cost of Capital - Cost of Equity, Cost of debenture, Cost of Preference share...
PDF
FAMILY ASSESSMENT FORMAT - CHN practical
PPTX
How to Manage Reception Report in Odoo 18 Inventory
PDF
Digital Wellness in University Communities: Libraries as Guardians of Healthy...
PPTX
Limpitlaw "Licensing: From Mindset to Milestones"
PPTX
ELEMENTS OF COMMUNICATION (UNIT 2) .pptx
PPTX
ICH Harmonization A Global Pathway to Unified Drug Regulation.pptx
PPTX
How to Manage Line Discounts in Odoo 18 POS
15 December 2025 Education for human flourishing Michael Stevenson .pptx
Current Electricity for first year physiotherapy
Projecte de la porta d'i5B: Els animals marins
Semester 6 UNIT 2 Dislocation of hip.pptx
CHAPTER NO.08 HCP BY GG CLINICAL PHARMACY
The Cell & Cell Cycle-detailed structure and function of organelles.pptx
The Tale of Melon City poem ppt by Sahasra
Blue / Green: Troop Leading Procedure (TLP) Overview.pdf
Campfens "The Data Qualify Challenge: Publishers, institutions, and funders r...
Rectal Surgery in Senior Citiizens .pptx
The Pity of War: Form, Fragment, and the Artificial Echo | Understanding War ...
DHA/HAAD/MOH/DOH OPTOMETRY MCQ PYQ. .pdf
Cost of Capital - Cost of Equity, Cost of debenture, Cost of Preference share...
FAMILY ASSESSMENT FORMAT - CHN practical
How to Manage Reception Report in Odoo 18 Inventory
Digital Wellness in University Communities: Libraries as Guardians of Healthy...
Limpitlaw "Licensing: From Mindset to Milestones"
ELEMENTS OF COMMUNICATION (UNIT 2) .pptx
ICH Harmonization A Global Pathway to Unified Drug Regulation.pptx
How to Manage Line Discounts in Odoo 18 POS

Programming with arduino

  • 1.
  • 2.
     Arduino programscan be divided in threemain parts: STRUCTURE VALUES -VARIABLES-CONSTANTS FUNCTIONS
  • 3.
    STRUCTURE The basicstructure of the arduino programming language is fairlysimple and runs in atleast two parts. These two required parts,or functions, enclose blocks of statement.
  • 4.
    Setup()Setup() function iscalled when a sketch startsUse to initialize variables , pin modes , start usinglibraries etc…It will only run once,after each powerup or reset.So generally it is used to prepare your ardruino serialcommunication and pinmode().It must be included in program even if no lines are there.
  • 5.
    Exampleint buttonPin =3;void setup(){Serial.begin(9600);pinMode(buttonPin, INPUT);}void loop(){// ...}
  • 6.
    Loop()After calling thesetup() function, the loop() function doesprecisely what its name suggests, loops consecutively i.e it allows us to execute a statement or group ofstatements multiple times.Allows program to change, respond and control the Arduinoboard.
  • 7.
    Examplevoid loop(){digitalWrite( pin,HIGH ); //turns ‘pin’ ondelay(1000); //pause for one seconddigitalWrite( pin ,LOW ); //turns ‘pin’ offdelay(1000); //pause for one second}
  • 8.
    Variables A variableis 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 variablea=b; //changing variable value You can use same variable name in same program but it dependson scope of variable.
  • 9.
    Functions A functionis a block of code that has a name and a block of statementsthat are executed when the function is called. Custom functions can be written to perform repetitive tasks and toreduce 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 inparenthesis.
  • 10.
    Exampleint delayVal(){int v;//create temporary variable ‘v’v = analogRead(pot); //read potentiometer valuev /= 4; //converts 0-1024 to 0-255return v; //return final value}
  • 11.
    Basic Functions OfArduinoDigital I/OpinMode()digitalWrite()digitalRead()Analog I/OanalogReference()analogRead()analogWrite() - PWMTimemillis()micros()delay()delayMicroseconds()
  • 12.
    LED BLINKDescription:In thislesson we will,1. Build and wire a device with one LED, resistor, andArduino 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 ofBlink.
  • 13.
     You willneed: 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 ared Wire from the 5V Pin to the Red Rail on theBreadboard. This will connect the current side of thecircuit. 2. Run a black (or dark coloured wire) from the Gnd Pin ofthe Arduino to the Blue Rail on the far side of theBreadboard.
  • 16.
     3. Plugan LED bulb into the circuit. Note that the longer pin will face theArduino Board and the pins should cross the “gap” in the breadboard. 4. This step is VERY IMPORTANT!!! Plug a 330 OHM resistor from Port B5to Ground (The blue rail). An LED bulb must ALWAYS have a Resistor in the circuit. If we do not use aResistor, we will burn out the bulb or the Arduino
  • 17.
    5. Now wewill run the signal wire. Wire Pin 13 on theArduino to the Breadboard. This will carry the current fromthe Arduino Pin to the LED and allow the Arduino to switchon and off the LED.
  • 18.
    Sketch Programming:1. Startyour Arduino Sketch Program by clicking onthe Sketch Icon.2. Save the code by selecting “File-Save” andnaming the program “lastnameBlink”.

[8]ページ先頭

©2009-2025 Movatter.jp