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 revisionBoth sides next revision
lorawan_downlink [2017/12/12 08:24] – [4.1. Autonomo with LoRaBee] samerlorawan_downlink [2017/12/12 08:24] – [4.2. Arduino with Dragino Shield] samer
Line 69: Line 69:
  
 <code c++> <code c++>
-void receiveData() { +case EV_TXCOMPLETE: 
-  // After we have send some data, we can receive some data +      Serial.println(F("EV_TXCOMPLETE (includes waiting for RX windows)")); 
-  // First we make a buffer +      if (LMIC.dataLen) { 
-  uint8_t payload[64]; +        // data received in rx slot after tx 
-  // Now we fill the buffer and +        Serial.print(F("Data Received: ")); 
-  // len = the size of the data +        Serial.write(LMIC.frame + LMIC.dataBeg, LMIC.dataLen); 
-  uint16_t len = LoRaBee.receive(payload, 64); +        Serial.println(); 
-  String HEXPayload = ""; +      }
- +
-  // When there is no payload the lorabee will return 131 (0x83) +
-  // I filter this out +
-  if (payload[0] != 131+
-    for (int i = 0i < 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> </code>
- 
 ===== -. Selecting the Receive Windows ===== ===== -. Selecting the Receive Windows =====
  
lorawan_downlink.txt · Last modified: 2021/08/28 09:53 by samer