SlideShare a Scribd company logo
Programming the
    Arduino
CS4062 - Eoin Brazil - Semester 2 - 2009




        http://www.flickr.com/photos/collinmel/2317520331/
Programming an
   Arduino
         Write program

          Compile (check for
       errors)

         Reset board

         Upload to board
An Arduino “Sketch”
       Declare variables at top



       Initialize
              setup() – run once at beginning, set pins




       Running
              loop() – run repeatedly, after setup()
An Arduino “Sketch”
                   int ledPin = 13; – led
                   connected to control pin 13

                   int aSensor = 0; – setup
Global Variables
                   sensor 'aSensor' on analog pin 0

                   int statePin = LOW; – use this
                   to hold the state of a pin
An Arduino “Sketch”

          pinMode() – set a pin as input
          or output
setup()
          serial.Begin() – setup to `talk'
          to the computer
An Arduino “Sketch”

          pinMode(ledPin, Output); –
          set the pin `ledPin' as an output
setup()
          serial.Begin(9600); – talk to
          the computer at 9600 baud rate
An Arduino “Sketch”

          digitalWrite() – set a digital pin high/low
          digitalRead() – read a digital pin’s state
          analogRead() – read an analog pin
 loop()
          analogWrite() – write an “analog” PWM value
          delay() – wait an amount of time
          millis() – get the current tim
`C’ language
  char - ascii character, 8 bits
  short - short integer, 16 bits, -32768 to
32767
  int - default integer, 16 or 32 bits
  long - large integer, at least 32 bits
  float - 32 bit floating point (e.g. 3.13)
  double, long double - 64 bit or greater
Character constants
  `A’ - upper case A

  `n’ - newline character

  `t’ - tab character

  `0’ - null character (it is digit not char)

  `012’ - character with octal value of 12
which is decimal 10
Commenting and
    Operators
`//’ - single line comment

`/* .... */’ - multiline comment

 + Addition - Subtraction * Multiplication

/ Division % Remander (mod)

== != <= >= < >

= is not ==
More Operators
   Boolean operators ! - not && - and || - or

  if (<statement>) { <statement/s> }

  if - else

  while (<statement>) { <statements/s> }

  Essential C - http://cslibrary.stanford.edu/
101/

More Related Content

What's hot

Arduino Platform with C programming.
Arduino Platform with C programming.Arduino Platform with C programming.
Arduino Platform with C programming.
Govind Jha
 
Arduino Workshop Day 2
Arduino  Workshop Day 2Arduino  Workshop Day 2
Arduino Workshop Day 2
Yogendra Tamang
 
2015-10-21 - Arduino workshop
2015-10-21 - Arduino workshop2015-10-21 - Arduino workshop
2015-10-21 - Arduino workshop
trygvis
 
Lesson sample introduction to arduino
Lesson sample   introduction to arduinoLesson sample   introduction to arduino
Lesson sample introduction to arduino
Betsy Eng
 
Arduino technical session 1
Arduino technical session 1Arduino technical session 1
Arduino technical session 1
Audiomas Soni
 
Getting Started With Arduino_Tutorial
Getting Started With Arduino_TutorialGetting Started With Arduino_Tutorial
Getting Started With Arduino_Tutorial
NYCCTfab
 
Arduino experimenters guide hq
Arduino experimenters guide hqArduino experimenters guide hq
Arduino experimenters guide hq
Andreis Santos
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
Qtechknow
 
Aurdino presentation
Aurdino presentationAurdino presentation
Aurdino presentation
C.Vamsi Krishna
 
Arduino Development For Beginners
Arduino Development For BeginnersArduino Development For Beginners
Arduino Development For Beginners
FTS seminar
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
yeokm1
 
Arduino Robotics workshop Day1
Arduino Robotics workshop Day1Arduino Robotics workshop Day1
Arduino Robotics workshop Day1
Sudar Muthu
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the ArduinoWingston
 
Intro to Hardware Programming with the Arduino Uno
Intro to Hardware Programming with the Arduino UnoIntro to Hardware Programming with the Arduino Uno
Intro to Hardware Programming with the Arduino Uno
Vui Nguyen
 
Arduino 101
Arduino 101Arduino 101
Arduino 101
Giorgio Aresu
 
Introduction to Arduino and Circuits
Introduction to Arduino and CircuitsIntroduction to Arduino and Circuits
Introduction to Arduino and Circuits
Jason Griffey
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
avikdhupar
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
Green Moon Solutions
 
Introducing the Arduino
Introducing the ArduinoIntroducing the Arduino
Introducing the Arduino
Charles A B Jr
 
Arduino Workshop Day 1 - Basic Arduino
Arduino Workshop Day 1 - Basic ArduinoArduino Workshop Day 1 - Basic Arduino
Arduino Workshop Day 1 - Basic Arduino
Vishnu
 

What's hot (20)

Arduino Platform with C programming.
Arduino Platform with C programming.Arduino Platform with C programming.
Arduino Platform with C programming.
 
Arduino Workshop Day 2
Arduino  Workshop Day 2Arduino  Workshop Day 2
Arduino Workshop Day 2
 
2015-10-21 - Arduino workshop
2015-10-21 - Arduino workshop2015-10-21 - Arduino workshop
2015-10-21 - Arduino workshop
 
Lesson sample introduction to arduino
Lesson sample   introduction to arduinoLesson sample   introduction to arduino
Lesson sample introduction to arduino
 
Arduino technical session 1
Arduino technical session 1Arduino technical session 1
Arduino technical session 1
 
Getting Started With Arduino_Tutorial
Getting Started With Arduino_TutorialGetting Started With Arduino_Tutorial
Getting Started With Arduino_Tutorial
 
Arduino experimenters guide hq
Arduino experimenters guide hqArduino experimenters guide hq
Arduino experimenters guide hq
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
 
Aurdino presentation
Aurdino presentationAurdino presentation
Aurdino presentation
 
Arduino Development For Beginners
Arduino Development For BeginnersArduino Development For Beginners
Arduino Development For Beginners
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Arduino Robotics workshop Day1
Arduino Robotics workshop Day1Arduino Robotics workshop Day1
Arduino Robotics workshop Day1
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the Arduino
 
Intro to Hardware Programming with the Arduino Uno
Intro to Hardware Programming with the Arduino UnoIntro to Hardware Programming with the Arduino Uno
Intro to Hardware Programming with the Arduino Uno
 
Arduino 101
Arduino 101Arduino 101
Arduino 101
 
Introduction to Arduino and Circuits
Introduction to Arduino and CircuitsIntroduction to Arduino and Circuits
Introduction to Arduino and Circuits
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduino
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Introducing the Arduino
Introducing the ArduinoIntroducing the Arduino
Introducing the Arduino
 
Arduino Workshop Day 1 - Basic Arduino
Arduino Workshop Day 1 - Basic ArduinoArduino Workshop Day 1 - Basic Arduino
Arduino Workshop Day 1 - Basic Arduino
 

Viewers also liked

Arduino Lecture 1 - Introducing the Arduino
Arduino Lecture 1 - Introducing the ArduinoArduino Lecture 1 - Introducing the Arduino
Arduino Lecture 1 - Introducing the Arduino
Eoin Brazil
 
Arduino Full Tutorial
Arduino Full TutorialArduino Full Tutorial
Arduino Full TutorialAkshay Sharma
 
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Eoin Brazil
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduinoAhmed Sakr
 
Serial 8 Channel AC 230V SSR and Dimmer Bluetooth Interface
Serial 8 Channel AC 230V SSR and Dimmer  Bluetooth InterfaceSerial 8 Channel AC 230V SSR and Dimmer  Bluetooth Interface
Serial 8 Channel AC 230V SSR and Dimmer Bluetooth Interface
Raghav Shetty
 
Digital Dimmer Module
Digital Dimmer ModuleDigital Dimmer Module
Digital Dimmer Module
Raghav Shetty
 
Mobile Services from Concept to Reality - Case Studies at the Mobile Service ...
Mobile Services from Concept to Reality - Case Studies at the Mobile Service ...Mobile Services from Concept to Reality - Case Studies at the Mobile Service ...
Mobile Services from Concept to Reality - Case Studies at the Mobile Service ...
Eoin Brazil
 
