SlideShare a Scribd company logo
7
ARDUINO PROGRAMMING -GLOSSARY
(C) MELabs (Mobile Embedded Labs Pvt.Ltd)
●
Sketch – Program that runs on the board
●
Pin – Input or Output connected to something – Eg: Output to an LED input to an
Switch
●
Digital – 1 (high) or 0 (Low) -ON/OFF
●
Analog – Range 0-255 (Led brightness)
●
Arduino IDE – Comes with C/C++ lib named as Wiring
●
Programs are written in C & C++ but only having two funtcions -
Setup() - Called once at the start of program, works as initialiser
Loop() - Called repeatedly until the board is powered-off
Most read
12
If --- else
MELabs (Mobile Embedded Labs Pvt.Ltd)
The if statement checks for a condition and executes the proceeding statement or set
of statements if the condition is 'true'.
Syntax
if (condition)
{
//statement(s)
}
Parameters
condition: a boolean expression i.e., can be true or false
Most read
15
For Statement -example
(C) MELabs (Mobile Embedded Labs Pvt.Ltd)
// Dim an LED using a PWM pin
int PWMpin = 10; // LED in series with 470 ohm resistor on pin 10
void setup()
{
// no setup needed
}
void loop()
{
for (int i=0; i <= 255; i++) {
analogWrite(PWMpin, i);
//Writes an analog value (PWM wave) to a pin. Can be used to light a LED at varying brightnesses or
drive a motor at various speeds
delay(10);
}
}
Most read
•
Introduction to Arduino
•
UNO Overview
•
Programming Basics
•
Arduino Libraires
l
Siji Sunny
siji@melabs.in
Arduino Programming
(For Beginners)
WHAT IS ARDUINO
(C) MELabs (Mobile Embedded Labs Pvt.Ltd)

The Arduino project started in 2003 as a program for students at the Interaction Design
Institute Ivrea in Ivrea, Italy

Open Source Hardware and Software Platform

single-board microcontroller

Allows to building digital devices and interactive objects that can sense and control
objects in the physical world.
DEVELOPMENT ENVIRONMENT
(C) MELabs (Mobile Embedded Labs Pvt.Ltd)

The Arduino Uno can be programmed with the Arduino software

IDE(integrated development environment)

The Atmega328 on the Arduino Uno comes preburned with a Bootloader that allows you to
upload new code to it without the use of an external hardware programmer.

You can also bypass the Bootloader and program the microcontroller through the ICSP
(In-Circuit Serial Programming) header.
Arduino UNO
(C) MELabs (Mobile Embedded Labs Pvt.Ltd)
UNO SPECIFCATION
(C) MELabs (Mobile Embedded Labs Pvt.Ltd)
●
The Arduino Uno can be programmed with the Arduino software
●
Microcontroller – Atmega328
●
Operating Voltage 5V and 3.3 V
●
Digital I/O Pins -14
●
Analog Input Pins 6
●
Flash Memory 32 KB (ATmega328) of which 0.5 KB used by Bootloader
●
SRAM – 2KB
●
EEPROM -1KB
MEMORY/STORAGE
(C) MELabs (Mobile Embedded Labs Pvt.Ltd)

There are three pools of memory in the microcontroller used on avr-based Arduino
boards :

Flash memory (program space), is where the Arduino sketch is stored.

SRAM (static random access memory) is where the sketch creates and manipulates variables
when it runs.

EEPROM is memory space that programmers can use to store long-term information.

Flash memory and EEPROM memory are non-volatile (the information persists after
the power is turned off). SRAM is volatile and will be lost when the power is cycled.
ARDUINO PROGRAMMING -GLOSSARY
(C) MELabs (Mobile Embedded Labs Pvt.Ltd)
●
Sketch – Program that runs on the board
●
Pin – Input or Output connected to something – Eg: Output to an LED input to an
Switch
●
Digital – 1 (high) or 0 (Low) -ON/OFF
●
Analog – Range 0-255 (Led brightness)
●
Arduino IDE – Comes with C/C++ lib named as Wiring
●
Programs are written in C & C++ but only having two funtcions -
Setup() - Called once at the start of program, works as initialiser
Loop() - Called repeatedly until the board is powered-off
SKETCH
(C) MELabs (Mobile Embedded Labs Pvt.Ltd)
Global Variables
setup()
loop()
Variable Declaration
Initialise
loop
C++ Lib
C/C++
Readable Code
C/C++
Readable Code
Assembly Readable
Code
Machine Language
SKETCH -setup()/loop()
(C) MELabs (Mobile Embedded Labs Pvt.Ltd)
setup()
pinMode() - set pin as input or output
serialBegin() - Set to talk to the computer
loop()
digitalWrite() - set digital pin as high/low
digtialRead() -read a digital pin state
wait()- wait an amount of time
SKETCH -Example
(C) MELabs (Mobile Embedded Labs Pvt.Ltd)
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}
For Statement -example
(C) MELabs (Mobile Embedded Labs Pvt.Ltd)
// Dim an LED using a PWM pin
int PWMpin = 10; // LED in series with 470 ohm resistor on pin 10
void setup()
{
// no setup needed
}
void loop()
{
for (int i=0; i <= 255; i++) {
analogWrite(PWMpin, i);
//Writes an analog value (PWM wave) to a pin. Can be used to light a LED at varying brightnesses or
drive a motor at various speeds
delay(10);
}
}
If --- else
MELabs (Mobile Embedded Labs Pvt.Ltd)
The if statement checks for a condition and executes the proceeding statement or set
of statements if the condition is 'true'.
Syntax
if (condition)
{
//statement(s)
}
Parameters
condition: a boolean expression i.e., can be true or false
Switch/Case statements
MELabs (Mobile Embedded Labs Pvt.Ltd)
switch (var) {
case 1:
//do something when var equals 1
break;
case 2:
//do something when var equals 2
break;
default:
// if nothing else matches, do the default
// default is optional
}
For Statement
(C) MELabs (Mobile Embedded Labs Pvt.Ltd)

