Presentation is loading. Please wait.

Presentation is loading. Please wait.

Making Music with VEX Mike Martin King High School, Riverside, CA

Similar presentations


Presentation on theme: "Making Music with VEX Mike Martin King High School, Riverside, CA"— Presentation transcript:

1 Making Music with VEX Mike Martin King High School, Riverside, CA
PLTW State Conference – February 19, 2015

2 Introduction Teaching kids to write programming code has become a priority for STEM programs like PLTW. 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 POE 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 VEX Cortex
How do we program a note? Frequency – each note must have a different frequency. Middle C – also called C4

6 Programming the VEX Cortex
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 VEX Cortex
How do we program a note? What command do we use to play a note on the VEX Cortex using RobotC?

8 Programming the VEX Cortex
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 VEX Cortex
How do we program a note? What will a loop look like?

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

11 Programming the VEX Cortex
How do we actually play the song on the Cortex? VEX speaker – plug into SP port in Digital section of Cortex Speaker is available for $9.99 Using some other speaker not recommended – bad sound

12 Using Switches to Play Music
Not only can we program the song into the Uno, but we can set up our own “VEX Keyboard” VEX switches are probably the easiest to access, since your school probably has POE or CIM. (Isn’t that why you’re here?  ) Momentary push-button switches can also be used.

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

14 Using Switches to Play Music
How do I program the Cortex 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 VEX Mike Martin King High School, Riverside, CA"

Similar presentations


Ads by Google