SlideShare a Scribd company logo
Workshop	
  Makey	
  Makey	
  
      (Arduino)	
  



     Jelle.saldien@howest.be	
  
Arduino	
  
Principle	
  
                                                    Sensors	
  

                                     READ	
  
     Your	
  
    Sketch	
  
      [C]	
  
                               inputs	
  
   UPLOAD	
  
                     ARDUINO	
      ATmega328	
  
COMMUNICATE	
  
                              outputs	
  
                                                    Actuators	
  



                                    WRITE	
  
Examples	
  
Examples	
  
Examples	
  
Arduino	
  Board	
  
Arduino	
  Board	
  
Microcontroller                                ATmega328	
  
Opera-ng	
  Voltage                            5	
  V	
  
Input	
  Voltage	
  (recommended)              7-­‐12	
  V	
  
Input	
  Voltage	
  (limits)                   6-­‐20	
  V	
  
Digital	
  I/O	
  Pins                         14	
  (of	
  which	
  6	
  provide	
  PWM	
  output)
Analog	
  Input	
  Pins                        6
DC	
  Current	
  per	
  I/O	
  Pin             40	
  mA	
  
DC	
  Current	
  for	
  3.3V	
  Pin            50	
  mA
                                               32	
  KB	
  (ATmega328)	
  of	
  which	
  2	
  KB	
  used	
  by	
  
Flash	
  Memory
                                               bootloader	
  
SRAM                                           2	
  KB	
  (ATmega328)
EEPROM                                         1	
  KB	
  (ATmega328)
Clock	
  Speed                                 16	
  MHz
Arduino	
  IDE	
  
•  IDE:	
  
    –  Integrated	
  
    –  Development	
  
    –  Environment	
  
Code	
  Structure:	
  setup	
  func`on	
  



                                  setup	
  func`on	
  is	
  executed	
  
                                  only	
  once	
  at	
  the	
  start	
  




10	
  
Code	
  Structure:	
  loop	
  func`on	
  




                                     loop	
  func`on	
  is	
  
                                     repeated	
  indefinitely	
  




11	
  
Code	
  

         pinMode(13, Output)!
         prepare	
  pin	
  13	
  for	
  
         outputs	
  of	
  voltage	
  




                             Digital	
  I/O	
  Func`ons:	
  
                             pinMode	
  
                             digitalWrite	
  
                             digitalRead	
  
12	
  
Code	
  


           digitalWrite(13, HIGH)!
           Sets	
  pin	
  13	
  to	
  a	
  voltage	
  that	
  
           means	
  “on”	
  



                             Digital	
  I/O	
  Func`ons:	
  
                              	
  pinMode	
  
                              	
  digitalWrite	
  
                              	
  digitalRead	
  
13	
  
Code	
  


           delay(1000);!
           Tells	
  microcontroller	
  to	
  do	
  
           nothing	
  for	
  1000	
  ms	
  =	
  1	
  s	
  



                             Digital	
  I/O	
  Func`ons:	
  
                              	
  pinMode	
  
                              	
  digitalWrite	
  
                              	
  digitalRead	
  
14	
  
Code	
  


           digitalWrite(13, LOW)!
           Sets	
  pin	
  13	
  to	
  voltage	
  
           that	
  means	
  “off”	
  



                             Digital	
  I/O	
  Func`ons:	
  
                              	
  pinMode	
  
                              	
  digitalWrite	
  
                              	
  digitalRead	
  
15	
  
Basic	
  Programming	
  
•  The	
  pinMode()	
  func`on	
  configures	
  a	
  pin	
  as	
  
   either	
  an	
  input	
  or	
  an	
  output.	
  To	
  use	
  it:	
  
   –  You	
  pass	
  it	
  the	
  number	
  of	
  the	
  pin	
  to	
  configure	
  
      and	
  the	
  constant	
  INPUT	
  or	
  OUTPUT.	
  	
  
       •  pinMode(11,	
  INPUT);	
  
       •  pinMode(13,	
  OUTPUT);	
  	
  
   –  When	
  configured	
  as	
  an	
  input,	
  a	
  pin	
  can	
  detect	
  the	
  
      state	
  of	
  a	
  sensor	
  like	
  a	
  pushbujon.	
  	
  
   –  As	
  an	
  output,	
  it	
  can	
  drive	
  an	
  actuator	
  like	
  an	
  LED.	
  	
  
Basic	
  Programming	
  
•  The	
  digitalWrite()	
  func`ons	
  outputs	
  a	
  value	
  
   on	
  a	
  pin	
  (0	
  –	
  19).	
  	
  
•  Possible	
  values	
  are:	
  
    –  LOW	
  (0	
  V)	
  	
  
    –  HIGH	
  (5	
  V)	
  
•  For	
  example:	
  	
  
    –  digitalWrite(13,	
  HIGH);	
  	
  
    –  digitalWrite(11,	
  LOW);	
  	
  
    	
  
Basic	
  Programming	
  
