wikiroute

networking recipes

User Tools

Site Tools


lorawan_downlink

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
lorawan_downlink [2017/12/12 08:24] – [4.2. Arduino with Dragino Shield] samerlorawan_downlink [2017/12/13 17:30] – [5. Selecting the Receive Windows] samer
Line 64: Line 64:
 This sketch {{ ::example-code-autonomo.ino.zip |}} can be used as an example. The following extract denotes the part corresponding to receiving downlink messages. For example, the received value can be used to trigger some action on the Arduino module. This sketch {{ ::example-code-autonomo.ino.zip |}} can be used as an example. The following extract denotes the part corresponding to receiving downlink messages. For example, the received value can be used to trigger some action on the Arduino module.
  
 +<code c++>
 +void receiveData() {
 +  // After we have send some data, we can receive some data
 +  // First we make a buffer
 +  uint8_t payload[64];
 +  // Now we fill the buffer and
 +  // len = the size of the data
 +  uint16_t len = LoRaBee.receive(payload, 64);
 +  String HEXPayload = "";
  
 +  // When there is no payload the lorabee will return 131 (0x83)
 +  // I filter this out
 +  if (payload[0] != 131) {
 +    for (int i = 0; i < len; i++) {
 +      HEXPayload += char(payload[i]);
 +    }
 +
 +    if (HEXPayload == "on") {
 +      digitalWrite(LED_BUILTIN, HIGH);
 +    }
 +    if (HEXPayload == "off") {
 +      digitalWrite(LED_BUILTIN, LOW);
 +    }
 +    debugSerial.println(HEXPayload);
 +    //switchLED(HEXPayload);
 +  } else {
 +    debugSerial.println("no payload");
 +  }
 +}
 +</code>
 ==== -. Arduino with Dragino Shield ==== ==== -. Arduino with Dragino Shield ====
 Devices in the LoRaWAN platform can also be implemented on Arduino boards with Dragino shields. The combined module as well as the basic configuration steps are presented in [[simple_lora_prototype|Simple Prototype of LoRa Communications]]. Similarly to the Autonomo device, you can download the following sketch {{ ::example-code-arduino.ino.zip |}} and modify it according to your preferences. Below you can find an extract of the receiving function for downlink messages. Devices in the LoRaWAN platform can also be implemented on Arduino boards with Dragino shields. The combined module as well as the basic configuration steps are presented in [[simple_lora_prototype|Simple Prototype of LoRa Communications]]. Similarly to the Autonomo device, you can download the following sketch {{ ::example-code-arduino.ino.zip |}} and modify it according to your preferences. Below you can find an extract of the receiving function for downlink messages.
Line 88: Line 117:
  
 [{{ undefined:loraserver-downlink-dr.png?durect&650 | Figure 3. Receive window selection on loraserver backend}}] [{{ undefined:loraserver-downlink-dr.png?durect&650 | Figure 3. Receive window selection on loraserver backend}}]
 +
 +<WRAP center round tip 60%>
 +Without configuring the receive window, with OTAA mode, autonomo is receiving on RX1.
 +</WRAP>
lorawan_downlink.txt · Last modified: 2021/08/28 09:53 by samer