Introduction to Machine Learning using R - Dublin R User Group - Oct 2013
Introduction to Machine Learning using R - Dublin R User Group - Oct 2013Introduction to Machine Learning using R - Dublin R User Group - Oct 2013
Introduction to Machine Learning using R - Dublin R User Group - Oct 2013
Eoin Brazil
 
Mindstorms Arduino En Phidgets
Mindstorms Arduino En PhidgetsMindstorms Arduino En Phidgets
Mindstorms Arduino En Phidgets
protospace
 
Arduino Lecture 2 - Electronic, LEDs, Communications and Datasheets
Arduino Lecture 2 - Electronic, LEDs, Communications and DatasheetsArduino Lecture 2 - Electronic, LEDs, Communications and Datasheets
Arduino Lecture 2 - Electronic, LEDs, Communications and Datasheets
Eoin Brazil
 
Pragmatic Analytics - Case Studies of High Performance Computing for Better B...
Pragmatic Analytics - Case Studies of High Performance Computing for Better B...Pragmatic Analytics - Case Studies of High Performance Computing for Better B...
Pragmatic Analytics - Case Studies of High Performance Computing for Better B...
Eoin Brazil
 
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Eoin Brazil
 
Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009
Eoin Brazil
 
The Fab Lab Life Cycle; Report of the FAB10 workshops; Pieter van der Hijden ...
The Fab Lab Life Cycle; Report of the FAB10 workshops; Pieter van der Hijden ...The Fab Lab Life Cycle; Report of the FAB10 workshops; Pieter van der Hijden ...
The Fab Lab Life Cycle; Report of the FAB10 workshops; Pieter van der Hijden ...
Pieter van der Hijden
 
Dimmer digital con Arduino
Dimmer digital con ArduinoDimmer digital con Arduino
Dimmer digital con Arduino
Santiago Sarmiento
 
humidity sensor
humidity sensorhumidity sensor
humidity sensor
Nikita Gupta
 
Programming with arduino
Programming with arduinoProgramming with arduino
Programming with arduino
Makers of India
 
Arduino Home Automation Hacks
Arduino Home Automation HacksArduino Home Automation Hacks
Arduino Home Automation Hacks
Nicholas O'Leary
 
Report On Arduino
Report On  ArduinoReport On  Arduino
Report On Arduino
TongXu520
 

Viewers also liked (20)

Arduino Lecture 1 - Introducing the Arduino
Arduino Lecture 1 - Introducing the ArduinoArduino Lecture 1 - Introducing the Arduino
Arduino Lecture 1 - Introducing the Arduino
 
Arduino Full Tutorial
Arduino Full TutorialArduino Full Tutorial
Arduino Full Tutorial
 
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
 
Introduction to arduino
Introduction to arduinoIntroduction to arduino
Introduction to arduino
 
Serial 8 Channel AC 230V SSR and Dimmer Bluetooth Interface
Serial 8 Channel AC 230V SSR and Dimmer  Bluetooth InterfaceSerial 8 Channel AC 230V SSR and Dimmer  Bluetooth Interface
Serial 8 Channel AC 230V SSR and Dimmer Bluetooth Interface
 
Digital Dimmer Module
Digital Dimmer ModuleDigital Dimmer Module
Digital Dimmer Module
 
Mobile Services from Concept to Reality - Case Studies at the Mobile Service ...
Mobile Services from Concept to Reality - Case Studies at the Mobile Service ...Mobile Services from Concept to Reality - Case Studies at the Mobile Service ...
Mobile Services from Concept to Reality - Case Studies at the Mobile Service ...
 
Introduction to Machine Learning using R - Dublin R User Group - Oct 2013
Introduction to Machine Learning using R - Dublin R User Group - Oct 2013Introduction to Machine Learning using R - Dublin R User Group - Oct 2013
Introduction to Machine Learning using R - Dublin R User Group - Oct 2013
 
Arduino 1 jose m. ruiz
Arduino 1   jose m. ruizArduino 1   jose m. ruiz
Arduino 1 jose m. ruiz
 
Mindstorms Arduino En Phidgets
Mindstorms Arduino En PhidgetsMindstorms Arduino En Phidgets
Mindstorms Arduino En Phidgets
 
