Test program for the Nordic Semi nRF24L01 Transceiver Module (http://www.sparkfun.com/products/691), talking to another module connected to SparkFun\'s Nordic Serial Interface Board (http://www.sparkfun.com/products/9019).

Dependencies:   mbed nRF24L01P

Revision:
10:10b4e41b67a7
Parent:
9:4dd1a0f48d68
Child:
11:004792c2729a
--- a/main.cpp	Wed Dec 19 11:53:51 2018 +0000
+++ b/main.cpp	Wed Dec 19 12:15:00 2018 +0000
@@ -50,20 +50,19 @@
     pc.printf("-----------------\n\r");
     
     for (int i = 0; i < 1000; i++) {
+        char c = i % 100;
         txData[txDataCnt++] = i % 100;
         if (txDataCnt >= sizeof(txData)) {
+//            pc.printf("Printing txData: %d %d", txData[0], txData[1]);
             // Send the transmitbuffer via the nRF24L01+
             my_nrf24l01p.write( NRF24L01P_PIPE_P0, txData, txDataCnt );
             txDataCnt = 0;
         }
     }
+    my_nrf24l01p.write( NRF24L01P_PIPE_P0, "qq", 2 );
     pc.printf("Finished run!\n\r\n\r");
 }
 
-int syncSettings(int frequency, int outputPower, int dataRate, bool art) {
-    return 0
-}
-
 int main() {
 
 // The nRF24L01+ supports transfers from 1 to 32 bytes, but Sparkfun's
@@ -85,15 +84,14 @@
     if (receiver) {
         int rxPacketCnt = 0;
         int rxDataCnt = 0;
-        int i = 0;
         bool reading = true;
         pc.printf(">> Receiving Modus << \n\r");
         while (reading) {
             if ( my_nrf24l01p.readable() ) {
                 rxDataCnt = my_nrf24l01p.read( NRF24L01P_PIPE_P0, rxData, sizeof( rxData ) );
                 for (int i = 0; i < rxDataCnt; i++) {
-                    i = rxData[i];
-                    if (i == 113) {
+                    int x = rxData[i];
+                    if (x == 113) {
                         if (rxPacketCnt == 0) {
                             pc.printf("\n\r-----------\n\r");
                             pc.printf("DONE!: length = %d \r\n", rxPacketCnt);
@@ -101,7 +99,7 @@
                             rxPacketCnt = 0;     
                         }
                     } else {
-                        data[rxPacketCnt++] = i;
+                        data[rxPacketCnt++] = x;
                     }
                 }
                 rxDataCnt = 0;
@@ -112,7 +110,7 @@
        pc.printf(">> Sending Modus << \n\r");
        // Frequency test
        pc.printf("FREQUENCY TEST \n\r");
-       senderTest(2400, NRF24L01P_TX_PWR_ZERO_DB, NRF24L01P_DATARATE_2_MBPS, false);
+       senderTest(2400, NRF24L01P_TX_PWR_ZERO_DB, NRF24L01P_DATARATE_1_MBPS, false);
       // senderTest(2463, NRF24L01P_TX_PWR_ZERO_DB, NRF24L01P_DATARATE_2_MBPS, false);
 //       senderTest(2525, NRF24L01P_TX_PWR_ZERO_DB, NRF24L01P_DATARATE_2_MBPS, false);
 //       // Power (dBm) test