The for statement is used to repeat a block of statements enclosed in curly braces.

An increment counter is usually used to increment and terminate the loop.

The for statement is useful for any repetitive operation, and is often used in
combination with arrays to operate on collections of data/pins.
for (initialization; condition; increment) {
//statement(s);
}
For Statement -example
(C) MELabs (Mobile Embedded Labs Pvt.Ltd)
// Dim an LED using a PWM pin
int PWMpin = 10; // LED in series with 470 ohm resistor on pin 10
void setup()
{
// no setup needed
}
void loop()
{
for (int i=0; i <= 255; i++) {
analogWrite(PWMpin, i);
//Writes an analog value (PWM wave) to a pin. Can be used to light a LED at varying brightnesses or
drive a motor at various speeds
delay(10);
}
}
while statement
(C) MELabs (Mobile Embedded Labs Pvt.Ltd)
A while loop will loop continuously, and infinitely, until the expression inside
the parenthesis, () becomes false.
while(condition){
// statement(s)
}
Example :
var = 0;
while(var < 200){
// do something repetitive 200 times
var++;
}
Do – While statement
(C) MELabs (Mobile Embedded Labs Pvt.Ltd)
The do…while loop works in the same manner as the while loop, with the exception
that the condition is tested at the end of the loop, so the do loop will always run at
least once.
do
{
// statement block
} while (condition);
Example -
do
{
delay(50); // wait for sensors to stabilize
x = readSensors(); // check the sensors
} while (x < 100);
Data Types
(C) MELabs (Mobile Embedded Labs Pvt.Ltd)
●
Integers, booleans, and characters
●
Float: Data type for floating point numbers (those with a decimal point). They can range
from 3.4028235E+38 down to -3.4028235E+38. Stored as 32 bits (4 bytes).
●
Long: Data type for larger numbers, from -2,147,483,648 to 2,147,483,647, and store
32 bits (4 bytes) of information.
●
String: On the Arduino, there are really two kinds of strings: strings (with a lower case s )ʻ ʼ
can be created as an array of characters (of type char). String (with a capital S ), is a Stringʻ ʼ
type object.
Char stringArray[10] = “isdi”;
String stringObject = String(“isdi”);
The advantage of the second method (using the String object) is that it allows you to use a number of built-in methods,
such as length(), replace(), and equals().
ARDUINO -Libraries
(C) MELabs (Mobile Embedded Labs Pvt.Ltd)
Libraries provide extra functionality for use in sketches, e.g. working with hardware
or manipulating data. To use a library in a sketch.
select it from Sketch > Import Library.
Standard Libraries
(C) MELabs (Mobile Embedded Labs Pvt.Ltd)

EEPROM - reading and writing to "permanent" storage


Ethernet / Ethernet 2 - for connecting to the internet using the Arduino Ethernet Shield, Arduino Ethernet Shield 2 and Arduino
Leonardo ETH


Firmata - for communicating with applications on the computer using a standard serial protocol.


GSM - for connecting to a GSM/GRPS network with the GSM shield.


LiquidCrystal - for controlling liquid crystal displays (LCDs)


SD - for reading and writing SD cards


Servo - for controlling servo motors


SPI - for communicating with devices using the Serial Peripheral Interface (SPI) Bus


Stepper - for controlling stepper motors


TFT - for drawing text , images, and shapes on the Arduino TFT screen


WiFi - for connecting to the internet using the Arduino WiFi shield

More Related Content

What's hot (20)