•  The	
  digitalRead()	
  func`on	
  reads	
  a	
  value	
  on	
  a	
  
   pin	
  (0	
  –	
  19).	
  	
  
•  Possible	
  values	
  are:	
  
    –  LOW	
  (0	
  V)	
  
    –  HIGH	
  (5	
  V)	
  
•  For	
  example:	
  	
  
    –  Int	
  x	
  =	
  digitalRead(13);	
  	
  
    –  Boolean	
  value	
  =	
  digitalRead(11);	
  	
  
    	
  
Basic	
  Programming	
  
•  The	
  analogWrite()	
  func`ons	
  outputs	
  a	
  PWM	
  
   value	
  on	
  a	
  pin	
  (3,5,6,9,10,11).	
  	
  
•  Possible	
  values	
  are:	
  
    –  0	
  (0	
  V)	
  
    –  127	
  (2,5	
  V)	
  
    –  255	
  (5	
  V)	
  
•  For	
  example:	
  	
  
    –  analogWrite(3,	
  0);	
  	
  
    –  analogWrite(11,	
  200);	
  	
  
    	
  
Basic	
  Programming	
  
•  The	
  analogRead()	
  func`ons	
  reads	
  analog	
  
   value	
  on	
  a	
  pin	
  (A0	
  –	
  A5).	
  	
  
•  Possible	
  values	
  are:	
  
    –  0	
  (0	
  V)	
  	
  
    –  512	
  (2,5	
  V)	
  
    –  1024	
  (5	
  V)	
  
•  For	
  example:	
  	
  
    –  Int	
  value	
  =	
  analogRead(0);	
  	
  
    –  Int	
  valueSensor	
  =	
  analogRead(5);	
  	
  
    	
  
Glossary of Arduino Programming
                        Terms	

Variable	
  Types:	
  


          int	

         Pos (32767) or neg (-32768) - 2 Bytes	

          long	

        Pos (2,147,483,647) or neg (-2,147,483,648) - 4B	

          float	

        Floating point math (0,0000001) – 4B	

          char	

        Character values: a , b , D , 1 – 1B	

          boolean	

     True or false values – 1 bit	





  21
Loops	

• Loops allow code to be repeated	

        –  Repeated code goes in a block, surrounded by { }	

        –  for loops	

           •  need a counter	

        –  while loops	

               need an escape	

        int •  i;                  // declare counter!
        !
        for ( i=0; i<=12; i++ ) { // standard structure!
        !
           Serial.println(i); // send value of i to serial monitor!
        !
        }!

22
Loops	

                        Ini`al	
  value	
  of	
  counter	
  
                        i=0	
  only	
  on	
  first	
  pass	
  through	
  the	
  loop	
  
                            Stopping	
  test:	
  	
  Con`nue	
  while	
  this	
  
                            condi`on	
  is	
  true	
  

        int i;                     // declare counter!
        !
        for ( i=0; i<=12; i++ ) { // standard structure!
        !
           Serial.println(i); // send value of i to serial monitor!
        !
        }!

                                   Increment:	
  	
  How	
  to	
  change	
  i	
  on	
  each	
  
                                   pass	
  through	
  the	
  loop	
  
23
Loops	

        Common	
  loop:	
  increment	
  by	
  one	
  
            for ( i=0; i<=12; i++ ) { //                increment by one!
               ... code block goes here!
            }!

        Common	
  loop:	
  increment	
  by	
  two	
  
            for ( i=0; i<=12; i+=2 ) { //                increment by two!
               ... code block goes here!
            }!

        Decrement	
  by	
  one	
  
            for ( i=12; i>=0; i-- ) { //                decrement by one!
               ... code block goes here!
            }!


24
Input	
  Bujon	
  
Pin	
  2	
  
	

void setup() 	

{ 	

      	

pinMode(13, OUTPUT);         	

      	

// declare LED as output 	

      	

pinMode(2, INPUT); 	

       	

      	

// declare switch as input 	

} 	

	

void loop() 	

{ 	

      	

if (digitalRead(2) == HIGH) 	

       	

// check if input is HIGH 	

      	

{ 	

               digitalWrite(13, HIGH);	

// turns the LED on 	

               delay(1000); 	

   	

 	

      	

// pause for 1 second 	

               digitalWrite(13, LOW); 	

// turns the LED off 	

               delay(1000); 	

   	

 	

      	

// pause for 1 second 	

      	

} 	

}
hjp://processing.org/	
  
                            Now	
  connect	
  with	
  Processing...	
  

       hjp://io.workspace.howest.be/Workshop/MM.zip	
  

Ref:	
  GeJng	
  Started	
  with	
  Processing	
  –	
  Casey	
  Reas	
  &	
  Ben	
  Fry	
  (O’REILLY	
  –	
  2010)	
  
What	
  is	
  Processing	
  ?	
  
	
  
	
  
       Create	
  images,	
  anima`ons	
  and	
  interac`ons	
  
                              through	
  
                          	
  “sketching”
                            with	
  code	
  
What	
  is	
  Processing	
  ?	
  

	
  
Software
Prototyping_
What	
  is	
  Processing	
  ?	
  
Family	
  Tree	
  
Assignment	
  for	
  today...	
  

          DESIGN	
  YOUR	
  
          ENTERTAINMENT	
  SYSTEM	
  
