/* Program completed on Friday October the 19th 2007 This is a programme made by Benoit H. G. Espinola to be used with the wiimote. Visit my blog : http://beart.wordpress.com/ The original context of this program was to control an study work in my art academy. Visit my art academy website : http://www.ecole-art-aix.fr/ With this programme/code ou are free: to Share - to copy, distribute and transmit the work to Remix - to adapt the work Under the following conditions: Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). Noncommercial. You may not use this work for commercial purposes. Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same or similar license to this one. More info about this in http://creativecommons.org/licenses/by-nc-sa/3.0/ */ //Switches off the sounds and the rumble, shows those are off with the leds : led3 and led 4 on = stop mode if wiimote.B then var.toc = false var.vibe = false wiimote.Rumble = false wiimote.Led1 = false wiimote.Led2 = false wiimote.Led3 = true wiimote.Led4 = true endif //turns on the rumble if wiimote.Up then var.vibe = true endif //turns off the rumbles if wiimote.Down then var.vibe = false endif //turns on the sound and default values for tempo (variable that sets the rhythm) and rumble, show it's set with the leds if wiimote.A then var.toc = true var.tempo = 500 wiimote.Led1 = true wiimote.Led2 = false wiimote.Led3 = false wiimote.Led4 = true endif //checks if it plays the sounds and if it rumbles, waits tempo ms between two sounds if var.toc then PlaySound("toc1.wav") wiimote.Rumble = var.vibe wait 100 ms wiimote.Rumble = false wait var.tempo - 100 ms PlaySound("toc2.wav") wiimote.Rumble = var.vibe wait 100 ms wiimote.Rumble = false wait var.tempo - 100 ms endif //decreases tempo value --> less time between the sounds --> rhythm more accelerated if wiimote.Plus then var.tempo = var.tempo - 5 //increases tempo value --> more time between the sounds --> rhythm slows down elseif wiimote.Minus then var.tempo = var.tempo + 5 endif //shows with the leds the rhythm : no leds on = very slow, led1 = slow, led1 and led2 = average, led1 to led3 = fast, all the leds = veryfast if var.toc = true then if (var.tempo <= 125) then wiimote.Led1 = true wiimote.Led2 = true wiimote.Led3 = true wiimote.Led4 = true elseif ((var.tempo > 125) & (var.tempo <= 375)) then wiimote.Led1 = true wiimote.Led2 = true wiimote.Led3 = true wiimote.Led4 = false elseif ((var.tempo > 375) & (var.tempo <= 625)) then wiimote.Led1 = true wiimote.Led2 = true wiimote.Led3 = false wiimote.Led4 = false elseif ((var.tempo > 625) & (var.tempo <= 875)) then wiimote.Led1 = true wiimote.Led2 = false wiimote.Led3 = false wiimote.Led4 = false elseif (var.tempo > 875) then wiimote.Led1 = false wiimote.Led2 = false wiimote.Led3 = false wiimote.Led4 = false endif endif if wiimote.Home & wiimote.B then ExitScript endif //end of the program