xbed Lpc1768 Radio Test
Dependencies: MxRadioRF2xx mbed
Fork of xBedRadio by
Diff: main.cpp
- Revision:
- 0:ba3b92501bea
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Apr 09 08:50:55 2015 +0000 @@ -0,0 +1,39 @@ +#include "mbed.h" +#include "MxRadio.h" +DigitalOut myled1(LED1); +DigitalOut myled2(LED2); +cMxRadio MxRadio(P0_18, P0_17, P0_15, P0_20, P2_11,P2_12, P2_13); +uint8_t i; +void errHandle(radio_error_t err) +{ + myled2=!myled2; +} +void onXmitDone(radio_tx_done_t x) +{ + myled2=!myled2; +} +uint8_t* recievehandler(uint8_t len, uint8_t* frm, uint8_t lqi, int8_t ed,uint8_t crc_fail) +{ + + myled1=!myled1; + + return frm; +} +int main() { + + myled2=1; + myled1=1; + MxRadio.begin(0); + MxRadio.attachError(errHandle); + MxRadio.attachTxDone(onXmitDone); + MxRadio.attachReceiveFrame(recievehandler); + while(1) { + MxRadio.beginTransmission(); + MxRadio.write("Hello World!"); + MxRadio.write(i); + i++; + MxRadio.endTransmission(); + wait_ms(1000); + + } +}