Report on arduino
Report on arduinoReport on arduino
Report on arduino
Ravi Phadtare
 
microcontroller vs microprocessor
microcontroller vs microprocessormicrocontroller vs microprocessor
microcontroller vs microprocessor
sobhadevi
 
Smart Blind Stick for Blind Peoples
Smart Blind Stick for Blind PeoplesSmart Blind Stick for Blind Peoples
Smart Blind Stick for Blind Peoples
Dharmaraj Morle
 
PIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTESPIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTES
Dr.YNM
 
Introduction to Node MCU
Introduction to Node MCUIntroduction to Node MCU
Introduction to Node MCU
Amarjeetsingh Thakur
 
Arduino Microcontroller
Arduino MicrocontrollerArduino Microcontroller
Arduino Microcontroller
Shyam Mohan
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the Arduino
Wingston
 
PPT ON Arduino
PPT ON Arduino PPT ON Arduino
PPT ON Arduino
Ravi Phadtare
 
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
Vishnu
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
avikdhupar
 
Op amps
Op ampsOp amps
Op amps
shalet kochumuttath Shaji
 
Ultrasonic sensor
Ultrasonic sensorUltrasonic sensor
Ultrasonic sensor
Adarsh Raj
 
Virtual Instrumentation
Virtual InstrumentationVirtual Instrumentation
Virtual Instrumentation
VinayKumar2765
 
SMART GLOVES FOR.pptx
SMART GLOVES FOR.pptxSMART GLOVES FOR.pptx
SMART GLOVES FOR.pptx
SureshPharamasivam
 
Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051
Jay Patel
 
Arduino Interfacing with different sensors and motor
Arduino Interfacing with different sensors and motorArduino Interfacing with different sensors and motor
Arduino Interfacing with different sensors and motor
Amarjeetsingh Thakur
 
RFID Based Vending Machine
RFID Based Vending MachineRFID Based Vending Machine
RFID Based Vending Machine
ijtsrd
 
Arduino presentation by_warishusain
Arduino presentation by_warishusainArduino presentation by_warishusain
Arduino presentation by_warishusain
student
 
Brain computer interface
Brain computer interfaceBrain computer interface
Brain computer interface
Koushik Veldanda
 
Schottky diode
Schottky diodeSchottky diode
Schottky diode
Rakesh kumar jha
 
microcontroller vs microprocessor
microcontroller vs microprocessormicrocontroller vs microprocessor
microcontroller vs microprocessor
sobhadevi
 
Smart Blind Stick for Blind Peoples
Smart Blind Stick for Blind PeoplesSmart Blind Stick for Blind Peoples
Smart Blind Stick for Blind Peoples
Dharmaraj Morle
 
PIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTESPIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTES
Dr.YNM
 
Arduino Microcontroller
Arduino MicrocontrollerArduino Microcontroller
Arduino Microcontroller
Shyam Mohan
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the Arduino
Wingston
 
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
Vishnu
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
avikdhupar
 
Ultrasonic sensor
Ultrasonic sensorUltrasonic sensor
Ultrasonic sensor
Adarsh Raj
 
Virtual Instrumentation
Virtual InstrumentationVirtual Instrumentation
Virtual Instrumentation
VinayKumar2765
 
Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051
Jay Patel
 
Arduino Interfacing with different sensors and motor
Arduino Interfacing with different sensors and motorArduino Interfacing with different sensors and motor
Arduino Interfacing with different sensors and motor
Amarjeetsingh Thakur
 
RFID Based Vending Machine
RFID Based Vending MachineRFID Based Vending Machine
RFID Based Vending Machine
ijtsrd
 
Arduino presentation by_warishusain
Arduino presentation by_warishusainArduino presentation by_warishusain
Arduino presentation by_warishusain
student
 

Similar to Arduino programming (20)

Lab Manual Arduino UNO Microcontrollar.docx
Lab Manual Arduino UNO Microcontrollar.docxLab Manual Arduino UNO Microcontrollar.docx
Lab Manual Arduino UNO Microcontrollar.docx
RashidFaridChishti
 
20081114 Friday Food iLabt Bart Joris
20081114 Friday Food iLabt Bart Joris20081114 Friday Food iLabt Bart Joris
20081114 Friday Food iLabt Bart Joris
imec.archive
 
Arduino by yogesh t s'
Arduino by yogesh t s'Arduino by yogesh t s'
Arduino by yogesh t s'
tsyogesh46
 
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.
 
Syed IoT - module 5
Syed  IoT - module 5Syed  IoT - module 5
Syed IoT - module 5
Syed Mustafa
 
Basics of arduino uno
Basics of arduino unoBasics of arduino uno
Basics of arduino uno
Rahat Sood
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino Microcontroller
Mujahid Hussain
 
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 اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينو
salih mahmod
 