Arduino Lecture 2 - Electronic, LEDs, Communications and Datasheets
Arduino Lecture 2 - Electronic, LEDs, Communications and DatasheetsArduino Lecture 2 - Electronic, LEDs, Communications and Datasheets
Arduino Lecture 2 - Electronic, LEDs, Communications and Datasheets
 
Pragmatic Analytics - Case Studies of High Performance Computing for Better B...
Pragmatic Analytics - Case Studies of High Performance Computing for Better B...Pragmatic Analytics - Case Studies of High Performance Computing for Better B...
Pragmatic Analytics - Case Studies of High Performance Computing for Better B...
 
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 3 - Interactive Media CS4062 Semester 2 2009
 
Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009
Arduino Lecture 2 - Interactive Media CS4062 Semester 2 2009
 
The Fab Lab Life Cycle; Report of the FAB10 workshops; Pieter van der Hijden ...
The Fab Lab Life Cycle; Report of the FAB10 workshops; Pieter van der Hijden ...The Fab Lab Life Cycle; Report of the FAB10 workshops; Pieter van der Hijden ...
The Fab Lab Life Cycle; Report of the FAB10 workshops; Pieter van der Hijden ...
 
Dimmer digital con Arduino
Dimmer digital con ArduinoDimmer digital con Arduino
Dimmer digital con Arduino
 
humidity sensor
humidity sensorhumidity sensor
humidity sensor
 
Programming with arduino
Programming with arduinoProgramming with arduino
Programming with arduino
 
Arduino Home Automation Hacks
Arduino Home Automation HacksArduino Home Automation Hacks
Arduino Home Automation Hacks
 
Report On Arduino
Report On  ArduinoReport On  Arduino
Report On Arduino
 

Similar to Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009

Arduino intro.pptx
Arduino intro.pptxArduino intro.pptx
Arduino intro.pptx
SanthanaMari11
 
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
 
01_DIGITAL IO.pptx
01_DIGITAL IO.pptx01_DIGITAL IO.pptx
01_DIGITAL IO.pptx
ssuser593a2d
 
Arduino Programming
Arduino ProgrammingArduino Programming
Arduino Programming
Dr Karthikeyan Periasamy
 
Cassiopeia Ltd - standard Arduino workshop
Cassiopeia Ltd - standard Arduino workshopCassiopeia Ltd - standard Arduino workshop
Cassiopeia Ltd - standard Arduino workshop
tomtobback
 
Embedded system course projects - Arduino Course
Embedded system course projects - Arduino CourseEmbedded system course projects - Arduino Course
Embedded system course projects - Arduino Course
Elaf A.Saeed
 
Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Tom Paulus
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3
Jeni Shah
 
Arduino Programming Familiarization
Arduino Programming FamiliarizationArduino Programming Familiarization
Arduino Programming Familiarization
Amit Kumer Podder
 
Arduino Foundations
Arduino FoundationsArduino Foundations
Arduino Foundations
John Breslin
 
Arduino Workshop (3).pptx
Arduino Workshop (3).pptxArduino Workshop (3).pptx
Arduino Workshop (3).pptx
HebaEng
 
How to use an Arduino
How to use an ArduinoHow to use an Arduino
How to use an Arduino
AntonAndreev13
 
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
 
Starting with Arduino
Starting with Arduino Starting with Arduino
Starting with Arduino
MajdyShamasneh
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
Amarjeetsingh Thakur
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
Amarjeetsingh Thakur
 
Getting Started with Raspberry Pi - USC 2013
Getting Started with Raspberry Pi - USC 2013Getting Started with Raspberry Pi - USC 2013
Getting Started with Raspberry Pi - USC 2013
Tom Paulus
 

Similar to Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009 (20)

Arduino intro.pptx
Arduino intro.pptxArduino intro.pptx
Arduino intro.pptx
 
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
 
01_DIGITAL IO.pptx
01_DIGITAL IO.pptx01_DIGITAL IO.pptx
01_DIGITAL IO.pptx
 
Arduino Programming
Arduino ProgrammingArduino Programming
Arduino Programming
 
Programming arduino makeymakey
Programming arduino makeymakeyProgramming arduino makeymakey
Programming arduino makeymakey
 
