22

Dependencies:   MMA8451Q mbed nRF24L01P

Files at this revision

API Documentation at this revision

Comitter:
Devashish1806
Date:
Sun Apr 02 12:12:07 2017 +0000
Commit message:
22;

Changed in this revision

MMA8451Q.lib Show annotated file Show diff for this revision Revisions of this file
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
nRF24L01P.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MMA8451Q.lib	Sun Apr 02 12:12:07 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/emilmont/code/MMA8451Q/#c4d879a39775
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Apr 02 12:12:07 2017 +0000
@@ -0,0 +1,53 @@
+#include "mbed.h"
+#include "nRF24L01P.h"
+#include "MMA8451Q.h"
+
+MMA8451Q acc(PTE25,PTE24,0X1d<<1);
+Serial pc(USBTX, USBRX); // tx, rx
+
+nRF24L01P my_nrf24l01p(PTD2, PTD3, PTD1, PTD0, PTD5, PTD4);    // mosi, miso, sck, csn, ce, irq
+DigitalOut RedLED(PTA5);
+
+int main()
+{
+    float xaxis;
+    char choice[1];
+    char TxDataCnt;
+    char temp;
+
+
+    my_nrf24l01p.powerUp();
+    my_nrf24l01p.setRfFrequency(2417);
+
+    // 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() );
+
+    pc.printf( "Simple Transmitter (0 - 9 Counter) \r\n");
+
+    TxDataCnt = 1;
+    my_nrf24l01p.setTransferSize(TxDataCnt);
+
+    my_nrf24l01p.enable();
+
+    while (1) {
+
+        // Send the Transmit buffer via the nRF24L01+
+        temp = my_nrf24l01p.write( NRF24L01P_PIPE_P0,choice, TxDataCnt );
+ 
+    
+    xaxis = acc.getAccX();
+    
+
+    
+        pc.printf( "Sending %d - %d %0.2f\r\n",temp,xaxis);
+        wait(3);
+        // Toggle LED1 (to help debug Host -> nRF24L01+ communication)
+        RedLED = !RedLED;
+            
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Apr 02 12:12:07 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/cbbeb26dbd92
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nRF24L01P.lib	Sun Apr 02 12:12:07 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/Owen/code/nRF24L01P/#8ae48233b4e4