Arduino programming
Arduino programmingArduino programming
Arduino programming
MdAshrafulAlam47
 
Introduction of Arduino Uno
Introduction of Arduino UnoIntroduction of Arduino Uno
Introduction of Arduino Uno
Md. Nahidul Islam
 
Arduino workshop
Arduino workshopArduino workshop
Arduino workshop
mayur1432
 
Intro to Arduino Programming.pdf
Intro to Arduino Programming.pdfIntro to Arduino Programming.pdf
Intro to Arduino Programming.pdf
HimanshuDon1
 
ARUDINO UNO and RasberryPi with Python
 ARUDINO UNO and RasberryPi with Python ARUDINO UNO and RasberryPi with Python
ARUDINO UNO and RasberryPi with Python
Jayanthi Kannan MK
 
Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10
stemplar
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digital
Tony Olsson.
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digital
Tony Olsson.
 
arduino
arduinoarduino
arduino
murbz
 
Arduino and Circuits.docx
Arduino and Circuits.docxArduino and Circuits.docx
Arduino and Circuits.docx
Ajay578679
 
Physical prototyping lab1-input_output (2)
Physical prototyping lab1-input_output (2)Physical prototyping lab1-input_output (2)
Physical prototyping lab1-input_output (2)
Tony Olsson.
 
Lab Manual Arduino UNO Microcontrollar.docx
Lab Manual Arduino UNO Microcontrollar.docxLab Manual Arduino UNO Microcontrollar.docx
Lab Manual Arduino UNO Microcontrollar.docx
RashidFaridChishti
 
20081114 Friday Food iLabt Bart Joris
20081114 Friday Food iLabt Bart Joris20081114 Friday Food iLabt Bart Joris
20081114 Friday Food iLabt Bart Joris
imec.archive
 
Arduino by yogesh t s'
Arduino by yogesh t s'Arduino by yogesh t s'
Arduino by yogesh t s'
tsyogesh46
 
Syed IoT - module 5
Syed  IoT - module 5Syed  IoT - module 5
Syed IoT - module 5
Syed Mustafa
 
Basics of arduino uno
Basics of arduino unoBasics of arduino uno
Basics of arduino uno
Rahat Sood
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino Microcontroller
Mujahid Hussain
 
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 اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينو
salih mahmod
 
Arduino workshop
Arduino workshopArduino workshop
Arduino workshop
mayur1432
 
Intro to Arduino Programming.pdf
Intro to Arduino Programming.pdfIntro to Arduino Programming.pdf
Intro to Arduino Programming.pdf
HimanshuDon1
 
ARUDINO UNO and RasberryPi with Python
 ARUDINO UNO and RasberryPi with Python ARUDINO UNO and RasberryPi with Python
ARUDINO UNO and RasberryPi with Python
Jayanthi Kannan MK
 
Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10
stemplar
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digital
Tony Olsson.
 
Physical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digitalPhysical prototyping lab2-analog_digital
Physical prototyping lab2-analog_digital
Tony Olsson.
 
arduino
arduinoarduino
arduino
murbz
 
Arduino and Circuits.docx
Arduino and Circuits.docxArduino and Circuits.docx
Arduino and Circuits.docx
Ajay578679
 
Physical prototyping lab1-input_output (2)
Physical prototyping lab1-input_output (2)Physical prototyping lab1-input_output (2)
Physical prototyping lab1-input_output (2)
Tony Olsson.
 
Ad

More from Siji Sunny (11)

Universal Configuration Interface
Universal Configuration InterfaceUniversal Configuration Interface
Universal Configuration Interface
Siji Sunny
 
OpenSource IoT Middleware Frameworks
OpenSource IoT Middleware FrameworksOpenSource IoT Middleware Frameworks
OpenSource IoT Middleware Frameworks
Siji Sunny
 
Vedic Sanskrit-on the way of Digitization
Vedic Sanskrit-on the way of DigitizationVedic Sanskrit-on the way of Digitization
Vedic Sanskrit-on the way of Digitization
Siji Sunny
 
Indian Language App.Development Framework for Android
Indian Language App.Development Framework for AndroidIndian Language App.Development Framework for Android
Indian Language App.Development Framework for Android
Siji Sunny
 
A deep dive into Android OpenSource Project(AOSP)
A deep dive into Android OpenSource Project(AOSP)A deep dive into Android OpenSource Project(AOSP)
A deep dive into Android OpenSource Project(AOSP)
Siji Sunny
 
Unified Text Layout Engine for FOSS Systems -Paper
Unified Text Layout Engine for FOSS Systems -PaperUnified Text Layout Engine for FOSS Systems -Paper
Unified Text Layout Engine for FOSS Systems -Paper
Siji Sunny
 
