Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
Hello,
I have been trying to succeed with PWM and EventQueue with NRF51822 based MDBT40 board (same as RedBearLabs nano) with Mbed 5. However when i declare the PWMOut my code stops working. The periodic callback never gets called. If i comment out PwmOut and related lines, my led starts blinking normally every 500ms. What am i missing?
#include <events/mbed_events.h> #include "mbed.h" #include "ble/BLE.h" PwmOut buzzer(p13); DigitalOut led1(p30); static EventQueue eventQueue(/* event count */ 16 * EVENTS_EVENT_SIZE); void updateSensorValue(void) { //printf("Something out of ISR\n\r"); } void periodicCallback(void) { led1 = !led1; eventQueue.call(updateSensorValue); } // main() runs in its own thread in the OS int main() { buzzer.period_us(250); buzzer.pulsewidth_us(125); eventQueue.call_every(500, periodicCallback); eventQueue.dispatch_forever(); return 0; }