Cassiopeia Ltd - standard Arduino workshop
Cassiopeia Ltd - standard Arduino workshopCassiopeia Ltd - standard Arduino workshop
Cassiopeia Ltd - standard Arduino workshop
 
Embedded system course projects - Arduino Course
Embedded system course projects - Arduino CourseEmbedded system course projects - Arduino Course
Embedded system course projects - Arduino Course
 
Arduino Programming Basic
Arduino Programming BasicArduino Programming Basic
Arduino Programming Basic
 
Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013Getting Started With Raspberry Pi - UCSD 2013
Getting Started With Raspberry Pi - UCSD 2013
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3
 
Arduino Programming Familiarization
Arduino Programming FamiliarizationArduino Programming Familiarization
Arduino Programming Familiarization
 
Arduino Foundations
Arduino FoundationsArduino Foundations
Arduino Foundations
 
Arduino Workshop (3).pptx
Arduino Workshop (3).pptxArduino Workshop (3).pptx
Arduino Workshop (3).pptx
 
How to use an Arduino
How to use an ArduinoHow to use an Arduino
How to use an Arduino
 
Day1
Day1Day1
Day1
 
ARUDINO UNO and RasberryPi with Python
 ARUDINO UNO and RasberryPi with Python ARUDINO UNO and RasberryPi with Python
ARUDINO UNO and RasberryPi with Python
 
Starting with Arduino
Starting with Arduino Starting with Arduino
Starting with Arduino
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Getting Started with Raspberry Pi - USC 2013
Getting Started with Raspberry Pi - USC 2013Getting Started with Raspberry Pi - USC 2013
Getting Started with Raspberry Pi - USC 2013
 

More from Eoin Brazil

Cloud Computing Examples at ICHEC
Cloud Computing Examples at ICHECCloud Computing Examples at ICHEC
Cloud Computing Examples at ICHEC
Eoin Brazil
 
An example of discovering simple patterns using basic data mining
An example of discovering simple patterns using basic data miningAn example of discovering simple patterns using basic data mining
An example of discovering simple patterns using basic data mining
Eoin Brazil
 
Bringing HPC to tackle your business problems
Bringing HPC to tackle your business problemsBringing HPC to tackle your business problems
Bringing HPC to tackle your business problems
Eoin Brazil
 
Fat Nodes & GPGPUs - Red-shifting your infrastructure without breaking the bu...
Fat Nodes & GPGPUs - Red-shifting your infrastructure without breaking the bu...Fat Nodes & GPGPUs - Red-shifting your infrastructure without breaking the bu...
Fat Nodes & GPGPUs - Red-shifting your infrastructure without breaking the bu...
Eoin Brazil
 
Example optimisation using GPGPUs by ICHEC
Example optimisation using GPGPUs by ICHECExample optimisation using GPGPUs by ICHEC
Example optimisation using GPGPUs by ICHEC
Eoin Brazil
 
Ichec is vs-andthecloud
Ichec is vs-andthecloudIchec is vs-andthecloud
Ichec is vs-andthecloudEoin Brazil
 
Mixing Interaction, Sonification, Rendering and Design - The art of creating ...
Mixing Interaction, Sonification, Rendering and Design - The art of creating ...Mixing Interaction, Sonification, Rendering and Design - The art of creating ...
Mixing Interaction, Sonification, Rendering and Design - The art of creating ...
Eoin Brazil
 
Echoes, Whispers, and Footsteps from the Conflux of Sonic Interaction Design ...
Echoes, Whispers, and Footsteps from the Conflux of Sonic Interaction Design ...Echoes, Whispers, and Footsteps from the Conflux of Sonic Interaction Design ...
Echoes, Whispers, and Footsteps from the Conflux of Sonic Interaction Design ...
Eoin Brazil
 
Arduino Lecture 3 - Making Things Move and AVR programming
Arduino Lecture 3 - Making Things Move and AVR programmingArduino Lecture 3 - Making Things Move and AVR programming
Arduino Lecture 3 - Making Things Move and AVR programming
Eoin Brazil
 

More from Eoin Brazil (9)

Cloud Computing Examples at ICHEC
Cloud Computing Examples at ICHECCloud Computing Examples at ICHEC
Cloud Computing Examples at ICHEC
 