Unified Text Layout Engine for FOSS Systems
Unified Text Layout Engine for FOSS SystemsUnified Text Layout Engine for FOSS Systems
Unified Text Layout Engine for FOSS Systems
Siji Sunny
 
Android System Developement
Android System DevelopementAndroid System Developement
Android System Developement
Siji Sunny
 
Debian on ARM - Gnunify2015
Debian on ARM - Gnunify2015Debian on ARM - Gnunify2015
Debian on ARM - Gnunify2015
Siji Sunny
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
Siji Sunny
 
OpenSource Hardware -Debian Way
OpenSource Hardware -Debian WayOpenSource Hardware -Debian Way
OpenSource Hardware -Debian Way
Siji Sunny
 
Universal Configuration Interface
Universal Configuration InterfaceUniversal Configuration Interface
Universal Configuration Interface
Siji Sunny
 
OpenSource IoT Middleware Frameworks
OpenSource IoT Middleware FrameworksOpenSource IoT Middleware Frameworks
OpenSource IoT Middleware Frameworks
Siji Sunny
 
Vedic Sanskrit-on the way of Digitization
Vedic Sanskrit-on the way of DigitizationVedic Sanskrit-on the way of Digitization
Vedic Sanskrit-on the way of Digitization
Siji Sunny
 
Indian Language App.Development Framework for Android
Indian Language App.Development Framework for AndroidIndian Language App.Development Framework for Android
Indian Language App.Development Framework for Android
Siji Sunny
 
A deep dive into Android OpenSource Project(AOSP)
A deep dive into Android OpenSource Project(AOSP)A deep dive into Android OpenSource Project(AOSP)
A deep dive into Android OpenSource Project(AOSP)
Siji Sunny
 
Unified Text Layout Engine for FOSS Systems -Paper
Unified Text Layout Engine for FOSS Systems -PaperUnified Text Layout Engine for FOSS Systems -Paper
Unified Text Layout Engine for FOSS Systems -Paper
Siji Sunny
 
Unified Text Layout Engine for FOSS Systems
Unified Text Layout Engine for FOSS SystemsUnified Text Layout Engine for FOSS Systems
Unified Text Layout Engine for FOSS Systems
Siji Sunny
 
Android System Developement
Android System DevelopementAndroid System Developement
Android System Developement
Siji Sunny
 
Debian on ARM - Gnunify2015
Debian on ARM - Gnunify2015Debian on ARM - Gnunify2015
Debian on ARM - Gnunify2015
Siji Sunny
 
OpenSource Hardware -Debian Way
OpenSource Hardware -Debian WayOpenSource Hardware -Debian Way
OpenSource Hardware -Debian Way
Siji Sunny
 
Ad

Recently uploaded (20)

New Microsoft Office Word Documentfrf.docx
New Microsoft Office Word Documentfrf.docxNew Microsoft Office Word Documentfrf.docx
New Microsoft Office Word Documentfrf.docx
misheetasah
 
ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025
Rahul
 
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) ProjectMontreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Alexandra N. Martinez
 
3. What is the principles of Teamwork_Module_V1.0.ppt
3. What is the principles of Teamwork_Module_V1.0.ppt3. What is the principles of Teamwork_Module_V1.0.ppt
3. What is the principles of Teamwork_Module_V1.0.ppt
engaash9
 
Computer_vision-photometric_image_formation.pdf
Computer_vision-photometric_image_formation.pdfComputer_vision-photometric_image_formation.pdf
Computer_vision-photometric_image_formation.pdf
kumarprem6767merp
 
Rigor, ethics, wellbeing and resilience in the ICT doctoral journey
Rigor, ethics, wellbeing and resilience in the ICT doctoral journeyRigor, ethics, wellbeing and resilience in the ICT doctoral journey
Rigor, ethics, wellbeing and resilience in the ICT doctoral journey
Yannis
 
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODSWIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
samueljackson3773
 
IntroSlides-June-GDG-Cloud-Munich community [email protected]
IntroSlides-June-GDG-Cloud-Munich community gathering@Netlight.pdfIntroSlides-June-GDG-Cloud-Munich community gathering@Netlight.pdf
IntroSlides-June-GDG-Cloud-Munich community [email protected]
Luiz Carneiro
 
Strength of materials (Thermal stress and strain relationships)
Strength of materials (Thermal stress and strain relationships)Strength of materials (Thermal stress and strain relationships)
Strength of materials (Thermal stress and strain relationships)
pelumiadigun2006
 
chemistry investigatory project for class 12
chemistry investigatory project for class 12chemistry investigatory project for class 12
chemistry investigatory project for class 12
Susis10
 
社内勉強会資料_Chain of Thought .
社内勉強会資料_Chain of Thought                           .社内勉強会資料_Chain of Thought                           .
社内勉強会資料_Chain of Thought .
NABLAS株式会社
 
