|
|
@ -3,14 +3,16 @@
|
|
|
|
#include <CModemLoRa.h>
|
|
|
|
#include <CModemLoRa.h>
|
|
|
|
#include <CProtocol12Bytes.h>
|
|
|
|
#include <CProtocol12Bytes.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#define Serial SerialUSB
|
|
|
|
|
|
|
|
|
|
|
|
CProtocol12Bytes protocol;
|
|
|
|
CProtocol12Bytes protocol;
|
|
|
|
CModemLoRa thisLoRa;
|
|
|
|
CModemLoRa thisLoRa;
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t incrTS=0x0000;
|
|
|
|
uint16_t incrTS=0x0000;
|
|
|
|
|
|
|
|
|
|
|
|
void setup() {
|
|
|
|
void setup() {
|
|
|
|
SerialUSB.begin(9600);
|
|
|
|
Serial.begin(9600);
|
|
|
|
SerialUSB.println("LoRa Sender");
|
|
|
|
Serial.println("LoRa Sender");
|
|
|
|
|
|
|
|
|
|
|
|
thisLoRa.begin();
|
|
|
|
thisLoRa.begin();
|
|
|
|
protocol.codeFrame(0x0A,0x00,0x0000,0x00FF,0x5BA2,0x0D4C,0x929A); // Name : LORA-TEST1 or 0x929A for *2
|
|
|
|
protocol.codeFrame(0x0A,0x00,0x0000,0x00FF,0x5BA2,0x0D4C,0x929A); // Name : LORA-TEST1 or 0x929A for *2
|
|
|
@ -28,27 +30,27 @@ void loop()
|
|
|
|
incrTS = protocol.getTimestampMessage()+1;
|
|
|
|
incrTS = protocol.getTimestampMessage()+1;
|
|
|
|
protocol.setTimestampMessage(incrTS);
|
|
|
|
protocol.setTimestampMessage(incrTS);
|
|
|
|
|
|
|
|
|
|
|
|
SerialUSB.print("ID = ");
|
|
|
|
Serial.print("ID = ");
|
|
|
|
SerialUSB.print(protocol.getStationId(),HEX);
|
|
|
|
Serial.print(protocol.getStationId(),HEX);
|
|
|
|
SerialUSB.println(protocol.getGatewayId(),HEX);
|
|
|
|
Serial.println(protocol.getGatewayId(),HEX);
|
|
|
|
SerialUSB.print("TS = ");
|
|
|
|
Serial.print("TS = ");
|
|
|
|
SerialUSB.println(protocol.getTimestampMessage(),HEX);
|
|
|
|
Serial.println(protocol.getTimestampMessage(),HEX);
|
|
|
|
SerialUSB.print("DT = ");
|
|
|
|
Serial.print("DT = ");
|
|
|
|
SerialUSB.println(protocol.getDataType(),HEX);
|
|
|
|
Serial.println(protocol.getDataType(),HEX);
|
|
|
|
SerialUSB.print("D1 = ");
|
|
|
|
Serial.print("D1 = ");
|
|
|
|
SerialUSB.println(protocol.getDataOne(),HEX);
|
|
|
|
Serial.println(protocol.getDataOne(),HEX);
|
|
|
|
SerialUSB.print("D2 = ");
|
|
|
|
Serial.print("D2 = ");
|
|
|
|
SerialUSB.println(protocol.getDataTwo(),HEX);
|
|
|
|
Serial.println(protocol.getDataTwo(),HEX);
|
|
|
|
SerialUSB.print("D3 = ");
|
|
|
|
Serial.print("D3 = ");
|
|
|
|
SerialUSB.println(protocol.getDataThree(),HEX);
|
|
|
|
Serial.println(protocol.getDataThree(),HEX);
|
|
|
|
|
|
|
|
|
|
|
|
for(int i=0; i<3; i++){
|
|
|
|
for(int i=0; i<3; i++){
|
|
|
|
SerialUSB.println("Frame sent !");
|
|
|
|
Serial.println("Frame sent !");
|
|
|
|
LoRa.beginPacket();
|
|
|
|
LoRa.beginPacket();
|
|
|
|
LoRa.write((uint8_t*)&protocol, 12);
|
|
|
|
LoRa.write((uint8_t*)&protocol, 12);
|
|
|
|
LoRa.endPacket();
|
|
|
|
LoRa.endPacket();
|
|
|
|
|
|
|
|
|
|
|
|
SerialUSB.println("-----------------------------");
|
|
|
|
Serial.println("-----------------------------");
|
|
|
|
delay(4000);
|
|
|
|
delay(4000);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
delay(10000);
|
|
|
|
delay(10000);
|
|
|
|