Pages: [1]   Go Down
Author Topic: MIDI in: hardware works, software has a bug  (Read 502 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 21
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I put together an small midi-interface according to the notes in
The test program works, and now I wanted to use my midi keyboard to drive my Atari Punk Console

through midi. I successfully patched the APC through arduino, so I now what pins to change etc. The thing is:

It will only succeed once, then the program crashes. Also it won't work on the first try. I have to bash the keyboard till I get "lucky" and then it could be any key that would have worked.

basically I just set some analogue pins to make other sounds
void setnote5() {
  analogWrite(audioPin1, 127);
  analogWrite(audioPin2, 100);
  analogWrite(audioPin3, 255);

and then the mainloop checks for midi notes and maps the notes:

void loop() {
  if ( {                  
    switch(MIDI.getType()) {            
      case NoteOn:
        switch(MIDI.getData2()) {
         case 36:
         case 37:
         case 38:
         case 39:
         case 40:
      case NoteOff:

What is wrong in this simple code? Sometimes it will really set the pins to the right voltages, but only once, and also a random note.

Thanks for any input
« Last Edit: January 16, 2011, 04:38:57 pm by KaOS-bEat » Logged

Pages: [1]   Go Up
Jump to: