scooter
/
nRF24L01P_Hello_World
dddd
Fork of nRF24L01P_Hello_World by
Revision 2:b03d93dd78f2, committed 2016-01-05
- Comitter:
- iFoxtec
- Date:
- Tue Jan 05 14:01:40 2016 +0000
- Parent:
- 1:5be2682710c6
- Commit message:
- ajhf
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 5be2682710c6 -r b03d93dd78f2 main.cpp --- a/main.cpp Wed Jan 19 23:53:19 2011 +0000 +++ b/main.cpp Tue Jan 05 14:01:40 2016 +0000 @@ -3,24 +3,26 @@ Serial pc(USBTX, USBRX); // tx, rx -nRF24L01P my_nrf24l01p(p5, p6, p7, p8, p9, p10); // mosi, miso, sck, csn, ce, irq +nRF24L01P my_nrf24l01p(D4, D5, D3, D10, D8, D9); // mosi, miso, sck, csn, ce, irq -DigitalOut myled1(LED1); -DigitalOut myled2(LED2); int main() { // 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 4 +#define TRANSFER_SIZE 1 char txData[TRANSFER_SIZE], rxData[TRANSFER_SIZE]; int txDataCnt = 0; int rxDataCnt = 0; my_nrf24l01p.powerUp(); - + my_nrf24l01p.setAirDataRate(250); + my_nrf24l01p.setRxAddress(0xE7E7E7E7E1, DEFAULT_NRF24L01P_ADDRESS_WIDTH, NRF24L01P_PIPE_P0); + my_nrf24l01p.setTxAddress(0xE7E7E7E7E6, DEFAULT_NRF24L01P_ADDRESS_WIDTH); + + // Display the (default) setup of the nRF24L01+ chip pc.printf( "nRF24L01+ Frequency : %d MHz\r\n", my_nrf24l01p.getRfFrequency() ); pc.printf( "nRF24L01+ Output power : %d dBm\r\n", my_nrf24l01p.getRfOutputPower() ); @@ -34,7 +36,7 @@ my_nrf24l01p.setReceiveMode(); my_nrf24l01p.enable(); - + pc.printf( "nRF24L01+ Data Rate : %d kbps\r\n", my_nrf24l01p.getAirDataRate() ); while (1) { // If we've received anything over the host serial link... @@ -52,8 +54,6 @@ txDataCnt = 0; } - // Toggle LED1 (to help debug Host -> nRF24L01+ communication) - myled1 = !myled1; } // If we've received anything in the nRF24L01+... @@ -68,8 +68,6 @@ pc.putc( rxData[i] ); } - // Toggle LED2 (to help debug nRF24L01+ -> Host communication) - myled2 = !myled2; } } }
diff -r 5be2682710c6 -r b03d93dd78f2 mbed.bld --- a/mbed.bld Wed Jan 19 23:53:19 2011 +0000 +++ b/mbed.bld Tue Jan 05 14:01:40 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e +http://mbed.org/users/mbed_official/code/mbed/builds/9296ab0bfc11 \ No newline at end of file