Go Down

Topic: MIDI in: hardware works, software has a bug (Read 722 times) previous topic - next topic


Jan 16, 2011, 10:35 pm Last Edit: Jan 16, 2011, 10:38 pm by KaOS-bEat Reason: 1
I put together an small midi-interface according to the notes in http://www.arduino.cc/playground/Main/MIDILibrary

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
Code: [Select]

void setnote5() {
 analogWrite(audioPin1, 127);
 analogWrite(audioPin2, 100);
 analogWrite(audioPin3, 255);

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

Code: [Select]

void loop() {
 if (MIDI.read()) {                  
   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

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131