pot_data_nRF_Tx

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
rdverma
Date:
Thu Jun 13 14:21:19 2019 +0000
Commit message:
pot_data_nRF_Tx

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 000000000000 -r 1f987aa51be2 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jun 13 14:21:19 2019 +0000
@@ -0,0 +1,41 @@
+#include "mbed.h"
+#include "nRF24L01P.h"
+Serial pc(USBTX, USBRX); // tx, rx
+AnalogIn Ain(PTB1);
+int ADCdata;
+
+nRF24L01P my_nrf24l01p(PTD2, PTD3, PTD1, PTD0, PTD5, PTD4);    // MOSI, MISO, SCK, CSN, CE, IRQ
+DigitalOut RedLED(PTA5);
+
+int main()
+{
+    char count[2];
+    char TxDataCnt;
+    char temp;
+    my_nrf24l01p.powerUp();
+    my_nrf24l01p.setRfFrequency(2410);
+
+    // 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() );
+    pc.printf( "nRF24L01+ Data Rate    : %d kbps\r\n", my_nrf24l01p.getAirDataRate() );
+    pc.printf( "nRF24L01+ TX Address   : 0x%010llX\r\n", my_nrf24l01p.getTxAddress() );
+    pc.printf( "nRF24L01+ RX Address   : 0x%010llX\r\n", my_nrf24l01p.getRxAddress() );
+
+    TxDataCnt = 2;
+    my_nrf24l01p.setTransferSize(TxDataCnt);
+    my_nrf24l01p.enable();
+    count[0] = 0x01;
+    count[1] = 0x01;
+
+    while (1) {
+ADCdata=Ain*1023;
+        // 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]);
+        // Toggle LED1 (to help debug Host -> nRF24L01+ communication)
+        RedLED = !RedLED;            
+        count[1]=ADCdata;        
+        wait(1);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 1f987aa51be2 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Jun 13 14:21:19 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file