Projet S5 info - Beginner version
Dependencies: XBeeLib mbed-rtos mbed
Fork of Projet by
Revision 10:0491ac57ac77, committed 2016-04-14
- Comitter:
- vinbel93
- Date:
- Thu Apr 14 14:41:18 2016 +0000
- Parent:
- 9:6959e3ebe7f2
- Commit message:
- Final Beginner Version
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 6959e3ebe7f2 -r 0491ac57ac77 main.cpp --- a/main.cpp Thu Apr 14 14:39:29 2016 +0000 +++ b/main.cpp Thu Apr 14 14:41:18 2016 +0000 @@ -8,7 +8,6 @@ XBeeZB* xbee; -AnalogIn GP2D12(p15); DigitalIn capteur_1(p23); DigitalIn capteur_2(p24); DigitalIn capteur_3(p25); @@ -25,8 +24,6 @@ bool capt_5; bool capt_6; -uint16_t GP2D12_value; - /* lecture des capteurs à partir des broches du mbed : p15, p16, p17, 19, 20 21*/ void lecture_capteurs (void const *args){ @@ -39,26 +36,21 @@ capt_5=capteur_5.read(); capt_6=capteur_6.read(); - GP2D12_value = GP2D12.read_u16(); - capt_lock.unlock(); } void send_data_to_coordinator(const uint8_t* data) { - const TxStatus txStatus = xbee->send_data_to_coordinator(data, 2); + const TxStatus txStatus = xbee->send_data_to_coordinator(data, 1); } void envoi_donnees (void const *args) { capt_lock.lock(); - uint8_t data[3]; + uint8_t data[1]; data[0] = (capt_1 << 7) | (capt_2 << 6) | (capt_3 << 5) | (capt_4 << 4) | (capt_5 << 3) | (capt_6 << 2); - data[1] = (GP2D12_value & 0xFF00) >> 8; capt_lock.unlock(); - pc.printf("%x \n\r", GP2D12_value); - pc.printf("%02x %02x %02x\n\r", data[0], data[1], data[2]); - + send_data_to_coordinator(data); }