electronicsguy / ESP8266

ESP8266 Projects
242 stars 183 forks source link

...to post a bunch of variable at a time #61

Closed Phinder closed 6 years ago

Phinder commented 6 years ago

Hello!

First I would like to thank you for this project and all of your efforts for it, that's really really great. Thank You! And then: I would like to post for example 10x6 or more variables at a time, Because when i measure with the ESP it's not in range to get connected to the internet. However i store the measurements on an SD card and when i get home and get connected to the internet i would like to upload the last measures to the spradsheet. (Each measure takes 5 variable and a timestamp for the record of measure. So it will need 6 variable per measures but fist i tried only just five...) I started to read about the codes, libraries and the doGet method, and modify the codes. Frist i made it to send 5 string variables and then the google script not updated the sheet. After run a debug on the google scripteditor, it said something is wrong with the date variable (on the google script side). I modified it and everything works properly. "I changed: var dateTime = new Date(); to: var dateTime = Utilities.formatDate(new Date(), “GMT+2”, “yyyy-MM-dd’ ‘HH:mm E”); (I use GMT+2 because I’m in Europe,may You need change it based on Your location.)"

Okay, so there is 5 different variable and it works. For the bunch of variables i obscured about to solve it. With my basic common sense I write 25 variable into the sending url and accordingly the variables in googlescript, and it looks really ugly. And also the ESP8266 freezed 4 times of 5 posts. So this 25 variable in one url is not a good way to start...

I would like to get some help how to send a bunch of measures to my spreadsheet. I think if i send one after one the measurements will costs much time and the fear of some error each time during upload to the spreadsheet.

Thanks a lot Philip

Here is the modified code for 5 variables: The code in googlescript: https://pastebin.com/fmVaxCnL Code snippet for ESP8266 in Arduino https://pastebin.com/00kAuZ6K

And here is for 25 variables: Code snippet for ESP8266 in Arduino https://pastebin.com/4Uvv7kYi The code in googlescript: https://pastebin.com/pr6062Vy

electronicsguy commented 6 years ago

Will be coming soon, with lots more features. Please wait for few more weeks.