project wireless
Dependencies: mbed nRF24L01P nRF24L01P_Hello_World TextLCD
Fork of nRF24L01P_Hello_World by
Diff: main.cpp
- Revision:
- 3:de3b4b509e70
- Parent:
- 2:178e089b3ce9
- Child:
- 4:da91478e0ca4
--- a/main.cpp Thu May 07 16:39:31 2015 +0000 +++ b/main.cpp Wed May 13 09:42:17 2015 +0000 @@ -13,7 +13,7 @@ // The nRF24L01+ supports transfers from 1 to 32 bytes, but Sparkfun's // "Nordic Serial Interface Board" (http://www.sparkfun.com/products/9019) // only handles 4 byte transfers in the ATMega code. -#define TRANSFER_SIZE 32 +#define TRANSFER_SIZE 5 char txData[TRANSFER_SIZE], rxData[TRANSFER_SIZE]; int txDataCnt = 0; @@ -43,28 +43,6 @@ while (1) { - // If we've received anything over the host serial link... - if ( pc.readable() ) { - - // ...add it to the transmit buffer - txData[txDataCnt++] = pc.getc(); - - //pc.printf("lengte txData: %d \n\r", sizeof(txData)); - //pc.printf("txData count: %d \n\r", txDataCnt); - - // If the transmit buffer is full - if ( txDataCnt >= sizeof(txData) ) { - //pc.printf("eerste if \n\r"); - // Send the transmitbuffer via the nRF24L01+ - my_nrf24l01p.write( NRF24L01P_PIPE_P0, txData, txDataCnt ); - - txDataCnt = 0; - } - - // Toggle LED1 (to help debug Host -> nRF24L01+ communication) - myled1 = !myled1; - } - // If we've received anything in the nRF24L01+... if ( my_nrf24l01p.readable(NRF24L01P_PIPE_P0) ) { //pc.printf("tweede if \n\r"); @@ -79,6 +57,7 @@ // Toggle LED2 (to help debug nRF24L01+ -> Host communication) myled2 = !myled2; + pc.printf("\r\n"); } } }