Karkhana Makerspace
/
F1NRFTx
NRF24L01P with FRDM KL-25Z as Transmitter
Revision 1:8be365501e12, committed 2019-05-30
- Comitter:
- mrbhatter
- Date:
- Thu May 30 12:52:19 2019 +0000
- Parent:
- 0:0f0566c7c9f8
- Commit message:
- NEW TX;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 0f0566c7c9f8 -r 8be365501e12 main.cpp --- a/main.cpp Sat Dec 02 06:01:07 2017 +0000 +++ b/main.cpp Thu May 30 12:52:19 2019 +0000 @@ -2,19 +2,21 @@ #include "nRF24L01P.h" Serial pc(USBTX, USBRX); // tx, rx +AnalogIn n(PTB0); +AnalogIn l(PTB1); nRF24L01P my_nrf24l01p(PTD2, PTD3, PTD1, PTD0, PTD5, PTD4); // MOSI, MISO, SCK, CSN, CE, IRQ -DigitalOut RedLED(PTA5); +DigitalOut RedLED(LED2); int main() { - char count[2]; + char count1[2]; char TxDataCnt; char temp; my_nrf24l01p.powerUp(); - my_nrf24l01p.setRfFrequency(2410); + my_nrf24l01p.setRfFrequency(2411); // Display the (default) setup of the nRF24L01+ chip pc.printf( "nRF24L01+ Frequency : %d MHz\r\n", my_nrf24l01p.getRfFrequency() ); @@ -30,21 +32,15 @@ my_nrf24l01p.enable(); - count[0] = 0x01; - count[1] = 0x01; - while (1) { + count1[0]=n*255; + count1[1]=l*255; + // Send the Transmit buffer via the nRF24L01+ - temp = my_nrf24l01p.write( NRF24L01P_PIPE_P0,count, TxDataCnt ); - - pc.printf( "Sending %d - %d %d\r\n",temp,count[0],count[1]); - + temp = my_nrf24l01p.write( NRF24L01P_PIPE_P0, count1, TxDataCnt); // Toggle LED1 (to help debug Host -> nRF24L01+ communication) - RedLED = !RedLED; - - count[1]++; - + RedLED = !RedLED; wait(1); } }