SlideShare a Scribd company logo
THE ARDUINO PLATFORM
AND C PROGRAMMING
PRESENTED BYPRESENTED BY
GOVIND JHAGOVIND JHA
What is Arduino?
A microcontroller board, contains on-board power supply, USB port to communicate
with PC, and an Atmel microcontroller chip.
It simplify the process of creating any control system by providing the standard board
that can be programmed and connected to the system without the need to any
sophisticated PCB design and implementation.
It is an open source hardware, any one can get the details of its design and modify it
or make his own one himself.
Arduino Development BoardArduino Development Board
• Eight bit microcontroller – brain of the boardEight bit microcontroller – brain of the board
• USB Port – to communicate with theUSB Port – to communicate with the
desktop/laptopdesktop/laptop
• USB controller chip – manages USB transferredUSB controller chip – manages USB transferred
datadata
• IO pins – board’s connection to the outside worldIO pins – board’s connection to the outside world
• Quartz oscillator – board’s time keeperQuartz oscillator – board’s time keeper
• Reset button – taking the board back to its initialReset button – taking the board back to its initial
statestate
• External power jack – power from dedicatedExternal power jack – power from dedicated
sourcesource
Co-axial jack, but USB can also be used.Co-axial jack, but USB can also be used.
Arduino UNO:Arduino UNO:
Digital output
~: PWM.
0,1: Serial port.
In circuit Serial
programming
Atmel
MicroController
Analog input.Power Supply
USB port
Power input
Input/output Pins (I/OPins)Input/output Pins (I/OPins)
• Top and bottom rows of the boardTop and bottom rows of the board
• Holes in the board which we can stick wires inHoles in the board which we can stick wires in
• Holes are connected to the chips through traces on-boardHoles are connected to the chips through traces on-board
• 14 Digital I/O pins on top [0-13]14 Digital I/O pins on top [0-13]
• Highs – 5 voltsHighs – 5 volts Lows – 0 voltsLows – 0 volts
Max Current - 40 mAMax Current - 40 mA
• 6 Analog input pins on the bottom [A0 – A5]6 Analog input pins on the bottom [A0 – A5]
• Power output pins on the bottom [ 5v , 3.3 v ]Power output pins on the bottom [ 5v , 3.3 v ]
• Reset pin to reset the board to initial state.Reset pin to reset the board to initial state.
MicrocontrollersMicrocontrollers
• Two microcontrollers on the boardTwo microcontrollers on the board
• Main ATmega328 – 8 bit microcontrollerMain ATmega328 – 8 bit microcontroller
• User programmable, runs user-written application codeUser programmable, runs user-written application code
Carries firmware, like bootloaderCarries firmware, like bootloader
• ATmega16U2ATmega16U2
• Handles the communication with the USB interface, notHandles the communication with the USB interface, not
directly accessibledirectly accessible
Storage and MemoryStorage and Memory
•Non-volatile flash memory for storageNon-volatile flash memory for storage
•32 kilobytes in size32 kilobytes in size
•Static Random Access Memory (SRAM) for memoryStatic Random Access Memory (SRAM) for memory
(volatile)(volatile)
•3 kilobytes in size3 kilobytes in size
ClockClock
• 16 MHz clock speed ~ 16 million operations per16 MHz clock speed ~ 16 million operations per
secondsecond
• Helps synchronize all components togetherHelps synchronize all components together
• Keeping track of occurrence of eventsKeeping track of occurrence of events
Programming FirmwareProgramming Firmware
• The ISCP headers can be used to program theThe ISCP headers can be used to program the
firmware on the boardfirmware on the board
• ICSP1 for the main ATmega328 microcontrollerICSP1 for the main ATmega328 microcontroller
• ICSP2 for the ATmega16U2 microcontrollerICSP2 for the ATmega16U2 microcontroller
• Special equipment are required in order to re-Special equipment are required in order to re-
program the firmware through these headersprogram the firmware through these headers
Software EnvironmentSoftware Environment
• Arduino IDE – Integrated Development EnvironmentArduino IDE – Integrated Development Environment
• Can be programmed using other IDEs too, like EclipseCan be programmed using other IDEs too, like Eclipse
• Arduino IDE is more versatileArduino IDE is more versatile
• Needs no special drivers or additional componentsNeeds no special drivers or additional components
• Available for Windows, Linux and MacAvailable for Windows, Linux and Mac
• Cross compiler – compiles for a different target platform than the one beingCross compiler – compiles for a different target platform than the one being
programmed onprogrammed on
IDE – Software Tool forIDE – Software Tool for
ProgrammingProgramming
• File operations and other general options on topFile operations and other general options on top
• Buttons for most commonly used options (Verify, Upload,Buttons for most commonly used options (Verify, Upload,
etc.)etc.)
• Main window – Text editor for writing codeMain window – Text editor for writing code
• Message area – for messages to the programmerMessage area – for messages to the programmer
Options ButtonsOptions Buttons
Buttons on the top have the most common ,useful operationsButtons on the top have the most common ,useful operations
Verify – compiles the code and checks for errorsVerify – compiles the code and checks for errors
Uploads – compiles the code, uploads it to the board. Works only ifUploads – compiles the code, uploads it to the board. Works only if
the board is connectedthe board is connected
New – creates a new sketch, a new programNew – creates a new sketch, a new program
Open – opens an existing sketchOpen – opens an existing sketch
Save – saves the current sketch in the directory of your choiceSave – saves the current sketch in the directory of your choice
Serial Monitor – opens window to communicate with the boardSerial Monitor – opens window to communicate with the board
Arduino ShieldsArduino Shields
• The prominent reason that Arduino got so popularThe prominent reason that Arduino got so popular
• Additional hardware to do particular, complex tasksAdditional hardware to do particular, complex tasks
• Form of separate boardsForm of separate boards
• Pre-wired pins that stick into holes in ArduinoPre-wired pins that stick into holes in Arduino
• Stack on top of the Arduino to make connectionsStack on top of the Arduino to make connections
• Pre-written functions for operations of these boardsPre-written functions for operations of these boards
• Open-source designs in most of the cases, third partyOpen-source designs in most of the cases, third party
•
• IntegerInteger: used with integer variables with value between
2147483647 and -2147483647.
Ex: int x=1200;
• CharacterCharacter: used with single character, represent value from -127 to
128.
Ex. char c=‘r’;
• LongLong: Long variables are extended size variables for number
storage, and store 32 bits (4 bytes), from -2,147,483,648 to
2,147,483,647.
Ex. long u=199203;
• Floating-point:Floating-point: Numbers can be as large as 3.4028235E+38 and
as low as -3.4028235E+38. They are stored as 32 bits (4 bytes) of
information.
Ex. float num=1.291; [The same as doubledouble type]
Data Types and OperatorsData Types and Operators
Statement represents a command, it ends with ;;
Ex:
int x;
x=13;
Operators are symbols that used to indicate a specific function:
- Math operators: [+,-,* ,/,%,^+,-,* ,/,%,^]
- Logic operators: [==, !=, &&, ||==, !=, &&, ||]
- Comparison operators: [==, >, <, !=, <=, >===, >, <, !=, <=, >=]
Syntax:
;; Semicolon, {}{} curly braces, ////single line comment, /*/* Multi-line
co m m e nts * /* /
Statement and OperatorsStatement and Operators
Compound Operators:Compound Operators:
++ (increment)
-- (decrement)
+= (compound addition)
-= (compound subtraction)
*= (compound multiplication)
/= (compound division)
Statement and OperatorsStatement and Operators
If Conditioning:If Conditioning:
if(co nditio n)
{
state m e nts-1 ;
…
State m e nt-N;
}
else if(co nditio n2 )
{
State m e nts;
}
Else{state m e nts ;}
Control StatementsControl Statements
Switch case:Switch case:
switch (var) {
case 1 :
//do so m e thing whe n var e q uals 1
bre ak;
case 2:
//do so m e thing whe n var e q uals 2
bre ak;
de fault:
// if no thing e lse m atche s, do the de fault
// de fault is o ptio nal
}
Control StatementsControl Statements
Do… while:Do… while:
do
{
Statements;
}
while(condition); // the statements are run at least once.
While:While:
While(condition)
{statements;}
forfor
for (int i=0; i <= val; i++){
statements;
}
Loop StatementsLoop Statements
Void setup(){}Void setup(){}
Used to indicate the initial values of system on starting.
Void loop(){}Void loop(){}
Contains the statements that will run whenever the system is powered
after setup.
Code StructureCode Structure
Arduino Tool chainArduino Tool chain
• Steps taken post code authoringSteps taken post code authoring
• Source code(sketch) is compiled to an executableSource code(sketch) is compiled to an executable
formatformat
• Executable file is linked with libraries and interpretedExecutable file is linked with libraries and interpreted
into a hex fileinto a hex file
• Hex file is uploaded to boardHex file is uploaded to board
• Starts executing right awayStarts executing right away
Cross CompilationCross Compilation
• Compile on one machine, but the target is another machine.Compile on one machine, but the target is another machine.
E.g.: compiling it on an Intel processor, compiling it for anE.g.: compiling it on an Intel processor, compiling it for an
AVR processorAVR processor
• avr-gcc – C compiler for AVR targets, gives a *.o fileavr-gcc – C compiler for AVR targets, gives a *.o file
• avr-lnk – links library object files, results in a *.elf fileavr-lnk – links library object files, results in a *.elf file
• avr-objcopy – change the *.elf file into Arduino compatible *.hexavr-objcopy – change the *.elf file into Arduino compatible *.hex
filefile
Running IDE on WindowsRunning IDE on Windows
• Emacs or NotePad++ text editorEmacs or NotePad++ text editor
• Gcc C compilerGcc C compiler
• The debugger, gdbThe debugger, gdb
• IDE provides one-stop solutionIDE provides one-stop solution
BlinkLEDExampleBlinkLEDExample
• Pin 13 is represented by numeral 13Pin 13 is represented by numeral 13
• digitalWrite() writes voltage values todigitalWrite() writes voltage values to
pinspins
• delay() sets delays in millisecondsdelay() sets delays in milliseconds
• HIGH – 5vHIGH – 5v LOW – 0vLOW – 0v
THE ENDTHE ENDTHANK YOUTHANK YOU

More Related Content

What's hot (20)

Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduino
Ahmed Sakr
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
Green Moon Solutions
 
Arduino and c programming
Arduino and c programmingArduino and c programming
Arduino and c programming
Punit Goswami
 
Arduino uno
Arduino unoArduino uno
Arduino uno
creatjet3d labs
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
Yong Heui Cho
 
RISC - Reduced Instruction Set Computing
RISC - Reduced Instruction Set ComputingRISC - Reduced Instruction Set Computing
RISC - Reduced Instruction Set Computing
Tushar Swami
 
Introduction to Arduino Hardware and Programming
Introduction to Arduino Hardware and ProgrammingIntroduction to Arduino Hardware and Programming
Introduction to Arduino Hardware and Programming
Emmanuel Obot
 
Arduino Uno Pin Description
Arduino Uno Pin DescriptionArduino Uno Pin Description
Arduino Uno Pin Description
Niket Chandrawanshi
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
avikdhupar
 
arduino-ppt
 arduino-ppt arduino-ppt
arduino-ppt
jhcid
 
Arduino: On-board components description, IDE and Programming
Arduino: On-board components description, IDE and Programming Arduino: On-board components description, IDE and Programming
Arduino: On-board components description, IDE and Programming
Pawan Dubey, PhD
 
Introduction to Microcontroller
Introduction to MicrocontrollerIntroduction to Microcontroller
Introduction to Microcontroller
Pantech ProLabs India Pvt Ltd
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduino
Jawaher Abdulwahab Fadhil
 
Introduction to Arduino and Hands on to Iot
Introduction to Arduino and Hands on to IotIntroduction to Arduino and Hands on to Iot
Introduction to Arduino and Hands on to Iot
Sachin S
 
8051 Addressing Modes
8051 Addressing Modes8051 Addressing Modes
8051 Addressing Modes
Senthil Kumar
 
Ardui no
Ardui no Ardui no
Ardui no
Amol Sakhalkar
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
Richard Rixham
 
PPT ON Arduino
PPT ON Arduino PPT ON Arduino
PPT ON Arduino
Ravi Phadtare
 
Arduino- Serial communication
Arduino-  Serial communicationArduino-  Serial communication
Arduino- Serial communication
Jawaher Abdulwahab Fadhil
 
MICROCONTROLLER 8051- Architecture & Pin Configuration
MICROCONTROLLER 8051- Architecture & Pin Configuration MICROCONTROLLER 8051- Architecture & Pin Configuration
MICROCONTROLLER 8051- Architecture & Pin Configuration
AKHIL MADANKAR
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduino
Ahmed Sakr
 
Arduino and c programming
Arduino and c programmingArduino and c programming
Arduino and c programming
Punit Goswami
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
Yong Heui Cho
 
RISC - Reduced Instruction Set Computing
RISC - Reduced Instruction Set ComputingRISC - Reduced Instruction Set Computing
RISC - Reduced Instruction Set Computing
Tushar Swami
 
Introduction to Arduino Hardware and Programming
Introduction to Arduino Hardware and ProgrammingIntroduction to Arduino Hardware and Programming
Introduction to Arduino Hardware and Programming
Emmanuel Obot
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
avikdhupar
 
arduino-ppt
 arduino-ppt arduino-ppt
arduino-ppt
jhcid
 
Arduino: On-board components description, IDE and Programming
Arduino: On-board components description, IDE and Programming Arduino: On-board components description, IDE and Programming
Arduino: On-board components description, IDE and Programming
Pawan Dubey, PhD
 
Introduction to Arduino and Hands on to Iot
Introduction to Arduino and Hands on to IotIntroduction to Arduino and Hands on to Iot
Introduction to Arduino and Hands on to Iot
Sachin S
 
8051 Addressing Modes
8051 Addressing Modes8051 Addressing Modes
8051 Addressing Modes
Senthil Kumar
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
Richard Rixham
 
MICROCONTROLLER 8051- Architecture & Pin Configuration
MICROCONTROLLER 8051- Architecture & Pin Configuration MICROCONTROLLER 8051- Architecture & Pin Configuration
MICROCONTROLLER 8051- Architecture & Pin Configuration
AKHIL MADANKAR
 

Similar to Arduino Platform with C programming. (20)

Arduino by yogesh t s'
Arduino by yogesh t s'Arduino by yogesh t s'
Arduino by yogesh t s'
tsyogesh46
 
introductiontoarduino-111120102058-phpapp02.pdf
introductiontoarduino-111120102058-phpapp02.pdfintroductiontoarduino-111120102058-phpapp02.pdf
introductiontoarduino-111120102058-phpapp02.pdf
HebaEng
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the Arduino
Wingston
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
Damien Magoni
 
aurduino-200107075953.pdf
aurduino-200107075953.pdfaurduino-200107075953.pdf
aurduino-200107075953.pdf
HebaEng
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino Microcontroller
Mujahid Hussain
 
Q2 Arduino Draft Q2 Arduino Draft Q2 Arduino Draft
Q2 Arduino Draft Q2 Arduino Draft Q2 Arduino DraftQ2 Arduino Draft Q2 Arduino Draft Q2 Arduino Draft
Q2 Arduino Draft Q2 Arduino Draft Q2 Arduino Draft
Kameshvra Dela Cruz
 
Introduction of Arduino Uno
Introduction of Arduino UnoIntroduction of Arduino Uno
Introduction of Arduino Uno
Md. Nahidul Islam
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
MasudurRahmanSourav
 
arduino
arduinoarduino
arduino
murbz
 
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
 
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.
 
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: Arduino starter kit
Arduino: Arduino starter kitArduino: Arduino starter kit
Arduino: Arduino starter kit
SANTIAGO PABLO ALBERTO
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
baabtra.com - No. 1 supplier of quality freshers
 
arduino
arduinoarduino
arduino
guesta10525
 
Lesson-4-Arduino-Programming-dsBasics.pdf
Lesson-4-Arduino-Programming-dsBasics.pdfLesson-4-Arduino-Programming-dsBasics.pdf
Lesson-4-Arduino-Programming-dsBasics.pdf
unicaeli2020
 
arduinoworkshop-160204051621.pdf
arduinoworkshop-160204051621.pdfarduinoworkshop-160204051621.pdf
arduinoworkshop-160204051621.pdf
AbdErrezakChahoub
 
Micro_Controllers_lab1_Intro_to_Arduino.pptx
Micro_Controllers_lab1_Intro_to_Arduino.pptxMicro_Controllers_lab1_Intro_to_Arduino.pptx
Micro_Controllers_lab1_Intro_to_Arduino.pptx
Gaser4
 
Arduino experimenters guide ARDX
Arduino experimenters guide ARDXArduino experimenters guide ARDX
Arduino experimenters guide ARDX
Johnny Parrales
 
Arduino by yogesh t s'
Arduino by yogesh t s'Arduino by yogesh t s'
Arduino by yogesh t s'
tsyogesh46
 
introductiontoarduino-111120102058-phpapp02.pdf
introductiontoarduino-111120102058-phpapp02.pdfintroductiontoarduino-111120102058-phpapp02.pdf
introductiontoarduino-111120102058-phpapp02.pdf
HebaEng
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the Arduino
Wingston
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
Damien Magoni
 
aurduino-200107075953.pdf
aurduino-200107075953.pdfaurduino-200107075953.pdf
aurduino-200107075953.pdf
HebaEng
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino Microcontroller
Mujahid Hussain
 
Q2 Arduino Draft Q2 Arduino Draft Q2 Arduino Draft
Q2 Arduino Draft Q2 Arduino Draft Q2 Arduino DraftQ2 Arduino Draft Q2 Arduino Draft Q2 Arduino Draft
Q2 Arduino Draft Q2 Arduino Draft Q2 Arduino Draft
Kameshvra Dela Cruz
 
arduino
arduinoarduino
arduino
murbz
 
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
 
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.
 
Ch_2_8,9,10.pptx
Ch_2_8,9,10.pptxCh_2_8,9,10.pptx
Ch_2_8,9,10.pptx
yosikit826
 
Lesson-4-Arduino-Programming-dsBasics.pdf
Lesson-4-Arduino-Programming-dsBasics.pdfLesson-4-Arduino-Programming-dsBasics.pdf
Lesson-4-Arduino-Programming-dsBasics.pdf
unicaeli2020
 
arduinoworkshop-160204051621.pdf
arduinoworkshop-160204051621.pdfarduinoworkshop-160204051621.pdf
arduinoworkshop-160204051621.pdf
AbdErrezakChahoub
 
Micro_Controllers_lab1_Intro_to_Arduino.pptx
Micro_Controllers_lab1_Intro_to_Arduino.pptxMicro_Controllers_lab1_Intro_to_Arduino.pptx
Micro_Controllers_lab1_Intro_to_Arduino.pptx
Gaser4
 
Arduino experimenters guide ARDX
Arduino experimenters guide ARDXArduino experimenters guide ARDX
Arduino experimenters guide ARDX
Johnny Parrales
 
Ad

Recently uploaded (20)

FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptxFINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
kippcam
 
Water demand - Types , variations and WDS
Water demand - Types , variations and WDSWater demand - Types , variations and WDS
Water demand - Types , variations and WDS
dhanashree78
 
COMPOSITE COLUMN IN STEEL CONCRETE COMPOSITES.ppt
COMPOSITE COLUMN IN STEEL CONCRETE COMPOSITES.pptCOMPOSITE COLUMN IN STEEL CONCRETE COMPOSITES.ppt
COMPOSITE COLUMN IN STEEL CONCRETE COMPOSITES.ppt
ravicivil
 
First Come First Serve Scheduling in real time operating system.pptx
First Come First Serve Scheduling in real time operating system.pptxFirst Come First Serve Scheduling in real time operating system.pptx
First Come First Serve Scheduling in real time operating system.pptx
KavitaBagewadi2
 
Tree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbb
Tree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbbTree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbb
Tree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbb
RATNANITINPATIL
 
operationg systemsdocumentmemorymanagement
operationg systemsdocumentmemorymanagementoperationg systemsdocumentmemorymanagement
operationg systemsdocumentmemorymanagement
SNIGDHAAPPANABHOTLA
 
Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...
Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...
Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...
João Esperancinha
 
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
 
NALCO Green Anode Plant,Compositions of CPC,Pitch
NALCO Green Anode Plant,Compositions of CPC,PitchNALCO Green Anode Plant,Compositions of CPC,Pitch
NALCO Green Anode Plant,Compositions of CPC,Pitch
arpitprachi123
 
22PCOAM16 _ML_Unit 3 Notes & Question bank
22PCOAM16 _ML_Unit 3 Notes & Question bank22PCOAM16 _ML_Unit 3 Notes & Question bank
22PCOAM16 _ML_Unit 3 Notes & Question bank
Guru Nanak Technical Institutions
 
Pavement and its types, Application of rigid and Flexible Pavements
Pavement and its types, Application of rigid and Flexible PavementsPavement and its types, Application of rigid and Flexible Pavements
Pavement and its types, Application of rigid and Flexible Pavements
Sakthivel M
 
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
 
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
 
最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制
最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制
最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制
Taqyea
 
OCS Group SG - HPHT Well Design and Operation - SN.pdf
OCS Group SG - HPHT Well Design and Operation - SN.pdfOCS Group SG - HPHT Well Design and Operation - SN.pdf
OCS Group SG - HPHT Well Design and Operation - SN.pdf
Muanisa Waras
 
Universal Human Values and professional ethics Quantum AKTU BVE401
Universal Human Values and professional ethics Quantum AKTU BVE401Universal Human Values and professional ethics Quantum AKTU BVE401
Universal Human Values and professional ethics Quantum AKTU BVE401
Unknown
 
grade 9 science q1 quiz.pptx science quiz
grade 9 science q1 quiz.pptx science quizgrade 9 science q1 quiz.pptx science quiz
grade 9 science q1 quiz.pptx science quiz
norfapangolima
 
Présentation_gestion[1] [Autosaved].pptx
Présentation_gestion[1] [Autosaved].pptxPrésentation_gestion[1] [Autosaved].pptx
Présentation_gestion[1] [Autosaved].pptx
KHADIJAESSAKET
 
ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025
Rahul
 
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
 
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptxFINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
FINAL 2013 Module 20 Corrosion Control and Sequestering PPT Slides.pptx
kippcam
 
Water demand - Types , variations and WDS
Water demand - Types , variations and WDSWater demand - Types , variations and WDS
Water demand - Types , variations and WDS
dhanashree78
 
COMPOSITE COLUMN IN STEEL CONCRETE COMPOSITES.ppt
COMPOSITE COLUMN IN STEEL CONCRETE COMPOSITES.pptCOMPOSITE COLUMN IN STEEL CONCRETE COMPOSITES.ppt
COMPOSITE COLUMN IN STEEL CONCRETE COMPOSITES.ppt
ravicivil
 
First Come First Serve Scheduling in real time operating system.pptx
First Come First Serve Scheduling in real time operating system.pptxFirst Come First Serve Scheduling in real time operating system.pptx
First Come First Serve Scheduling in real time operating system.pptx
KavitaBagewadi2
 
Tree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbb
Tree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbbTree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbb
Tree_Traversals.pptbbbbbbbbbbbbbbbbbbbbbbbbb
RATNANITINPATIL
 
operationg systemsdocumentmemorymanagement
operationg systemsdocumentmemorymanagementoperationg systemsdocumentmemorymanagement
operationg systemsdocumentmemorymanagement
SNIGDHAAPPANABHOTLA
 
Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...
Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...
Decoding Kotlin - Your Guide to Solving the Mysterious in Kotlin - Devoxx PL ...
João Esperancinha
 
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
 
NALCO Green Anode Plant,Compositions of CPC,Pitch
NALCO Green Anode Plant,Compositions of CPC,PitchNALCO Green Anode Plant,Compositions of CPC,Pitch
NALCO Green Anode Plant,Compositions of CPC,Pitch
arpitprachi123
 
Pavement and its types, Application of rigid and Flexible Pavements
Pavement and its types, Application of rigid and Flexible PavementsPavement and its types, Application of rigid and Flexible Pavements
Pavement and its types, Application of rigid and Flexible Pavements
Sakthivel M
 
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
 
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
 
最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制
最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制
最新版美国圣莫尼卡学院毕业证(SMC毕业证书)原版定制
Taqyea
 
OCS Group SG - HPHT Well Design and Operation - SN.pdf
OCS Group SG - HPHT Well Design and Operation - SN.pdfOCS Group SG - HPHT Well Design and Operation - SN.pdf
OCS Group SG - HPHT Well Design and Operation - SN.pdf
Muanisa Waras
 
Universal Human Values and professional ethics Quantum AKTU BVE401
Universal Human Values and professional ethics Quantum AKTU BVE401Universal Human Values and professional ethics Quantum AKTU BVE401
Universal Human Values and professional ethics Quantum AKTU BVE401
Unknown
 
grade 9 science q1 quiz.pptx science quiz
grade 9 science q1 quiz.pptx science quizgrade 9 science q1 quiz.pptx science quiz
grade 9 science q1 quiz.pptx science quiz
norfapangolima
 
Présentation_gestion[1] [Autosaved].pptx
Présentation_gestion[1] [Autosaved].pptxPrésentation_gestion[1] [Autosaved].pptx
Présentation_gestion[1] [Autosaved].pptx
KHADIJAESSAKET
 
ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025ACEP Magazine Fifth Edition on 5june2025
ACEP Magazine Fifth Edition on 5june2025
Rahul
 
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
 
Ad

Arduino Platform with C programming.

  • 1. THE ARDUINO PLATFORM AND C PROGRAMMING PRESENTED BYPRESENTED BY GOVIND JHAGOVIND JHA
  • 2. What is Arduino? A microcontroller board, contains on-board power supply, USB port to communicate with PC, and an Atmel microcontroller chip. It simplify the process of creating any control system by providing the standard board that can be programmed and connected to the system without the need to any sophisticated PCB design and implementation. It is an open source hardware, any one can get the details of its design and modify it or make his own one himself.
  • 3. Arduino Development BoardArduino Development Board • Eight bit microcontroller – brain of the boardEight bit microcontroller – brain of the board • USB Port – to communicate with theUSB Port – to communicate with the desktop/laptopdesktop/laptop • USB controller chip – manages USB transferredUSB controller chip – manages USB transferred datadata • IO pins – board’s connection to the outside worldIO pins – board’s connection to the outside world • Quartz oscillator – board’s time keeperQuartz oscillator – board’s time keeper • Reset button – taking the board back to its initialReset button – taking the board back to its initial statestate • External power jack – power from dedicatedExternal power jack – power from dedicated sourcesource Co-axial jack, but USB can also be used.Co-axial jack, but USB can also be used.
  • 4. Arduino UNO:Arduino UNO: Digital output ~: PWM. 0,1: Serial port. In circuit Serial programming Atmel MicroController Analog input.Power Supply USB port Power input
  • 5. Input/output Pins (I/OPins)Input/output Pins (I/OPins) • Top and bottom rows of the boardTop and bottom rows of the board • Holes in the board which we can stick wires inHoles in the board which we can stick wires in • Holes are connected to the chips through traces on-boardHoles are connected to the chips through traces on-board • 14 Digital I/O pins on top [0-13]14 Digital I/O pins on top [0-13] • Highs – 5 voltsHighs – 5 volts Lows – 0 voltsLows – 0 volts Max Current - 40 mAMax Current - 40 mA • 6 Analog input pins on the bottom [A0 – A5]6 Analog input pins on the bottom [A0 – A5] • Power output pins on the bottom [ 5v , 3.3 v ]Power output pins on the bottom [ 5v , 3.3 v ] • Reset pin to reset the board to initial state.Reset pin to reset the board to initial state.
  • 6. MicrocontrollersMicrocontrollers • Two microcontrollers on the boardTwo microcontrollers on the board • Main ATmega328 – 8 bit microcontrollerMain ATmega328 – 8 bit microcontroller • User programmable, runs user-written application codeUser programmable, runs user-written application code Carries firmware, like bootloaderCarries firmware, like bootloader • ATmega16U2ATmega16U2 • Handles the communication with the USB interface, notHandles the communication with the USB interface, not directly accessibledirectly accessible
  • 7. Storage and MemoryStorage and Memory •Non-volatile flash memory for storageNon-volatile flash memory for storage •32 kilobytes in size32 kilobytes in size •Static Random Access Memory (SRAM) for memoryStatic Random Access Memory (SRAM) for memory (volatile)(volatile) •3 kilobytes in size3 kilobytes in size
  • 8. ClockClock • 16 MHz clock speed ~ 16 million operations per16 MHz clock speed ~ 16 million operations per secondsecond • Helps synchronize all components togetherHelps synchronize all components together • Keeping track of occurrence of eventsKeeping track of occurrence of events
  • 9. Programming FirmwareProgramming Firmware • The ISCP headers can be used to program theThe ISCP headers can be used to program the firmware on the boardfirmware on the board • ICSP1 for the main ATmega328 microcontrollerICSP1 for the main ATmega328 microcontroller • ICSP2 for the ATmega16U2 microcontrollerICSP2 for the ATmega16U2 microcontroller • Special equipment are required in order to re-Special equipment are required in order to re- program the firmware through these headersprogram the firmware through these headers
  • 10. Software EnvironmentSoftware Environment • Arduino IDE – Integrated Development EnvironmentArduino IDE – Integrated Development Environment • Can be programmed using other IDEs too, like EclipseCan be programmed using other IDEs too, like Eclipse • Arduino IDE is more versatileArduino IDE is more versatile • Needs no special drivers or additional componentsNeeds no special drivers or additional components • Available for Windows, Linux and MacAvailable for Windows, Linux and Mac • Cross compiler – compiles for a different target platform than the one beingCross compiler – compiles for a different target platform than the one being programmed onprogrammed on
  • 11. IDE – Software Tool forIDE – Software Tool for ProgrammingProgramming • File operations and other general options on topFile operations and other general options on top • Buttons for most commonly used options (Verify, Upload,Buttons for most commonly used options (Verify, Upload, etc.)etc.) • Main window – Text editor for writing codeMain window – Text editor for writing code • Message area – for messages to the programmerMessage area – for messages to the programmer
  • 12. Options ButtonsOptions Buttons Buttons on the top have the most common ,useful operationsButtons on the top have the most common ,useful operations Verify – compiles the code and checks for errorsVerify – compiles the code and checks for errors Uploads – compiles the code, uploads it to the board. Works only ifUploads – compiles the code, uploads it to the board. Works only if the board is connectedthe board is connected New – creates a new sketch, a new programNew – creates a new sketch, a new program Open – opens an existing sketchOpen – opens an existing sketch Save – saves the current sketch in the directory of your choiceSave – saves the current sketch in the directory of your choice Serial Monitor – opens window to communicate with the boardSerial Monitor – opens window to communicate with the board
  • 13. Arduino ShieldsArduino Shields • The prominent reason that Arduino got so popularThe prominent reason that Arduino got so popular • Additional hardware to do particular, complex tasksAdditional hardware to do particular, complex tasks • Form of separate boardsForm of separate boards • Pre-wired pins that stick into holes in ArduinoPre-wired pins that stick into holes in Arduino • Stack on top of the Arduino to make connectionsStack on top of the Arduino to make connections • Pre-written functions for operations of these boardsPre-written functions for operations of these boards • Open-source designs in most of the cases, third partyOpen-source designs in most of the cases, third party •
  • 14. • IntegerInteger: used with integer variables with value between 2147483647 and -2147483647. Ex: int x=1200; • CharacterCharacter: used with single character, represent value from -127 to 128. Ex. char c=‘r’; • LongLong: Long variables are extended size variables for number storage, and store 32 bits (4 bytes), from -2,147,483,648 to 2,147,483,647. Ex. long u=199203; • Floating-point:Floating-point: Numbers can be as large as 3.4028235E+38 and as low as -3.4028235E+38. They are stored as 32 bits (4 bytes) of information. Ex. float num=1.291; [The same as doubledouble type] Data Types and OperatorsData Types and Operators
  • 15. Statement represents a command, it ends with ;; Ex: int x; x=13; Operators are symbols that used to indicate a specific function: - Math operators: [+,-,* ,/,%,^+,-,* ,/,%,^] - Logic operators: [==, !=, &&, ||==, !=, &&, ||] - Comparison operators: [==, >, <, !=, <=, >===, >, <, !=, <=, >=] Syntax: ;; Semicolon, {}{} curly braces, ////single line comment, /*/* Multi-line co m m e nts * /* / Statement and OperatorsStatement and Operators
  • 16. Compound Operators:Compound Operators: ++ (increment) -- (decrement) += (compound addition) -= (compound subtraction) *= (compound multiplication) /= (compound division) Statement and OperatorsStatement and Operators
  • 17. If Conditioning:If Conditioning: if(co nditio n) { state m e nts-1 ; … State m e nt-N; } else if(co nditio n2 ) { State m e nts; } Else{state m e nts ;} Control StatementsControl Statements
  • 18. Switch case:Switch case: switch (var) { case 1 : //do so m e thing whe n var e q uals 1 bre ak; case 2: //do so m e thing whe n var e q uals 2 bre ak; de fault: // if no thing e lse m atche s, do the de fault // de fault is o ptio nal } Control StatementsControl Statements
  • 19. Do… while:Do… while: do { Statements; } while(condition); // the statements are run at least once. While:While: While(condition) {statements;} forfor for (int i=0; i <= val; i++){ statements; } Loop StatementsLoop Statements
  • 20. Void setup(){}Void setup(){} Used to indicate the initial values of system on starting. Void loop(){}Void loop(){} Contains the statements that will run whenever the system is powered after setup. Code StructureCode Structure
  • 21. Arduino Tool chainArduino Tool chain • Steps taken post code authoringSteps taken post code authoring • Source code(sketch) is compiled to an executableSource code(sketch) is compiled to an executable formatformat • Executable file is linked with libraries and interpretedExecutable file is linked with libraries and interpreted into a hex fileinto a hex file • Hex file is uploaded to boardHex file is uploaded to board • Starts executing right awayStarts executing right away
  • 22. Cross CompilationCross Compilation • Compile on one machine, but the target is another machine.Compile on one machine, but the target is another machine. E.g.: compiling it on an Intel processor, compiling it for anE.g.: compiling it on an Intel processor, compiling it for an AVR processorAVR processor • avr-gcc – C compiler for AVR targets, gives a *.o fileavr-gcc – C compiler for AVR targets, gives a *.o file • avr-lnk – links library object files, results in a *.elf fileavr-lnk – links library object files, results in a *.elf file • avr-objcopy – change the *.elf file into Arduino compatible *.hexavr-objcopy – change the *.elf file into Arduino compatible *.hex filefile
  • 23. Running IDE on WindowsRunning IDE on Windows • Emacs or NotePad++ text editorEmacs or NotePad++ text editor • Gcc C compilerGcc C compiler • The debugger, gdbThe debugger, gdb • IDE provides one-stop solutionIDE provides one-stop solution
  • 24. BlinkLEDExampleBlinkLEDExample • Pin 13 is represented by numeral 13Pin 13 is represented by numeral 13 • digitalWrite() writes voltage values todigitalWrite() writes voltage values to pinspins • delay() sets delays in millisecondsdelay() sets delays in milliseconds • HIGH – 5vHIGH – 5v LOW – 0vLOW – 0v
  • 25. THE ENDTHE ENDTHANK YOUTHANK YOU

Editor's Notes

  • #10: In circuit serial programmer