Example	
  running	
  zelda	
  
Example	
  Kirby’s	
  flying	
  adventure	
  
Example	
  threadmill	
  supermario	
  
Example	
  Smoking	
  IR-­‐Gun	
  
Principle	
  for	
  game	
  interface	
  
                                                     Sensors	
  

                                      READ	
  
         Your	
  
        Sketch	
  
          [C]	
  
                                inputs	
  
       UPLOAD	
  
                      ARDUINO	
      ATmega328	
  
    COMMUNICATE	
  
                               outputs	
  
                                                     Actuators	
  



                                     WRITE	
  
Principle	
  for	
  game	
  interface	
  
                                                               Sensors	
  

                                                READ	
  
        Bujon_	
  
       communi-­‐
       ca`on.pde	
  
                                          inputs	
  
       UPLOAD	
  
                               ARDUINO	
       ATmega328	
  
    COMMUNICATE	
  
                                         outputs	
  




                                        Nintendo	
  NES	
  
                       Processing	
  
                                         (emulator)	
  
Bujon_communica`on.pde	
  
•    hjp://www.arduino.cc/en/Tutorial/Bujon	
  

            void setup() {	

                 	

Serial.begin(9600);	

                 	

pinMode(ledPin, OUTPUT); 	

                 	

pinMode(buttonPin, INPUT); 	

            }	

            	

            void loop(){	

                 	

buttonState = digitalRead(buttonPin);	

            	

                 	

if (buttonState == HIGH) { 	

                 	

      	

Serial.print(‘LEFT', BYTE);	

                 	

      	

digitalWrite(ledPin, HIGH); 	

                 	

} 	

                 	

else {	

                 	

      	

Serial.print(‘RIGHT', BYTE);	

                 	

      	

digitalWrite(ledPin, LOW); 	

                 	

 }	

                 	

delay(15);	

            }
Processing	
  Code	
  
•  basic_example_vNESp5_arduino.pde	
  
Resources	
  	
  
•      hjp://www.arduino.cc/	
  
•      hjp://processing.org/	
  
•      hjp://mcanet.info/vNESp5/	
  
•      hjp://io.workspace.howest.be/Workshop/MM.zip	
  

	
  

More Related Content

What's hot

Arduino Day 1 Presentation
Arduino Day 1 PresentationArduino Day 1 Presentation
Arduino Day 1 Presentation
Yogendra Tamang
 
Cassiopeia Ltd - standard Arduino workshop
Cassiopeia Ltd - standard Arduino workshopCassiopeia Ltd - standard Arduino workshop
Cassiopeia Ltd - standard Arduino workshop
tomtobback
 
Arduino Workshop Day 2
Arduino  Workshop Day 2Arduino  Workshop Day 2
Arduino Workshop Day 2
Yogendra Tamang
 
Arduino اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينو
salih mahmod
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3
Jeni Shah
 
Mao arduino
Mao arduinoMao arduino
Mao arduinoMao Wu
 
Arduino: Analog I/O
Arduino: Analog I/OArduino: Analog I/O
Arduino: Analog I/OJune-Hao Hou
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the ArduinoWingston
 
DSL Junior Makers - electronics workshop
DSL Junior Makers - electronics workshopDSL Junior Makers - electronics workshop
DSL Junior Makers - electronics workshop
tomtobback
 
Arduino slides
Arduino slidesArduino slides
Arduino slides
sdcharle
 
Arduino 8-step drum sequencer 3 channels
Arduino 8-step drum sequencer 3 channelsArduino 8-step drum sequencer 3 channels
Arduino 8-step drum sequencer 3 channels
tomtobback
 
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.
 
Intro to Arduino Revision #2
Intro to Arduino Revision #2Intro to Arduino Revision #2
Intro to Arduino Revision #2
Qtechknow
 
Arduino Foundations
Arduino FoundationsArduino Foundations
Arduino Foundations
John Breslin
 
The IoT Academy IoT Training Arduino Part 3 programming
The IoT Academy IoT Training Arduino Part 3 programmingThe IoT Academy IoT Training Arduino Part 3 programming
The IoT Academy IoT Training Arduino Part 3 programming
The IOT Academy
 
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
 
LED Cube Presentation Slides
LED Cube Presentation Slides LED Cube Presentation Slides
LED Cube Presentation Slides
Projects EC
 

What's hot (20)

Arduino Day 1 Presentation
Arduino Day 1 PresentationArduino Day 1 Presentation
Arduino Day 1 Presentation
 
Cassiopeia Ltd - standard Arduino workshop
Cassiopeia Ltd - standard Arduino workshopCassiopeia Ltd - standard Arduino workshop
Cassiopeia Ltd - standard Arduino workshop
 
Arduino
ArduinoArduino
Arduino
 
Arduino Workshop Day 2
Arduino  Workshop Day 2Arduino  Workshop Day 2
Arduino Workshop Day 2
 
Arduino اردوينو
Arduino اردوينوArduino اردوينو
Arduino اردوينو
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3
 
Mao arduino
Mao arduinoMao arduino
Mao arduino
 
Arduino: Analog I/O
Arduino: Analog I/OArduino: Analog I/O
Arduino: Analog I/O
 
Introduction to the Arduino
Introduction to the ArduinoIntroduction to the Arduino
Introduction to the Arduino
 
DSL Junior Makers - electronics workshop
DSL Junior Makers - electronics workshopDSL Junior Makers - electronics workshop
DSL Junior Makers - electronics workshop
 
Arduino slides
Arduino slidesArduino slides
Arduino slides
 
Arduino 8-step drum sequencer 3 channels
Arduino 8-step drum sequencer 3 channelsArduino 8-step drum sequencer 3 channels
Arduino 8-step drum sequencer 3 channels
 
Physical prototyping lab1-input_output (2)
Physical prototyping lab1-input_output (2)Physical prototyping lab1-input_output (2)
Physical prototyping lab1-input_output (2)
 
Intro to Arduino Revision #2
Intro to Arduino Revision #2Intro to Arduino Revision #2
Intro to Arduino Revision #2
 
Arduino Foundations
Arduino FoundationsArduino Foundations
Arduino Foundations
 
The IoT Academy IoT Training Arduino Part 3 programming
The IoT Academy IoT Training Arduino Part 3 programmingThe IoT Academy IoT Training Arduino Part 3 programming
The IoT Academy IoT Training Arduino Part 3 programming
 
Simply arduino
Simply arduinoSimply arduino
Simply arduino
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
LED Cube Presentation Slides
LED Cube Presentation Slides LED Cube Presentation Slides
LED Cube Presentation Slides
 

Viewers also liked

Makeymakey
MakeymakeyMakeymakey
Makeymakey
hwhitt
 
Makey Makey NYSCATE 2014
Makey Makey NYSCATE 2014Makey Makey NYSCATE 2014
Makey Makey NYSCATE 2014
TechwithMr Tepedino
 
Makey makey
Makey makeyMakey makey
Makey makey
aliarguellesh
 
Bloxels vs makey makey
Bloxels vs makey makeyBloxels vs makey makey
Bloxels vs makey makey
Youssef Moussa
 
Makey Makey
Makey MakeyMakey Makey
Makey Makey
陳 媛婷
 
Makey makey
Makey makeyMakey makey
Makey makey
alhondiga
 
Makey Makey NYSCATE 2014
Makey Makey NYSCATE 2014Makey Makey NYSCATE 2014
Makey Makey NYSCATE 2014
TechwithMr Tepedino
 
Introducing Engineering in Elementary Classroom
Introducing Engineering in Elementary ClassroomIntroducing Engineering in Elementary Classroom
Introducing Engineering in Elementary Classroom
Gennafer Barajas
 
Makey makey x les
Makey makey x lesMakey makey x les
Makey makey x les
aliarguellesh
 
Scratch day
Scratch dayScratch day
Scratch day
escolacarlesdalmau
 
Kom igång med Makey Makey
Kom igång med Makey MakeyKom igång med Makey Makey
Kom igång med Makey Makey
Marie Gustafsson Friberger
 
Makey makey
Makey makeyMakey makey
Makey makey凱 邱
 
Instructions for Scratch Pong Game Adaptation to use with MaKey MaKey
Instructions for Scratch Pong Game Adaptation to use with MaKey MaKeyInstructions for Scratch Pong Game Adaptation to use with MaKey MaKey
Instructions for Scratch Pong Game Adaptation to use with MaKey MaKeyRenee Neumeier
 
Taller makey makey + scracth + wedo (1)
Taller makey makey + scracth + wedo (1)Taller makey makey + scracth + wedo (1)
Taller makey makey + scracth + wedo (1)
baixcost
 
Circuits with Makey Makey
Circuits with Makey MakeyCircuits with Makey Makey
Circuits with Makey Makey
macleanpublic
 
Makey makey
Makey makeyMakey makey
Makey makey
eTwinning España
 
Y5-6 Forces and Electricity Teaching Ideas J Villis
Y5-6 Forces and Electricity Teaching Ideas J VillisY5-6 Forces and Electricity Teaching Ideas J Villis
Y5-6 Forces and Electricity Teaching Ideas J Villis
Joanne Villis
 
Makey bluetooth2
Makey  bluetooth2Makey  bluetooth2
Makey bluetooth2
baixcost
 
Challenge Based Learning in Makerspaces: How to Use Design to Develop Creativity
Challenge Based Learning in Makerspaces: How to Use Design to Develop CreativityChallenge Based Learning in Makerspaces: How to Use Design to Develop Creativity
Challenge Based Learning in Makerspaces: How to Use Design to Develop Creativity
Diana Rendina
 
Spelen met STEM
Spelen met STEMSpelen met STEM
Spelen met STEM
Mediaraven vzw
 

Viewers also liked (20)

Makeymakey
MakeymakeyMakeymakey
Makeymakey
 
Makey Makey NYSCATE 2014
Makey Makey NYSCATE 2014Makey Makey NYSCATE 2014
Makey Makey NYSCATE 2014
 
Makey makey
Makey makeyMakey makey
Makey makey
 
Bloxels vs makey makey
Bloxels vs makey makeyBloxels vs makey makey
Bloxels vs makey makey
 
Makey Makey
Makey MakeyMakey Makey
Makey Makey
 
Makey makey
Makey makeyMakey makey
Makey makey
 
Makey Makey NYSCATE 2014
Makey Makey NYSCATE 2014Makey Makey NYSCATE 2014
Makey Makey NYSCATE 2014
 
Introducing Engineering in Elementary Classroom
Introducing Engineering in Elementary ClassroomIntroducing Engineering in Elementary Classroom
Introducing Engineering in Elementary Classroom
 
Makey makey x les
Makey makey x lesMakey makey x les
Makey makey x les
 
Scratch day
Scratch dayScratch day
Scratch day
 
Kom igång med Makey Makey
Kom igång med Makey MakeyKom igång med Makey Makey
Kom igång med Makey Makey
 
Makey makey
Makey makeyMakey makey
Makey makey
 
Instructions for Scratch Pong Game Adaptation to use with MaKey MaKey
Instructions for Scratch Pong Game Adaptation to use with MaKey MaKeyInstructions for Scratch Pong Game Adaptation to use with MaKey MaKey
Instructions for Scratch Pong Game Adaptation to use with MaKey MaKey
 
Taller makey makey + scracth + wedo (1)
Taller makey makey + scracth + wedo (1)Taller makey makey + scracth + wedo (1)
Taller makey makey + scracth + wedo (1)
 
Circuits with Makey Makey
Circuits with Makey MakeyCircuits with Makey Makey
Circuits with Makey Makey
 
Makey makey
Makey makeyMakey makey
Makey makey
 
Y5-6 Forces and Electricity Teaching Ideas J Villis
Y5-6 Forces and Electricity Teaching Ideas J VillisY5-6 Forces and Electricity Teaching Ideas J Villis
Y5-6 Forces and Electricity Teaching Ideas J Villis
 
Makey bluetooth2
Makey  bluetooth2Makey  bluetooth2
Makey bluetooth2
 
Challenge Based Learning in Makerspaces: How to Use Design to Develop Creativity
Challenge Based Learning in Makerspaces: How to Use Design to Develop CreativityChallenge Based Learning in Makerspaces: How to Use Design to Develop Creativity
Challenge Based Learning in Makerspaces: How to Use Design to Develop Creativity
 
Spelen met STEM
Spelen met STEMSpelen met STEM
Spelen met STEM
 

Similar to Programming arduino makeymakey

arduino.ppt
arduino.pptarduino.ppt
arduino.ppt
sunilkumar652338
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
Luki B. Subekti
 
Arduino intro.pptx
Arduino intro.pptxArduino intro.pptx
Arduino intro.pptx
SanthanaMari11
 
Arduino Workshop (3).pptx
Arduino Workshop (3).pptxArduino Workshop (3).pptx
Arduino Workshop (3).pptx
HebaEng
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino Microcontroller
Mujahid Hussain
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
Kishor Mhaske
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
ZainIslam20
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
AkhandPratapSingh86
 
Arduino workshop
Arduino workshopArduino workshop
Arduino workshop
mayur1432
 
Basics of arduino uno
Basics of arduino unoBasics of arduino uno
Basics of arduino uno
Rahat Sood
 
IOTC08 The Arduino Platform
IOTC08 The Arduino PlatformIOTC08 The Arduino Platform
IOTC08 The Arduino Platform
Eoin Brazil
 
Arduino Programming Familiarization
Arduino Programming FamiliarizationArduino Programming Familiarization
Arduino Programming Familiarization
Amit Kumer Podder
 
How to use an Arduino
How to use an ArduinoHow to use an Arduino
How to use an Arduino
AntonAndreev13
 
Arduino: Intro and Digital I/O
Arduino: Intro and Digital I/OArduino: Intro and Digital I/O
Arduino: Intro and Digital I/O
June-Hao Hou
 
01_DIGITAL IO.pptx
01_DIGITAL IO.pptx01_DIGITAL IO.pptx
01_DIGITAL IO.pptx
ssuser593a2d
 
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
 
Fun with arduino
Fun with arduinoFun with arduino
Fun with arduino
Ravikumar Tiwari
 
Microcontroller_basics_lesson1_2019 (1).pptx
Microcontroller_basics_lesson1_2019 (1).pptxMicrocontroller_basics_lesson1_2019 (1).pptx
Microcontroller_basics_lesson1_2019 (1).pptx
HebaEng
 

Similar to Programming arduino makeymakey (20)

Arduino Programming Basic
Arduino Programming BasicArduino Programming Basic
Arduino Programming Basic
 
arduino.ppt
arduino.pptarduino.ppt
arduino.ppt
 
Introduction to Arduino
Introduction to ArduinoIntroduction to Arduino
Introduction to Arduino
 
Arduino intro.pptx
Arduino intro.pptxArduino intro.pptx
Arduino intro.pptx
 
Arduino Workshop (3).pptx
Arduino Workshop (3).pptxArduino Workshop (3).pptx
Arduino Workshop (3).pptx
 
Day1
Day1Day1
Day1
 
Introduction to Arduino Microcontroller
Introduction to Arduino MicrocontrollerIntroduction to Arduino Microcontroller
Introduction to Arduino Microcontroller
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
 
arduinoSimon.ppt
arduinoSimon.pptarduinoSimon.ppt
arduinoSimon.ppt
 
Arduino workshop
Arduino workshopArduino workshop
Arduino workshop
 
Basics of arduino uno
Basics of arduino unoBasics of arduino uno
Basics of arduino uno
 
IOTC08 The Arduino Platform
IOTC08 The Arduino PlatformIOTC08 The Arduino Platform
IOTC08 The Arduino Platform
 
Arduino Programming Familiarization
Arduino Programming FamiliarizationArduino Programming Familiarization
Arduino Programming Familiarization
 
How to use an Arduino
How to use an ArduinoHow to use an Arduino
How to use an Arduino
 
Arduino: Intro and Digital I/O
Arduino: Intro and Digital I/OArduino: Intro and Digital I/O
Arduino: Intro and Digital I/O
 
01_DIGITAL IO.pptx
01_DIGITAL IO.pptx01_DIGITAL IO.pptx
01_DIGITAL IO.pptx
 
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
 
Fun with arduino
Fun with arduinoFun with arduino
Fun with arduino
 
Microcontroller_basics_lesson1_2019 (1).pptx
Microcontroller_basics_lesson1_2019 (1).pptxMicrocontroller_basics_lesson1_2019 (1).pptx
Microcontroller_basics_lesson1_2019 (1).pptx
 

More from Industrial Design Center

Whist TIII presentation
Whist TIII presentationWhist TIII presentation
Whist TIII presentation
Industrial Design Center
 
Tiii presentation by dr. ir S.A.G. Stephan Wensveen
Tiii presentation by dr. ir S.A.G. Stephan WensveenTiii presentation by dr. ir S.A.G. Stephan Wensveen
Tiii presentation by dr. ir S.A.G. Stephan Wensveen
Industrial Design Center
 
Presentation pitch projects
Presentation pitch projectsPresentation pitch projects
Presentation pitch projects
Industrial Design Center
 
TIII team: Presentation final event [CUO]
TIII team: Presentation final event [CUO]TIII team: Presentation final event [CUO]
TIII team: Presentation final event [CUO]
Industrial Design Center
 
TIII team: Presentation final event [KULeuven]
TIII team: Presentation final event [KULeuven]TIII team: Presentation final event [KULeuven]
TIII team: Presentation final event [KULeuven]
Industrial Design Center
 
TIII team: Presentation final event
TIII team: Presentation final eventTIII team: Presentation final event
TIII team: Presentation final event
Industrial Design Center
 
Sirris presentation
Sirris presentationSirris presentation
Sirris presentation
Industrial Design Center
 
Softkinetic user interface evolution by Ilse Ravyse and Tanya Varbanove
Softkinetic user interface evolution by Ilse Ravyse and Tanya VarbanoveSoftkinetic user interface evolution by Ilse Ravyse and Tanya Varbanove
Softkinetic user interface evolution by Ilse Ravyse and Tanya Varbanove
Industrial Design Center
 
TIII presentation by Jelle Saldien and Jolien De Ville
TIII presentation by Jelle Saldien and Jolien De VilleTIII presentation by Jelle Saldien and Jolien De Ville
TIII presentation by Jelle Saldien and Jolien De Ville
Industrial Design Center
 
Smart textiles talk by Lieva Van langenhove
Smart textiles talk by Lieva Van langenhoveSmart textiles talk by Lieva Van langenhove
Smart textiles talk by Lieva Van langenhove
Industrial Design Center
 
Arduino talk by Toon Nelissen
Arduino talk by Toon Nelissen Arduino talk by Toon Nelissen
Arduino talk by Toon Nelissen
Industrial Design Center
 

More from Industrial Design Center (20)

Whist TIII presentation
Whist TIII presentationWhist TIII presentation
Whist TIII presentation
 
Tiii presentation by dr. ir S.A.G. Stephan Wensveen
Tiii presentation by dr. ir S.A.G. Stephan WensveenTiii presentation by dr. ir S.A.G. Stephan Wensveen
Tiii presentation by dr. ir S.A.G. Stephan Wensveen
 
Presentation pitch projects
Presentation pitch projectsPresentation pitch projects
Presentation pitch projects
 
TIII team: Presentation final event [CUO]
TIII team: Presentation final event [CUO]TIII team: Presentation final event [CUO]
TIII team: Presentation final event [CUO]
 
TIII team: Presentation final event [KULeuven]
TIII team: Presentation final event [KULeuven]TIII team: Presentation final event [KULeuven]
TIII team: Presentation final event [KULeuven]
 
TIII team: Presentation final event
TIII team: Presentation final eventTIII team: Presentation final event
TIII team: Presentation final event
 
Smart textiles
Smart textilesSmart textiles
Smart textiles
 
Sirris presentation
Sirris presentationSirris presentation
Sirris presentation
 
Softkinetic user interface evolution by Ilse Ravyse and Tanya Varbanove
Softkinetic user interface evolution by Ilse Ravyse and Tanya VarbanoveSoftkinetic user interface evolution by Ilse Ravyse and Tanya Varbanove
Softkinetic user interface evolution by Ilse Ravyse and Tanya Varbanove
 
3 d scanning howest summer classes 2012
3 d scanning   howest summer classes 20123 d scanning   howest summer classes 2012
3 d scanning howest summer classes 2012
 
3 d scanning howest summer classes 2012
3 d scanning   howest summer classes 20123 d scanning   howest summer classes 2012
3 d scanning howest summer classes 2012
 
Product photography summer school
Product photography   summer schoolProduct photography   summer school
Product photography summer school
 
Illumination in new ways jacob rader
Illumination in new ways   jacob raderIllumination in new ways   jacob rader
Illumination in new ways jacob rader
 
TIII presentation by Jelle Saldien and Jolien De Ville
TIII presentation by Jelle Saldien and Jolien De VilleTIII presentation by Jelle Saldien and Jolien De Ville
TIII presentation by Jelle Saldien and Jolien De Ville
 
Smart textiles talk by Lieva Van langenhove
Smart textiles talk by Lieva Van langenhoveSmart textiles talk by Lieva Van langenhove
Smart textiles talk by Lieva Van langenhove
 
Arduino talk by Toon Nelissen
Arduino talk by Toon Nelissen Arduino talk by Toon Nelissen
Arduino talk by Toon Nelissen
 
Briefing workshop laser cutting eng 2012
Briefing workshop laser cutting eng 2012Briefing workshop laser cutting eng 2012
Briefing workshop laser cutting eng 2012
 
Workshop diy 3 d printing makerbots 2012
Workshop diy 3 d printing   makerbots 2012Workshop diy 3 d printing   makerbots 2012
Workshop diy 3 d printing makerbots 2012
 
Prototyping with silicone
Prototyping with siliconePrototyping with silicone
Prototyping with silicone
 
Lékué history
Lékué historyLékué history
Lékué history
 

Recently uploaded

Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
Neo4j
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
Matthew Sinclair
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
Neo4j
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 

Recently uploaded (20)

Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
GraphSummit Singapore | Neo4j Product Vision & Roadmap - Q2 2024
 
20240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 202420240605 QFM017 Machine Intelligence Reading List May 2024
20240605 QFM017 Machine Intelligence Reading List May 2024
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
GraphSummit Singapore | Graphing Success: Revolutionising Organisational Stru...
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 

Programming arduino makeymakey

  • 1. Workshop  Makey  Makey   (Arduino)   Jelle.saldien@howest.be  
  • 3. Principle   Sensors   READ   Your   Sketch   [C]   inputs   UPLOAD   ARDUINO   ATmega328   COMMUNICATE   outputs   Actuators   WRITE  
  • 8. Arduino  Board   Microcontroller ATmega328   Opera-ng  Voltage 5  V   Input  Voltage  (recommended) 7-­‐12  V   Input  Voltage  (limits) 6-­‐20  V   Digital  I/O  Pins 14  (of  which  6  provide  PWM  output) Analog  Input  Pins 6 DC  Current  per  I/O  Pin 40  mA   DC  Current  for  3.3V  Pin 50  mA 32  KB  (ATmega328)  of  which  2  KB  used  by   Flash  Memory bootloader   SRAM 2  KB  (ATmega328) EEPROM 1  KB  (ATmega328) Clock  Speed 16  MHz
  • 9. Arduino  IDE   •  IDE:   –  Integrated   –  Development   –  Environment  
  • 10. Code  Structure:  setup  func`on   setup  func`on  is  executed   only  once  at  the  start   10  
  • 11. Code  Structure:  loop  func`on   loop  func`on  is   repeated  indefinitely   11  
  • 12. Code   pinMode(13, Output)! prepare  pin  13  for   outputs  of  voltage   Digital  I/O  Func`ons:   pinMode   digitalWrite   digitalRead   12  
  • 13. Code   digitalWrite(13, HIGH)! Sets  pin  13  to  a  voltage  that   means  “on”   Digital  I/O  Func`ons:    pinMode    digitalWrite    digitalRead   13  
  • 14. Code   delay(1000);! Tells  microcontroller  to  do   nothing  for  1000  ms  =  1  s   Digital  I/O  Func`ons:    pinMode    digitalWrite    digitalRead   14  
  • 15. Code   digitalWrite(13, LOW)! Sets  pin  13  to  voltage   that  means  “off”   Digital  I/O  Func`ons:    pinMode    digitalWrite    digitalRead   15  
  • 16. Basic  Programming   •  The  pinMode()  func`on  configures  a  pin  as   either  an  input  or  an  output.  To  use  it:   –  You  pass  it  the  number  of  the  pin  to  configure   and  the  constant  INPUT  or  OUTPUT.     •  pinMode(11,  INPUT);   •  pinMode(13,  OUTPUT);     –  When  configured  as  an  input,  a  pin  can  detect  the   state  of  a  sensor  like  a  pushbujon.     –  As  an  output,  it  can  drive  an  actuator  like  an  LED.    
  • 17. Basic  Programming   •  The  digitalWrite()  func`ons  outputs  a  value   on  a  pin  (0  –  19).     •  Possible  values  are:   –  LOW  (0  V)     –  HIGH  (5  V)   •  For  example:     –  digitalWrite(13,  HIGH);     –  digitalWrite(11,  LOW);      
  • 18. Basic  Programming   •  The  digitalRead()  func`on  reads  a  value  on  a   pin  (0  –  19).     •  Possible  values  are:   –  LOW  (0  V)   –  HIGH  (5  V)   •  For  example:     –  Int  x  =  digitalRead(13);     –  Boolean  value  =  digitalRead(11);      
  • 19. Basic  Programming   •  The  analogWrite()  func`ons  outputs  a  PWM   value  on  a  pin  (3,5,6,9,10,11).     •  Possible  values  are:   –  0  (0  V)   –  127  (2,5  V)   –  255  (5  V)   •  For  example:     –  analogWrite(3,  0);     –  analogWrite(11,  200);      
  • 20. Basic  Programming   •  The  analogRead()  func`ons  reads  analog   value  on  a  pin  (A0  –  A5).     •  Possible  values  are:   –  0  (0  V)     –  512  (2,5  V)   –  1024  (5  V)   •  For  example:     –  Int  value  =  analogRead(0);     –  Int  valueSensor  =  analogRead(5);      
  • 21. Glossary of Arduino Programming Terms Variable  Types:   int Pos (32767) or neg (-32768) - 2 Bytes long Pos (2,147,483,647) or neg (-2,147,483,648) - 4B float Floating point math (0,0000001) – 4B char Character values: a , b , D , 1 – 1B boolean True or false values – 1 bit 21
  • 22. Loops • Loops allow code to be repeated –  Repeated code goes in a block, surrounded by { } –  for loops •  need a counter –  while loops need an escape int •  i; // declare counter! ! for ( i=0; i<=12; i++ ) { // standard structure! ! Serial.println(i); // send value of i to serial monitor! ! }! 22
  • 23. Loops Ini`al  value  of  counter   i=0  only  on  first  pass  through  the  loop   Stopping  test:    Con`nue  while  this   condi`on  is  true   int i; // declare counter! ! for ( i=0; i<=12; i++ ) { // standard structure! ! Serial.println(i); // send value of i to serial monitor! ! }! Increment:    How  to  change  i  on  each   pass  through  the  loop   23
  • 24. Loops Common  loop:  increment  by  one   for ( i=0; i<=12; i++ ) { // increment by one! ... code block goes here! }! Common  loop:  increment  by  two   for ( i=0; i<=12; i+=2 ) { // increment by two! ... code block goes here! }! Decrement  by  one   for ( i=12; i>=0; i-- ) { // decrement by one! ... code block goes here! }! 24
  • 25. Input  Bujon   Pin  2   void setup() { pinMode(13, OUTPUT); // declare LED as output pinMode(2, INPUT); // declare switch as input } void loop() { if (digitalRead(2) == HIGH) // check if input is HIGH { digitalWrite(13, HIGH); // turns the LED on delay(1000); // pause for 1 second digitalWrite(13, LOW); // turns the LED off delay(1000); // pause for 1 second } }
  • 26. hjp://processing.org/   Now  connect  with  Processing...   hjp://io.workspace.howest.be/Workshop/MM.zip   Ref:  GeJng  Started  with  Processing  –  Casey  Reas  &  Ben  Fry  (O’REILLY  –  2010)  
  • 27. What  is  Processing  ?       Create  images,  anima`ons  and  interac`ons   through    “sketching” with  code  
  • 28. What  is  Processing  ?     Software Prototyping_
  • 31. Assignment  for  today...   DESIGN  YOUR   ENTERTAINMENT  SYSTEM  
  • 36. Principle  for  game  interface   Sensors   READ   Your   Sketch   [C]   inputs   UPLOAD   ARDUINO   ATmega328   COMMUNICATE   outputs   Actuators   WRITE  
  • 37. Principle  for  game  interface   Sensors   READ   Bujon_   communi-­‐ ca`on.pde   inputs   UPLOAD   ARDUINO   ATmega328   COMMUNICATE   outputs   Nintendo  NES   Processing   (emulator)  
  • 38. Bujon_communica`on.pde   •  hjp://www.arduino.cc/en/Tutorial/Bujon   void setup() { Serial.begin(9600); pinMode(ledPin, OUTPUT); pinMode(buttonPin, INPUT); } void loop(){ buttonState = digitalRead(buttonPin); if (buttonState == HIGH) { Serial.print(‘LEFT', BYTE); digitalWrite(ledPin, HIGH); } else { Serial.print(‘RIGHT', BYTE); digitalWrite(ledPin, LOW); } delay(15); }
  • 39. Processing  Code   •  basic_example_vNESp5_arduino.pde  
  • 40. Resources     •  hjp://www.arduino.cc/   •  hjp://processing.org/   •  hjp://mcanet.info/vNESp5/   •  hjp://io.workspace.howest.be/Workshop/MM.zip