Flow Chart Proses Bisnis prosscesss.docx
Flow Chart Proses Bisnis prosscesss.docxFlow Chart Proses Bisnis prosscesss.docx
Flow Chart Proses Bisnis prosscesss.docx
rifka575530
 
Rearchitecturing a 9-year-old legacy Laravel application.pdf
Rearchitecturing a 9-year-old legacy Laravel application.pdfRearchitecturing a 9-year-old legacy Laravel application.pdf
Rearchitecturing a 9-year-old legacy Laravel application.pdf
Takumi Amitani
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
Irja Straus - Beyond Pass and Fail - DevTalks.pdf
Irja Straus - Beyond Pass and Fail - DevTalks.pdfIrja Straus - Beyond Pass and Fail - DevTalks.pdf
Irja Straus - Beyond Pass and Fail - DevTalks.pdf
Irja Straus
 
Introduction to AI agent development with MCP
Introduction to AI agent development with MCPIntroduction to AI agent development with MCP
Introduction to AI agent development with MCP
Dori Waldman
 
David Boutry - Mentors Junior Developers
David Boutry - Mentors Junior DevelopersDavid Boutry - Mentors Junior Developers
David Boutry - Mentors Junior Developers
David Boutry
 
A DECISION SUPPORT SYSTEM FOR ESTIMATING COST OF SOFTWARE PROJECTS USING A HY...
A DECISION SUPPORT SYSTEM FOR ESTIMATING COST OF SOFTWARE PROJECTS USING A HY...A DECISION SUPPORT SYSTEM FOR ESTIMATING COST OF SOFTWARE PROJECTS USING A HY...
A DECISION SUPPORT SYSTEM FOR ESTIMATING COST OF SOFTWARE PROJECTS USING A HY...
ijfcstjournal
 
SEW make Brake BE05 – BE30 Brake – Repair Kit
SEW make Brake BE05 – BE30 Brake – Repair KitSEW make Brake BE05 – BE30 Brake – Repair Kit
SEW make Brake BE05 – BE30 Brake – Repair Kit
projectultramechanix
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
djiceramil
 
New Microsoft Office Word Documentfrf.docx
New Microsoft Office Word Documentfrf.docxNew Microsoft Office Word Documentfrf.docx
New Microsoft Office Word Documentfrf.docx
misheetasah
 
ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025
Rahul
 
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) ProjectMontreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Montreal Dreamin' 25 - Introduction to the MuleSoft AI Chain (MAC) Project
Alexandra N. Martinez
 
3. What is the principles of Teamwork_Module_V1.0.ppt
3. What is the principles of Teamwork_Module_V1.0.ppt3. What is the principles of Teamwork_Module_V1.0.ppt
3. What is the principles of Teamwork_Module_V1.0.ppt
engaash9
 
Computer_vision-photometric_image_formation.pdf
Computer_vision-photometric_image_formation.pdfComputer_vision-photometric_image_formation.pdf
Computer_vision-photometric_image_formation.pdf
kumarprem6767merp
 
Rigor, ethics, wellbeing and resilience in the ICT doctoral journey
Rigor, ethics, wellbeing and resilience in the ICT doctoral journeyRigor, ethics, wellbeing and resilience in the ICT doctoral journey
Rigor, ethics, wellbeing and resilience in the ICT doctoral journey
Yannis
 
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODSWIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
WIRELESS COMMUNICATION SECURITY AND IT’S PROTECTION METHODS
samueljackson3773
 
Strength of materials (Thermal stress and strain relationships)
Strength of materials (Thermal stress and strain relationships)Strength of materials (Thermal stress and strain relationships)
Strength of materials (Thermal stress and strain relationships)
pelumiadigun2006
 
chemistry investigatory project for class 12
chemistry investigatory project for class 12chemistry investigatory project for class 12
chemistry investigatory project for class 12
Susis10
 
社内勉強会資料_Chain of Thought .
社内勉強会資料_Chain of Thought                           .社内勉強会資料_Chain of Thought                           .
社内勉強会資料_Chain of Thought .
NABLAS株式会社
 
Flow Chart Proses Bisnis prosscesss.docx
Flow Chart Proses Bisnis prosscesss.docxFlow Chart Proses Bisnis prosscesss.docx
Flow Chart Proses Bisnis prosscesss.docx
rifka575530
 
Rearchitecturing a 9-year-old legacy Laravel application.pdf
Rearchitecturing a 9-year-old legacy Laravel application.pdfRearchitecturing a 9-year-old legacy Laravel application.pdf
Rearchitecturing a 9-year-old legacy Laravel application.pdf
Takumi Amitani
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
362 Alec Data Center Solutions-Slysium Data Center-AUH-Adaptaflex.pdf
djiceramil
 