An example of discovering simple patterns using basic data mining
An example of discovering simple patterns using basic data miningAn example of discovering simple patterns using basic data mining
An example of discovering simple patterns using basic data mining
 
Bringing HPC to tackle your business problems
Bringing HPC to tackle your business problemsBringing HPC to tackle your business problems
Bringing HPC to tackle your business problems
 
Fat Nodes & GPGPUs - Red-shifting your infrastructure without breaking the bu...
Fat Nodes & GPGPUs - Red-shifting your infrastructure without breaking the bu...Fat Nodes & GPGPUs - Red-shifting your infrastructure without breaking the bu...
Fat Nodes & GPGPUs - Red-shifting your infrastructure without breaking the bu...
 
Example optimisation using GPGPUs by ICHEC
Example optimisation using GPGPUs by ICHECExample optimisation using GPGPUs by ICHEC
Example optimisation using GPGPUs by ICHEC
 
Ichec is vs-andthecloud
Ichec is vs-andthecloudIchec is vs-andthecloud
Ichec is vs-andthecloud
 
Mixing Interaction, Sonification, Rendering and Design - The art of creating ...
Mixing Interaction, Sonification, Rendering and Design - The art of creating ...Mixing Interaction, Sonification, Rendering and Design - The art of creating ...
Mixing Interaction, Sonification, Rendering and Design - The art of creating ...
 
Echoes, Whispers, and Footsteps from the Conflux of Sonic Interaction Design ...
Echoes, Whispers, and Footsteps from the Conflux of Sonic Interaction Design ...Echoes, Whispers, and Footsteps from the Conflux of Sonic Interaction Design ...
Echoes, Whispers, and Footsteps from the Conflux of Sonic Interaction Design ...
 
Arduino Lecture 3 - Making Things Move and AVR programming
Arduino Lecture 3 - Making Things Move and AVR programmingArduino Lecture 3 - Making Things Move and AVR programming
Arduino Lecture 3 - Making Things Move and AVR programming
 

Recently uploaded

When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
Abida Shariff
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
Fwdays
 

Recently uploaded (20)

When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 

Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009

  • 1. Programming the Arduino CS4062 - Eoin Brazil - Semester 2 - 2009 http://www.flickr.com/photos/collinmel/2317520331/
  • 2. Programming an Arduino Write program Compile (check for errors) Reset board Upload to board
  • 3. An Arduino “Sketch” Declare variables at top Initialize setup() – run once at beginning, set pins Running loop() – run repeatedly, after setup()
  • 4. An Arduino “Sketch” int ledPin = 13; – led connected to control pin 13 int aSensor = 0; – setup Global Variables sensor 'aSensor' on analog pin 0 int statePin = LOW; – use this to hold the state of a pin
  • 5. An Arduino “Sketch” pinMode() – set a pin as input or output setup() serial.Begin() – setup to `talk' to the computer
  • 6. An Arduino “Sketch” pinMode(ledPin, Output); – set the pin `ledPin' as an output setup() serial.Begin(9600); – talk to the computer at 9600 baud rate
  • 7. An Arduino “Sketch” digitalWrite() – set a digital pin high/low digitalRead() – read a digital pin’s state analogRead() – read an analog pin loop() analogWrite() – write an “analog” PWM value delay() – wait an amount of time millis() – get the current tim
  • 8. `C’ language char - ascii character, 8 bits short - short integer, 16 bits, -32768 to 32767 int - default integer, 16 or 32 bits long - large integer, at least 32 bits float - 32 bit floating point (e.g. 3.13) double, long double - 64 bit or greater
  • 9. Character constants `A’ - upper case A `n’ - newline character `t’ - tab character `0’ - null character (it is digit not char) `012’ - character with octal value of 12 which is decimal 10
  • 10. Commenting and Operators `//’ - single line comment `/* .... */’ - multiline comment + Addition - Subtraction * Multiplication / Division % Remander (mod) == != <= >= < > = is not ==
  • 11. More Operators Boolean operators ! - not && - and || - or if (<statement>) { <statement/s> } if - else while (<statement>) { <statements/s> } Essential C - http://cslibrary.stanford.edu/ 101/