From 9cb1ba2fdc9d6a6bcff7bc2febefb519ba4dd1c1 Mon Sep 17 00:00:00 2001 From: Flavien Haas Date: Mon, 11 Jun 2018 13:27:40 +0200 Subject: [PATCH] old code --- LoRaReceiver-struct/LoRaReceiver-struct.ino | 12 ++++++--- WebServer/inde.htm | 10 ++++++++ frameTreatment/frameTreatment.ino | 28 ++------------------- 3 files changed, 21 insertions(+), 29 deletions(-) create mode 100644 WebServer/inde.htm diff --git a/LoRaReceiver-struct/LoRaReceiver-struct.ino b/LoRaReceiver-struct/LoRaReceiver-struct.ino index cb61c27..29c9058 100644 --- a/LoRaReceiver-struct/LoRaReceiver-struct.ino +++ b/LoRaReceiver-struct/LoRaReceiver-struct.ino @@ -8,7 +8,6 @@ CProtocol12Bytes protocol; void setup() { SerialUSB.begin(9600); - while (!SerialUSB){}; SerialUSB.println("LoRa Receiver"); thisLoRa.begin(); } @@ -17,7 +16,7 @@ void loop() { int packetSize = thisLoRa.parsePacket(); if (packetSize > 0) { - thisLoRa.read(&protocol); // objet thislora qui appele classe Lora.h et rempli la stucture de l'objet protocol, ser a allèger -5lignes + thisLoRa.read(&protocol); SerialUSB.println("Frame received"); delay(100); SerialUSB.print("ID = "); @@ -34,5 +33,12 @@ void loop() { SerialUSB.print("D3 = "); SerialUSB.println(protocol.getDataThree(),HEX); } - } + + + + + + + +// objet thislora qui appele classe Lora.h et rempli la stucture de l'objet protocol, ser a allèger -5lignes diff --git a/WebServer/inde.htm b/WebServer/inde.htm new file mode 100644 index 0000000..db49c3a --- /dev/null +++ b/WebServer/inde.htm @@ -0,0 +1,10 @@ + + + + Arduino SD Card Web Page + + +

Hello from the Arduino SD Card!

+

A web page from the Arduino SD card server.

+ + \ No newline at end of file diff --git a/frameTreatment/frameTreatment.ino b/frameTreatment/frameTreatment.ino index acfd1d2..50bf227 100644 --- a/frameTreatment/frameTreatment.ino +++ b/frameTreatment/frameTreatment.ino @@ -7,16 +7,8 @@ #include // to use personalised LoRa class #include // to use our protocol -CModemLoRa thisLoRa; // create object for personnalizeed LoRa class -CProtocol12Bytes goodOne; // create object to store data using our protocol - -int ts1=0; // for comparing later the LoRa frames using timestamp data -int ts2=0; // for comparing later the LoRa frames using timestamp data -int id1=0; // for comparing later the LoRa frames using ID data -int id2=0; // for comparing later the LoRa frames using ID data - -bool readFrameAndCheckID(); // function that compares station's ID -bool readFrameAndCheckTS(); // function that compares frame's TimeStamp +CModemLoRa receiveLoRa; // create object for personnalizeed LoRa class +CProtocol12Bytes goodOne; // create object that will be used to send data using our protocol void setup(){ Serial.begin(9600); @@ -30,22 +22,6 @@ void loop() { // frame treatment while(readFrameAndCheckID() == true){ // post to server - EthernetClient postClient; - String postData = "ID="+String(goodOne.getStationId())+"&IDp="+String(goodOne.getGatewayId())+"&TS="+String(goodOne.getTimestampMessage())+"&DT="+String(goodOne.getDataType())+"&D1="+String(goodOne.getDataOne())+"&D2="+String(goodOne.getDataTwo())+"&D3="+String(goodOne.getDataThree()); - if (postClient.connect("btslimayrac.ovh", 80)){ - postClient.print("POST /weather/formulaire/formulaireCollecteLORA.php HTTP/1.1\n"); - postClient.print("Host: btslimayrac.ovh\n"); - postClient.print("Connection: close\n"); - postClient.print("Content-Type: application/x-www-form-urlencoded\n"); - postClient.print("Content-Length: "); - postClient.print(postData.length()); - postClient.print("\n\n"); - postClient.print(postData); - Serial.println("Post to server sent"); - } - else{ - Serial.println("Post failed"); - } } }// end void loop