Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 8:05427ba764a9
- Parent:
- 7:7aec575dd541
- Child:
- 9:557b85b94a89
--- a/main.cpp Fri Dec 11 08:46:30 2020 +0000 +++ b/main.cpp Fri Dec 11 09:07:00 2020 +0000 @@ -66,26 +66,22 @@ while (1) { //Send "Hello PC" to the PC board + if ( pc.readable() ) { - // add datas to the transmit buffer - txData[txDataCnt++] = data[i++]; - - pc.printf("%d", i); - - if (i >= dataSize) - { - i = 0; + // ...add it to the transmit buffer + txData[txDataCnt++] = pc.getc(); - } - // If the transmit buffer is full - if ( txDataCnt >= sizeof( txData ) ) { - - // Send the transmitbuffer via the nRF24L01+ - my_nrf24l01p.write( NRF24L01P_PIPE_P0, txData, txDataCnt ); - - txDataCnt = 0; - } - + + + // If the transmit buffer is full + if ( txDataCnt >= sizeof( txData ) ) { + + // 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; }