Code carte émettrice (WRonski et Deleau)
Dependencies: mbed BufferedSerial SX1276GenericLib HTU21D
Revision 12:f3bdcf35751e, committed 2019-02-14
- Comitter:
- Adam06
- Date:
- Thu Feb 14 10:34:00 2019 +0000
- Parent:
- 11:9d7409ebfa57
- Child:
- 13:7b3468fd31be
- Commit message:
- temperature
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/HTU21D.lib Thu Feb 14 10:34:00 2019 +0000 @@ -0,0 +1,1 @@ +http://developer.mbed.org/users/alipford3/code/HTU21D/#4fd07be6bad8
--- a/SX1276GenericLib.lib Fri Aug 18 07:45:44 2017 +0000 +++ b/SX1276GenericLib.lib Thu Feb 14 10:34:00 2019 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/Helmut64/code/SX1276GenericLib/#49d19df5bbce +http://developer.mbed.org/users/Helmut64/code/SX1276GenericLib/#f2826a8fbff2
--- a/SX1276GenericPingPong/GenericPingPong.cpp Fri Aug 18 07:45:44 2017 +0000 +++ b/SX1276GenericPingPong/GenericPingPong.cpp Thu Feb 14 10:34:00 2019 +0000 @@ -10,6 +10,7 @@ #include "GenericPingPong.h" #include "sx1276-mbed-hal.h" #include "main.h" +#include "HTU21D.h" #ifdef FEATURE_LORA @@ -88,8 +89,8 @@ SX1276Generic *Radio; -const uint8_t PingMsg[] = { 0xff, 0xff, 0x00, 0x00, 'P', 'I', 'N', 'G'};// "PING"; -const uint8_t PongMsg[] = { 0xff, 0xff, 0x00, 0x00, 'P', 'O', 'N', 'G'};// "PONG"; +const uint8_t PingMsg[] = { 'A', 'A', 'A', 'A', 'P', 'I', 'N', 'G'};// "PING"; +const uint8_t PongMsg[] = { 'B', 'B', 'B', 'B', 'P', 'O', 'N', 'G'};// "PONG"; uint16_t BufferSize = BUFFER_SIZE; uint8_t *Buffer; @@ -217,6 +218,8 @@ Radio->Rx( RX_TIMEOUT_VALUE ); + + HTU21D temphumid(PB_14, PB_13); //Temp humid sensor || SDA, SCL while( 1 ) { #ifdef TARGET_STM32L4 @@ -278,16 +281,20 @@ // Send the reply to the PING string memcpy(Buffer, PongMsg, sizeof(PongMsg)); // We fill the buffer with numbers for the payload - for( i = sizeof(PongMsg); i < BufferSize; i++ ) + int sample_ctemp = temphumid.sample_ctemp(); + printf("Temp = %d\n\r", sample_ctemp); + char data[BUFFER_SIZE -8]; + sprintf(data,"%d",sample_ctemp); + for( i = 0; i < sizeof(data); i++ ) { - Buffer[i] = i - sizeof(PongMsg); + Buffer[i+sizeof(PongMsg)] = data[i]; } wait_ms( 10 ); Radio->Send( Buffer, BufferSize ); } else // valid reception but not a PING as expected { // Set device as master and start again - isMaster = true; + //isMaster = true; Radio->Rx( RX_TIMEOUT_VALUE ); } }
--- a/mbed.bld Fri Aug 18 07:45:44 2017 +0000 +++ b/mbed.bld Thu Feb 14 10:34:00 2019 +0000 @@ -1,1 +1,1 @@ -https://mbed.org/users/mbed_official/code/mbed/builds/e2bfab296f20 \ No newline at end of file +https://os.mbed.com/users/mbed_official/code/mbed/builds/3a7713b1edbc \ No newline at end of file