Presentation is loading. Please wait.

Presentation is loading. Please wait.

Making Music with the Arduino Uno Mike Martin King High School, Riverside, CA PLTW State Conference – February 19, 2015

Similar presentations


Presentation on theme: "Making Music with the Arduino Uno Mike Martin King High School, Riverside, CA PLTW State Conference – February 19, 2015"— Presentation transcript:

1 Making Music with the Arduino Uno Mike Martin King High School, Riverside, CA PLTW State Conference – February 19, 2015 mmartin@rusdlearns.net

2 Introduction Teaching kids to write programming code has become a priority for STEM programs like PLTW. Digital Electronics (DE) has moved from the Parallax Basic Stamp using PBASIC to the Arduino Uno. Many of our PLTW students are also involved with music, whether band, choir, or off-campus. Learning to program music can add another component to an already fun, challenging, and rewarding DE class.

3 Music Theory Frere Jacques / Brother John 4/4 Time Quarter Notes Half Notes Eighth Notes Measures - Bars What do you notice about the measures and bars?

4 Music Theory There are 4 groups of notes that are repeated twice. This allows us to simplify our programming.

5 Programming the Arduino How do we program a note? Frequency – each note must have a different frequency. Middle C – also called C4

6 Programming the Arduino How do we program a note? Let’s use Variables to represent each frequency. Let’s use Variables to also represent the quarter and half notes.

7 Programming the Arduino How do we program a note? What command do we use to play a note on the Uno?

8 Programming the Arduino How do we program a note? How do we ‘loop’ the notes that are being repeated? Let’s use a For loop:

9 Programming the Arduino How do we program a note? What will a loop look like?

10 Programming the Arduino How do we program the entire song? Put all of the For loops consecutive: void setup () { for (int i=0; i<2; i++) { body } for (int i=0; i<2; i++) { body } for (int i=0; i<2; i++) { body } for (int i=0; i<2; i++) { body }

11 Programming the Arduino How do we actually play the song on the Uno? Pin 12 (green wire) to positive Gnd (white wire) to 8-ohm resistor

12 Using Switches to Play Music Not only can we program the song into the Uno, but we can set up our own “Arduino Keyboard” VEX switches may be the easiest to access, if your school has POE or CIM. Momentary push-button switches can also be used.

13 Using Switches to Play Music How do I program the Uno to play music with switches?

14 Using Switches to Play Music How do I program the Uno to play music with switches?

15 Using Switches to Play Music Project Idea – a full keyboard! File available upon request.


Download ppt "Making Music with the Arduino Uno Mike Martin King High School, Riverside, CA PLTW State Conference – February 19, 2015"

Similar presentations


Ads by Google