I am testing a 3G Telit UL865-NAD module, my problem is that in order to debug, I need to print the response of each AT command that I send to the module, currently I use mbed2, I have been researching some ways and I use an example code that I attach, the problem is that when the interruption jumps, the program freezes and dies, I have not been able to understand why it happens.
Regards
Francisco
Cheers
Francisco
#include “mbed.h”
#include “rtos.h”
#include “SHTx/sht15.hpp”
#include
Serial pc(PB_6, PB_7, 9600);
Serial uart(PA_2, PA_3, 9600);
DigitalOut led1(PC_13);
DigitalOut led2(PA_0);
DigitalOut led4(PA_1);
void callback() {
// Note: you need to actually read from the serial to clear the RX interrupt
pc.printf(“%c\r\n”, uart.getc());
led2 = !led2;
}
int main() {
uart.attach(&callback);
uart.printf("AT\r\n");
wait(2);
while (1) {
pc.printf("Blink...\r\n");
led1 = !led1;
wait(0.5);
}
}