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.
Hi there
I recently started with the mbed to rewrite my flightcontroller from 8-bits to 32-bits.. Now I have a problem. I'm reading a Radio Controllerd receiver. It practically always interrupts because the pin is always changing! Causing my main loop to stop..
So the serial printf's aren't executed.. How do I fix this?
int main() { setup(); _interruptPPM.rise(&RxTrigger); // Bind Interrupt wait(0.5); while(1) { _serialPC.printf("Any output: " + buf_ppm[2] ); _serialPC.printf("\n"); } }Trigger:
void RxTrigger() { deltaTime.stop(); // Stop timer buf_ppm[i] = deltaTime.read_us(); // Read timer to buffer[i] i=turns deltaTime.reset(); // Reset timer deltaTime.start(); // Start timer i++; // increment i. if(buf_ppm[i]>5000) idx = i; if(i== 7) i = 0; _serialPC.printf("Random: " + buf_ppm[2]); _serialPC.printf("\n"); }