Irja Straus - Beyond Pass and Fail - DevTalks.pdf
Irja Straus - Beyond Pass and Fail - DevTalks.pdfIrja Straus - Beyond Pass and Fail - DevTalks.pdf
Irja Straus - Beyond Pass and Fail - DevTalks.pdf
Irja Straus
 
Introduction to AI agent development with MCP
Introduction to AI agent development with MCPIntroduction to AI agent development with MCP
Introduction to AI agent development with MCP
Dori Waldman
 
David Boutry - Mentors Junior Developers
David Boutry - Mentors Junior DevelopersDavid Boutry - Mentors Junior Developers
David Boutry - Mentors Junior Developers
David Boutry
 
A DECISION SUPPORT SYSTEM FOR ESTIMATING COST OF SOFTWARE PROJECTS USING A HY...
A DECISION SUPPORT SYSTEM FOR ESTIMATING COST OF SOFTWARE PROJECTS USING A HY...A DECISION SUPPORT SYSTEM FOR ESTIMATING COST OF SOFTWARE PROJECTS USING A HY...
A DECISION SUPPORT SYSTEM FOR ESTIMATING COST OF SOFTWARE PROJECTS USING A HY...
ijfcstjournal
 
SEW make Brake BE05 – BE30 Brake – Repair Kit
SEW make Brake BE05 – BE30 Brake – Repair KitSEW make Brake BE05 – BE30 Brake – Repair Kit
SEW make Brake BE05 – BE30 Brake – Repair Kit
projectultramechanix
 
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
362 Alec Data Center Solutions-Slysium Data Center-AUH-Glands & Lugs, Simplex...
djiceramil
 

