![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Remote control code for https://developer.mbed.org/users/ivo_david_michelle/code/QuadTrio/
Dependencies: Analog_Joystick Sender mbed
Fork of ESE350-Whack-a-Mole by
Diff: rc.cpp
- Revision:
- 9:2a3b3e067847
- Parent:
- 8:ff7cd3525c32
- Child:
- 10:8981152753a6
diff -r ff7cd3525c32 -r 2a3b3e067847 rc.cpp --- a/rc.cpp Thu Apr 07 21:14:33 2016 +0000 +++ b/rc.cpp Thu Apr 07 22:04:42 2016 +0000 @@ -20,24 +20,9 @@ // Serial port for showing RX data. Serial pc(USBTX, USBRX); -int iterations = 100; - -//***************** send and receive methods *****************// -/* -void wait_for_ping(uint8_t length) { - int receive = 0; - uint8_t *rssi = 0; - - while (receive == 0) { - receive = rf_receive_rssi(rxBuffer, rssi, length); - } -} -*/ - - -//***************** main loop *****************// - -int main (void) { +int main (void) +{ + long long id = 0; uint8_t channel = 3; //Set the Channel. 0 is default, 15 is max @@ -48,18 +33,13 @@ pc.printf("START\r\n"); - // send_three_way_handshake(); + char txBuffer[250]; - int i; - char txBuffer[250]; - - for (i = 0; i < iterations; i++) { - sprintf(txBuffer, "%f,%f,%f,%f", read_thrust(), read_yaw(), read_pitch(), read_roll()); + while(1) { + sprintf(txBuffer, "%lld,%f,%f,%f,%f", id, read_thrust(), read_yaw(), read_pitch(), read_roll()); rf_send(mrf, txBuffer, strlen(txBuffer) + 1); pc.printf("RC Sent: %s \r\n", txBuffer); - wait(0.2); // TODO: change this value? + id++; } - - pc.printf("END\r\n"); }