Hi Adam.
Thanks for your fast response... and I have only one thing to say..... LOL!!! XD of all the pins that mbed have I have to choose 1 of the 2 that can't drive the interrupts to do my test hahaha. (my bad... I know, I'm allways telling "read the datasheet" when someone ask me for something about a uC)
Well, I went back to my original code and start to "clean" in a diferent way and found the one line that cause the problem.
Here's my code:
#include "mbed.h"
#include "Mpr121.h"
#include "USBMIDI.h"
DigitalOut myled(LED1);
DigitalOut timer(LED4);
Mpr121 touch( p28, p27, p26, ADD_VSS);
USBMIDI midi;
void botones(void)
{
int botones = touch.rd_bot_h();
botones = (botones<<8)+ touch.rd_bot_l();
if( botones == 1)
{
midi.write(MIDIMessage::NoteOn(38));//botones));
// wait(0.25);
myled = !myled;
}
}
int main()
{
touch.attachInte(botones);
while(true)
{
midi.write(MIDIMessage::NoteOn(38));
wait(0.25);
midi.write(MIDIMessage::NoteOff(38));
wait(0.5);
timer = !timer;
}
}
The problem was the "wait(0.25);" inside the interrupt routine... I've commented it and it worked like a charm.
Anyway... I'll look why this wait cause a problem in the isr and works fine on the main loop.
Thank you very much again.
Rolando
PD: I wasn't even using the p20 on the first place... XD jsut a bad choice.
Hi all...
I have a problem with the interrupts... now if i make the simplest test with interrupts on it doesn't work. My mbed have been on it's box since a month ago until yesterday that I needed a midi input for some test. I used the USBMIDI lib and the MPR121 touch keypad from sparkfun... but when I press a key the program stop at all.
So, I've started to "clean" the code to find the problem and I've found that the problem was the "attach" of the interrupt. Here's my test program:
The program works fine as is, but when I uncomment the "inte.fall(&hola);" the program doesn't work (the led4 isn't blinking)
So, I'm a little confused.... any help would be good. (I have the LPC1768 MBED-005.1)
Thanks in advance.
Rolando.