Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    4 Favorites

    Arduino Lecture 4 - Interactive Media CS4062 Semester 2 2009 - Presentation Transcript

    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/

    + Eoin BrazilEoin Brazil, 8 months ago

    custom

    828 views, 4 favs, 4 embeds more stats

    CS4062 Masters in Interactive Media - Fourth Arduin more

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 828
      • 787 on SlideShare
      • 41 from embeds
    • Comments 0
    • Favorites 4
    • Downloads 22
    Most viewed embeds
    • 37 views on http://braz.blogspot.com
    • 2 views on http://www.maffucci.it
    • 1 views on http://209.85.227.132
    • 1 views on http://74.125.87.132

    more

    All embeds
    • 37 views on http://braz.blogspot.com
    • 2 views on http://www.maffucci.it
    • 1 views on http://209.85.227.132
    • 1 views on http://74.125.87.132

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories