WTA : nodeMCU DHT11/22 send to EasyIoT server

5 years 5 months ago #1496 by Dennis
Exactly. You can use this method (server sending request to sensor) with arduino ide as well, see for example
iot-playground.com/2-uncategorised/40-es...y-switch-arduino-ide

(although it needs be modified for dht11, but same principle of connection and response applies)

regards

Please Log in or Create an account to join the conversation.

5 years 5 months ago #1497 by lesjaw

lesjaw wrote:

Dennis wrote: i think you should try to read the dht22/11 a few times before sending data, because the first read sometimes gives garbage. But im just guessing here...

regards


yes but thats another case, because already get the right data to send..

the problem is sending the data to EasyIoT server.. i already make 2 POST into the right folder..but only one got executed/updated by EasyIoT server


i was thinking about making 2 of WiFiClient connection in void loop(), but arduino IDE give me error :
DHT11Esp.ino: In function 'void loop()':
DHT11Esp.ino:104:14: error: redeclaration of 'WiFiClient client'
DHT11Esp.ino:68:14: error: 'WiFiClient client' previously declared here

Please Log in or Create an account to join the conversation.

5 years 5 months ago #1498 by lesjaw

Dennis wrote: Exactly. You can use this method (server sending request to sensor) with arduino ide as well, see for example
iot-playground.com/2-uncategorised/40-es...y-switch-arduino-ide

(although it needs be modified for dht11, but same principle of connection and response applies)

regards


yes, already take look of that code too..thats what i post on prievous page..

dennis, is there any chance to make 2 WiFi client in a loop..
example liket this..

WiFiClient client
POST bla bla
WiFiClient client.close

WifiClient client
POST bla bla
WiFiClient client.close

is it possible?

Please Log in or Create an account to join the conversation.

5 years 5 months ago - 5 years 5 months ago #1499 by lesjaw

lesjaw wrote:

Dennis wrote: Exactly. You can use this method (server sending request to sensor) with arduino ide as well, see for example
iot-playground.com/2-uncategorised/40-es...y-switch-arduino-ide

(although it needs be modified for dht11, but same principle of connection and response applies)

regards


yes, already take look of that code too..thats what i post on prievous page..

dennis, is there any chance to make 2 WiFi client in a loop..
example liket this..

WiFiClient client
POST bla bla
WiFiClient client.close

WifiClient client
POST bla bla
WiFiClient client.close

is it possible?


i think there is no close function of WiFiCleint..lol
after i send the first post connection got close automatically..
i thin i know now
client.print(String("POST ") + urlh + " HTTP/1.1\r\n" +
               "Host: " + String(host) + "\r\n" + 
               "Connection: close\r\n" + 
               "Authorization: Basic " + unameenc + " \r\n" + 
               "Content-Length: 0\r\n" + 
               "\r\n");

"Connection: close\r\n" +

damn it close the connection so..the second of POST will not get updated..right??

Please Log in or Create an account to join the conversation.

5 years 5 months ago - 5 years 5 months ago #1500 by Dennis
replace with "Connection: keep-alive" and find out, i'd say! :)

edit - and 1000ms is way too long since the reply is coming in, better to wait after getting the rrsponse from the server and not before, the 10ms is just for the wifi subsystem to catch up.. no need to extend to one second

Please Log in or Create an account to join the conversation.

5 years 5 months ago #1501 by lesjaw
ups not work..disable Connection: close\r\n" + doesnt work either.. still only first POST get updated

Please Log in or Create an account to join the conversation.

Time to create page: 0.284 seconds

Forum latest

  • No posts to display.