sources and files for the bombatuino project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
921 B

  1. /*
  2. MIDI note player
  3. This sketch shows how to use the serial transmit pin (pin 1) to send MIDI note data.
  4. If this circuit is connected to a MIDI synth, it will play
  5. the notes F#-0 (0x1E) to F#-5 (0x5A) in sequence.
  6. The circuit:
  7. * digital in 1 connected to MIDI jack pin 5
  8. * MIDI jack pin 2 connected to ground
  9. * MIDI jack pin 4 connected to +5V through 220-ohm resistor
  10. Attach a MIDI cable to the jack, then to a MIDI synth, and play music.
  11. created 13 Jun 2006
  12. modified 13 Aug 2012
  13. by Tom Igoe
  14. This example code is in the public domain.
  15. http://www.arduino.cc/en/Tutorial/Midi
  16. */
  17. void setup() {
  18. // Set MIDI baud rate:
  19. Serial.begin(9600);
  20. pinMode(2, INPUT);
  21. digitalWrite(2, HIGH);
  22. pinMode(3, OUTPUT);
  23. }
  24. void loop() {
  25. button();
  26. }
  27. void button() {
  28. int sensorVal = digitalRead(2);
  29. if (sensorVal == HIGH) {
  30. digitalWrite(3, LOW);
  31. }
  32. else {
  33. digitalWrite(3, HIGH);
  34. }
  35. }