Arduino programming

  • 1. • Introduction to Arduino • UNO Overview • Programming Basics • Arduino Libraires l Siji Sunny [email protected] Arduino Programming (For Beginners)
  • 2. WHAT IS ARDUINO (C) MELabs (Mobile Embedded Labs Pvt.Ltd)  The Arduino project started in 2003 as a program for students at the Interaction Design Institute Ivrea in Ivrea, Italy  Open Source Hardware and Software Platform  single-board microcontroller  Allows to building digital devices and interactive objects that can sense and control objects in the physical world.
  • 3. DEVELOPMENT ENVIRONMENT (C) MELabs (Mobile Embedded Labs Pvt.Ltd)  The Arduino Uno can be programmed with the Arduino software  IDE(integrated development environment)  The Atmega328 on the Arduino Uno comes preburned with a Bootloader that allows you to upload new code to it without the use of an external hardware programmer.  You can also bypass the Bootloader and program the microcontroller through the ICSP (In-Circuit Serial Programming) header.
  • 4. Arduino UNO (C) MELabs (Mobile Embedded Labs Pvt.Ltd)
  • 5. UNO SPECIFCATION (C) MELabs (Mobile Embedded Labs Pvt.Ltd) ● The Arduino Uno can be programmed with the Arduino software ● Microcontroller – Atmega328 ● Operating Voltage 5V and 3.3 V ● Digital I/O Pins -14 ● Analog Input Pins 6 ● Flash Memory 32 KB (ATmega328) of which 0.5 KB used by Bootloader ● SRAM – 2KB ● EEPROM -1KB
  • 6. MEMORY/STORAGE (C) MELabs (Mobile Embedded Labs Pvt.Ltd)  There are three pools of memory in the microcontroller used on avr-based Arduino boards :  Flash memory (program space), is where the Arduino sketch is stored.  SRAM (static random access memory) is where the sketch creates and manipulates variables when it runs.  EEPROM is memory space that programmers can use to store long-term information.  Flash memory and EEPROM memory are non-volatile (the information persists after the power is turned off). SRAM is volatile and will be lost when the power is cycled.
  • 7. ARDUINO PROGRAMMING -GLOSSARY (C) MELabs (Mobile Embedded Labs Pvt.Ltd) ● Sketch – Program that runs on the board ● Pin – Input or Output connected to something – Eg: Output to an LED input to an Switch ● Digital – 1 (high) or 0 (Low) -ON/OFF ● Analog – Range 0-255 (Led brightness) ● Arduino IDE – Comes with C/C++ lib named as Wiring ● Programs are written in C & C++ but only having two funtcions - Setup() - Called once at the start of program, works as initialiser Loop() - Called repeatedly until the board is powered-off
  • 8. SKETCH (C) MELabs (Mobile Embedded Labs Pvt.Ltd) Global Variables setup() loop() Variable Declaration Initialise loop C++ Lib C/C++ Readable Code C/C++ Readable Code Assembly Readable Code Machine Language
  • 9. SKETCH -setup()/loop() (C) MELabs (Mobile Embedded Labs Pvt.Ltd) setup() pinMode() - set pin as input or output serialBegin() - Set to talk to the computer loop() digitalWrite() - set digital pin as high/low digtialRead() -read a digital pin state wait()- wait an amount of time
  • 10. SKETCH -Example (C) MELabs (Mobile Embedded Labs Pvt.Ltd) // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }
  • 11. For Statement -example (C) MELabs (Mobile Embedded Labs Pvt.Ltd) // Dim an LED using a PWM pin int PWMpin = 10; // LED in series with 470 ohm resistor on pin 10 void setup() { // no setup needed } void loop() { for (int i=0; i <= 255; i++) { analogWrite(PWMpin, i); //Writes an analog value (PWM wave) to a pin. Can be used to light a LED at varying brightnesses or drive a motor at various speeds delay(10); } }
  • 12. If --- else MELabs (Mobile Embedded Labs Pvt.Ltd) The if statement checks for a condition and executes the proceeding statement or set of statements if the condition is 'true'. Syntax if (condition) { //statement(s) } Parameters condition: a boolean expression i.e., can be true or false
  • 13. Switch/Case statements MELabs (Mobile Embedded Labs Pvt.Ltd) switch (var) { case 1: //do something when var equals 1 break; case 2: //do something when var equals 2 break; default: // if nothing else matches, do the default // default is optional }
  • 14. For Statement (C) MELabs (Mobile Embedded Labs Pvt.Ltd)  The for statement is used to repeat a block of statements enclosed in curly braces.  An increment counter is usually used to increment and terminate the loop.  The for statement is useful for any repetitive operation, and is often used in combination with arrays to operate on collections of data/pins. for (initialization; condition; increment) { //statement(s); }
  • 15. For Statement -example (C) MELabs (Mobile Embedded Labs Pvt.Ltd) // Dim an LED using a PWM pin int PWMpin = 10; // LED in series with 470 ohm resistor on pin 10 void setup() { // no setup needed } void loop() { for (int i=0; i <= 255; i++) { analogWrite(PWMpin, i); //Writes an analog value (PWM wave) to a pin. Can be used to light a LED at varying brightnesses or drive a motor at various speeds delay(10); } }
  • 16. while statement (C) MELabs (Mobile Embedded Labs Pvt.Ltd) A while loop will loop continuously, and infinitely, until the expression inside the parenthesis, () becomes false. while(condition){ // statement(s) } Example : var = 0; while(var < 200){ // do something repetitive 200 times var++; }
  • 17. Do – While statement (C) MELabs (Mobile Embedded Labs Pvt.Ltd) The do…while loop works in the same manner as the while loop, with the exception that the condition is tested at the end of the loop, so the do loop will always run at least once. do { // statement block } while (condition); Example - do { delay(50); // wait for sensors to stabilize x = readSensors(); // check the sensors } while (x < 100);
  • 18. Data Types (C) MELabs (Mobile Embedded Labs Pvt.Ltd) ● Integers, booleans, and characters ● Float: Data type for floating point numbers (those with a decimal point). They can range from 3.4028235E+38 down to -3.4028235E+38. Stored as 32 bits (4 bytes). ● Long: Data type for larger numbers, from -2,147,483,648 to 2,147,483,647, and store 32 bits (4 bytes) of information. ● String: On the Arduino, there are really two kinds of strings: strings (with a lower case s )ʻ ʼ can be created as an array of characters (of type char). String (with a capital S ), is a Stringʻ ʼ type object. Char stringArray[10] = “isdi”; String stringObject = String(“isdi”); The advantage of the second method (using the String object) is that it allows you to use a number of built-in methods, such as length(), replace(), and equals().
  • 19. ARDUINO -Libraries (C) MELabs (Mobile Embedded Labs Pvt.Ltd) Libraries provide extra functionality for use in sketches, e.g. working with hardware or manipulating data. To use a library in a sketch. select it from Sketch > Import Library.
  • 20. Standard Libraries (C) MELabs (Mobile Embedded Labs Pvt.Ltd)  EEPROM - reading and writing to "permanent" storage   Ethernet / Ethernet 2 - for connecting to the internet using the Arduino Ethernet Shield, Arduino Ethernet Shield 2 and Arduino Leonardo ETH   Firmata - for communicating with applications on the computer using a standard serial protocol.   GSM - for connecting to a GSM/GRPS network with the GSM shield.   LiquidCrystal - for controlling liquid crystal displays (LCDs)   SD - for reading and writing SD cards   Servo - for controlling servo motors   SPI - for communicating with devices using the Serial Peripheral Interface (SPI) Bus   Stepper - for controlling stepper motors   TFT - for drawing text , images, and shapes on the Arduino TFT screen   WiFi - for connecting to the internet using the Arduino WiFi shield