P-Space Arduino/Genuino day 2016

download P-Space Arduino/Genuino day 2016

of 23

Embed Size (px)

Transcript of P-Space Arduino/Genuino day 2016

  • P-whaaat?

  • Workshop kit

  • Arduino UNO

  • Hundreds of them

  • codebender.cc

  • OMG! IT BLINKS!

  • Mr. Editor

  • Arduino code

    // ( )

    void setup(){ // }

    void loop(){ // }

  • Blink Arduino, blink!

    void setup(){ pinMode(LED_BUILTIN, OUTPUT);}

    void loop(){ digitalWrite( LED_BUILTIN, HIGH); delay(1000); digitalWrite( LED_BUILTIN, LOW); delay(1000);}

  • Lets add a variable

    int led = 13;

    void setup(){ pinMode(led, OUTPUT);}

    void loop(){ digitalWrite(led, HIGH); delay(1000); digitalWrite(led, LOW); delay(1000);}

  • Can we go faster?

    int led = 13;

    void setup(){ pinMode(led, OUTPUT);}

    void loop(){ digitalWrite(led, HIGH); delay(100); digitalWrite(led, LOW); delay(100);}

  • The world is analog

  • Blink another LED

  • Blink another LED

  • Night light (sort of!)

  • Night light (sort of!)

    int led = 11;

    void setup(){ pinMode(led, OUTPUT);}

    void loop(){ int light = analogRead(A5); analogWrite(led, light);}

  • Whats going on inside?

    int led = 11;

    void setup(){ Serial.begin(9600); pinMode(led, OUTPUT);}

    void loop(){ int light = analogRead(A5); Serial.println(light); analogWrite(led, light);}

  • Its getting hot

    www.codebender.cc/sketch:273552

  • Comes with text too!

    www.codebender.cc/sketch:273558

  • And now on your own (little grasshopper)

    Temperature23.5C

    + =

  • Thank you!