Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MPU9250_SPI SDFileSystem XBeeLib
Diff: event.cpp
- Revision:
- 11:f19020fa18f1
- Parent:
- 10:577e1fc4453e
diff -r 577e1fc4453e -r f19020fa18f1 event.cpp
--- a/event.cpp Sat Oct 14 23:37:02 2017 +0000
+++ b/event.cpp Tue Oct 17 09:39:10 2017 +0000
@@ -32,4 +32,54 @@
void readIMU(){
//imu.resetMPU9250();
pc.printf("%d\r\r ",time_stamp.read());
+}
+
+void TransmitRequest() //(const char* command, const char* data, int length)
+{
+ int tmp = 22; // length (grandeur du data à envoyer) 4 (API(1), FrameID(1), AT Command(2))
+ char* trm = new char[tmp]; // 4 (Delimiter(1), Length(2), Checksum(1))
+
+ trm[0] = 0x7E; // Start Delimiter
+ // trm[1] = static_cast<char>((tmp >> 8) & 0xFF); // MSB de length
+ // trm[2] = static_cast<char>(tmp & 0xFF); // LSB length
+ trm[1] = 0x00; // Length 1
+ trm[2] = 0x12; // Length 2
+ trm[3] = 0x10; // Frame Type
+ trm[4] = 0x01; // Frame ID
+
+ // 64-bit Destination Address
+ trm[5] = 0x00;
+ trm[6] = 0x00;
+ trm[7] = 0x00;
+ trm[8] = 0x00;
+ trm[9] = 0x00;
+ trm[10] = 0x00;
+ trm[11] = 0x00;
+ trm[12] = 0x00;
+
+ // 16-bit Destination Address
+ trm[13] = 0xFF;
+ trm[14] = 0xFE;
+
+ trm[15] = 0x00; // Broadcast Radius
+ trm[16] = 0x00; // Options
+
+ // RF Data
+ trm[17] = 0x48; // H
+ trm[18] = 0x6F; // o
+ trm[19] = 0x6C; // l
+ trm[20] = 0x61; // a
+
+ trm[21] = 0x6D; // Checksum
+
+ // for (int i = 0; i < length; i++)
+ // trm[7+i] = data[i]; //Data
+ // trm[7+length] = crc8(trm, tmp + 3);
+
+ Serial xbee(tx, rx);
+ for (int i = 0; i < tmp; i++)
+ xbee.putc(trm[i]); //Transmition des donnees
+
+ wait(0.01);
+ delete trm;
}
\ No newline at end of file

