SafeDetect
/
LoRaWAN_XDOT
basic loraWAN sending, some settings done-- no keys or any of that though
Revision 60:6b488cb72780, committed 2019-12-03
- Comitter:
- candre97
- Date:
- Tue Dec 03 09:21:15 2019 +0000
- Parent:
- 59:23cc35ed9008
- Commit message:
- sending 50 byte payload over LoRaWAN;
Changed in this revision
--- a/main.cpp Thu Nov 28 09:01:59 2019 +0000 +++ b/main.cpp Tue Dec 03 09:21:15 2019 +0000 @@ -30,7 +30,7 @@ // Max payload size can be LORAMAC_PHY_MAXPAYLOAD. // This example only communicates with much shorter messages (<30 bytes). // If longer messages are used, these buffers must be changed accordingly. -uint8_t tx_buffer[30]; +uint8_t tx_buffer[50]; uint8_t rx_buffer[30]; /* @@ -145,11 +145,14 @@ return 0; } -/** +/* * Sends a message to the Network Server */ static void send_message() { + /* 30 byte message + can be 50 bytes, max + */ uint16_t packet_len; int16_t retcode; int32_t sensor_value; @@ -163,11 +166,16 @@ printf("\r\n No sensor found \r\n"); return; } + + uint16_t* sensor_readings = (uint16_t* ) malloc(25*sizeof(uint16_t)); + int i = 0; + for(i; i < 25; i++) { + sensor_readings[i] = 1234; + } + // tx_buffer = (uint8_t* )sensor_readings; +// packet_len = 50; - packet_len = sprintf((char *) tx_buffer, "Dummy Sensor Value is %d", - sensor_value); - - retcode = lorawan.send(MBED_CONF_LORA_APP_PORT, tx_buffer, packet_len, + retcode = lorawan.send(MBED_CONF_LORA_APP_PORT, (uint8_t* )sensor_readings, 50, MSG_UNCONFIRMED_FLAG); if (retcode < 0) {
--- a/mbed-lora-radio-drv.lib Thu Nov 28 09:01:59 2019 +0000 +++ b/mbed-lora-radio-drv.lib Tue Dec 03 09:21:15 2019 +0000 @@ -1,1 +1,1 @@ -https://github.com/ARMmbed/mbed-semtech-lora-rf-drivers#6012fa43cf9f2cae46fa9d424fe4051d00e157a2 +https://github.com/ARMmbed/mbed-semtech-lora-rf-drivers/#6012fa43cf9f2cae46fa9d424fe4051d00e157a2
--- a/mbed_app.json Thu Nov 28 09:01:59 2019 +0000 +++ b/mbed_app.json Tue Dec 03 09:21:15 2019 +0000 @@ -31,8 +31,8 @@ "platform.stdio-baud-rate": 115200, "platform.default-serial-baud-rate": 115200, "lora.over-the-air-activation": true, - "lora.duty-cycle-on": true, - "lora.phy": "EU868", + "lora.duty-cycle-on": false, + "lora.phy": "US915", "lora.device-eui": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }", "lora.application-eui": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }", "lora.application-key": "{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }"