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

Weitere ähnliche Inhalte

Was ist angesagt?

Arduino Platform with C programming.
Arduino Platform with C programming.Arduino Platform with C programming.
Arduino Platform with C programming.Govind Jha
 
2015-10-21 - Arduino workshop
2015-10-21 - Arduino workshop2015-10-21 - Arduino workshop
2015-10-21 - Arduino workshoptrygvis
 
Lesson sample introduction to arduino
Lesson sample   introduction to arduinoLesson sample   introduction to arduino
Lesson sample introduction to arduinoBetsy Eng
 
Arduino technical session 1
Arduino technical session 1Arduino technical session 1
Arduino technical session 1Audiomas Soni
 
Getting Started With Arduino_Tutorial
Getting Started With Arduino_TutorialGetting Started With Arduino_Tutorial
Getting Started With Arduino_TutorialNYCCTfab
 
Arduino experimenters guide hq
Arduino experimenters guide hqArduino experimenters guide hq
Arduino experimenters guide hqAndreis Santos
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to ArduinoQtechknow
 
Arduino Development For Beginners
Arduino Development For BeginnersArduino Development For Beginners
Arduino Development For BeginnersFTS seminar
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduinoyeokm1
 
Arduino Robotics workshop Day1
Arduino Robotics workshop Day1Arduino Robotics workshop Day1
Arduino Robotics workshop Day1Sudar 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 UnoVui Nguyen
 
Introduction to Arduino and Circuits
Introduction to Arduino and CircuitsIntroduction to Arduino and Circuits
Introduction to Arduino and CircuitsJason Griffey
 
Intro to Arduino
Intro to ArduinoIntro to Arduino
Intro to Arduinoavikdhupar
 
Introducing the Arduino
Introducing the ArduinoIntroducing the Arduino
Introducing the ArduinoCharles 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 ArduinoVishnu
 

Was ist angesagt? (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
 

Andere mochten auch

Arduino Lecture 1 - Introducing the Arduino
Arduino Lecture 1 - Introducing the ArduinoArduino Lecture 1 - Introducing the Arduino
Arduino Lecture 1 - Introducing the ArduinoEoin 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 2009Eoin 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 InterfaceRaghav Shetty
 
Digital Dimmer Module
Digital Dimmer ModuleDigital Dimmer Module
Digital Dimmer ModuleRaghav 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 2013Eoin Brazil
 
Mindstorms Arduino En Phidgets
Mindstorms Arduino En PhidgetsMindstorms Arduino En Phidgets
Mindstorms Arduino En Phidgetsprotospace
 
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 DatasheetsEoin 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 2009Eoin 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 2009Eoin 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
 
Programming with arduino
Programming with arduinoProgramming with arduino
Programming with arduinoMakers of India
 
Arduino Home Automation Hacks
Arduino Home Automation HacksArduino Home Automation Hacks
Arduino Home Automation HacksNicholas O'Leary
 
Report On Arduino
Report On  ArduinoReport On  Arduino
Report On ArduinoTongXu520
 

Andere mochten auch (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
 

Ähnlich wie Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009

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.pdfJayanthi Kannan MK
 
01_DIGITAL IO.pptx
01_DIGITAL IO.pptx01_DIGITAL IO.pptx
01_DIGITAL IO.pptxssuser593a2d
 
Cassiopeia Ltd - standard Arduino workshop
Cassiopeia Ltd - standard Arduino workshopCassiopeia Ltd - standard Arduino workshop
Cassiopeia Ltd - standard Arduino workshoptomtobback
 
Embedded system course projects - Arduino Course
Embedded system course projects - Arduino CourseEmbedded system course projects - Arduino Course
Embedded system course projects - Arduino CourseElaf 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 cic3Jeni Shah
 
Arduino Programming Familiarization
Arduino Programming FamiliarizationArduino Programming Familiarization
Arduino Programming FamiliarizationAmit Kumer Podder
 
Arduino Foundations
Arduino FoundationsArduino Foundations
Arduino FoundationsJohn Breslin
 
Arduino Workshop (3).pptx
Arduino Workshop (3).pptxArduino Workshop (3).pptx
Arduino Workshop (3).pptxHebaEng
 
ARUDINO UNO and RasberryPi with Python
 ARUDINO UNO and RasberryPi with Python ARUDINO UNO and RasberryPi with Python
ARUDINO UNO and RasberryPi with PythonJayanthi Kannan MK
 
Starting with Arduino
Starting with Arduino Starting with Arduino
Starting with Arduino MajdyShamasneh
 
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 2013Tom Paulus
 

Ähnlich wie 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
 

Mehr von Eoin Brazil

Cloud Computing Examples at ICHEC
Cloud Computing Examples at ICHECCloud Computing Examples at ICHEC
Cloud Computing Examples at ICHECEoin 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 miningEoin 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 problemsEoin 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 ICHECEoin 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 programmingEoin Brazil
 

Mehr von 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
 

Kürzlich hochgeladen

Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 

Kürzlich hochgeladen (20)

Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 

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/