mouse transmitter
Dependencies: MMA8451Q TSI USBDevice mbed nRF24L01P
Fork of kl25Z_nRF_TX by
Revision 1:2c6781177599, committed 2015-10-11
- Comitter:
- aji052
- Date:
- Sun Oct 11 09:39:54 2015 +0000
- Parent:
- 0:19a03658bf70
- Child:
- 2:36a1ad8ff689
- Commit message:
- ; mouse transmitter
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MMA8451Q.lib Sun Oct 11 09:39:54 2015 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/emilmont/code/MMA8451Q/#c4d879a39775
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TSI.lib Sun Oct 11 09:39:54 2015 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/emilmont/code/TSI/#507b1f67804b
--- a/Transmitter.cpp Mon Jun 01 05:20:18 2015 +0000
+++ b/Transmitter.cpp Sun Oct 11 09:39:54 2015 +0000
@@ -1,20 +1,30 @@
#include "mbed.h"
#include "nRF24L01P.h"
-
+//#include "USBMouse.h"
+#include "TSISensor.h"
+#include "MMA8451Q.h"
+#define MMA8451_I2C_ADDRESS (0x1d<<1)
+MMA8451Q acc(PTE25, PTE24, MMA8451_I2C_ADDRESS);
Serial pc(USBTX, USBRX); // tx, rx
+
+nRF24L01P my_nrf24l01p(PTD6, PTE3, PTE2, PTB8, PTB9, PTD0); // mosi, miso, sck, csn, ce, irq
-nRF24L01P my_nrf24l01p(PTD6, PTE3, PTE2, PTB8, PTB9, PTD0); // mosi, miso, sck, csn, ce, irq
-DigitalOut RedLED(LED1);
+
+ TSISensor tsi;
+//USBMouse mouse;
+float value;
+int xaxis, yaxis, zaxis;
int main()
{
- char count[2];
+ char count[3];
char TxDataCnt;
char temp;
my_nrf24l01p.powerUp();
- my_nrf24l01p.setRfFrequency(2410);
+ my_nrf24l01p.setRfFrequency(2510);
+
// Display the (default) setup of the nRF24L01+ chip
pc.printf( "nRF24L01+ Frequency : %d MHz\r\n", my_nrf24l01p.getRfFrequency() );
@@ -25,26 +35,27 @@
pc.printf( "Simple Transmitter (0 - 9 Counter) \r\n");
- TxDataCnt = 2;
+ TxDataCnt = 3;
my_nrf24l01p.setTransferSize(TxDataCnt);
my_nrf24l01p.enable();
- count[0] = 0x01;
- count[1] = 0x01;
-
+
+
while (1) {
-
+count[2]=tsi.readPercentage()*100;
+ count[0]=(acc.getAccX()+1)*100;
+ count[1]=(acc.getAccY()+1)*100;
// 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]);
+ pc.printf( "Sending %d - %d %d %d\r\n",temp,count[0],count[1],count[2]);
// Toggle LED1 (to help debug Host -> nRF24L01+ communication)
- RedLED = !RedLED;
+
- count[1]++;
+
- wait(1);
+
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/USBDevice.lib Sun Oct 11 09:39:54 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/USBDevice/#2af474687369
