Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Nov 16th, 2012  |  syntax: None  |  size: 0.47 KB  |  views: 149  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <MIDI.h>
  2.  
  3. #define LED 13                  // LED pin on Arduino board
  4.  
  5. void setup() {
  6.   pinMode(LED, OUTPUT);
  7.   pinMode(2,INPUT);
  8.   MIDI.begin(4);                // Launch MIDI with default options
  9.                                 // input channel is set to 4
  10. }
  11.  
  12. void loop() {
  13.   if (digitalRead(2)){
  14.     digitalWrite(LED,HIGH);     // Blink the LED
  15.     MIDI.sendNoteOn(42,127,1);  // Send a Note (pitch 42, velo 127 on channel 1)   // Stop the note
  16.        
  17.   }else{
  18.     digitalWrite(LED,LOW);  
  19.   }
  20. }