Web2Py从Arduino(ESP8266WiFi)获取请求
我正在使用NodeMCU,希望将数据记录到本地Web2Py服务器 请求:“”在浏览器中正常工作,并返回记录id 我的Arduino可以连接到我的服务器,但不会收到任何返回数据错误或其他错误,并且我的数据库中不会显示任何内容Web2Py从Arduino(ESP8266WiFi)获取请求,arduino,get,web2py,esp8266,Arduino,Get,Web2py,Esp8266,我正在使用NodeMCU,希望将数据记录到本地Web2Py服务器 请求:“”在浏览器中正常工作,并返回记录id 我的Arduino可以连接到我的服务器,但不会收到任何返回数据错误或其他错误,并且我的数据库中不会显示任何内容 // This will send the request to the server samptime = millis(); rpm = (samptime + 333) % 96789; String request = "10.0.0.244:8000/ardulog
// This will send the request to the server
samptime = millis();
rpm = (samptime + 333) % 96789;
String request = "10.0.0.244:8000/ardulog/default/add/"+String(samptime)+"/"+String(rpm)+" HTTP/1.1";
Serial.println("\ntrying: ");
Serial.println("GET " + request);
Serial.println("host: minion.local");
client.println("GET " + request);
client.println("host: minion.local");
// if there are incoming bytes available
// from the server, read them and print them:
while (client.available()) {
char c = client.read();
Serial.print(c);
}
Serial.println("closing connection");
client.stop();
我已经尝试了我能想到的每一种变体,但只得到以下结果:
connecting to minion.local
[hostByName] request IP for: minion.local
[hostByName] Host: minion.local IP: 10.0.0.244
Requesting:
GET 10.0.0.244:8000/ardulog/default/add/112725/16269 HTTP/1.1
host: minion.local
closing connection
wait 5 sec...
为什么我没有读取从服务器返回的任何内容?已解决!虽然我没有成功发布到Google Sheets,但只需将“GET to POST”一词改为“GET to POST”即可使用Web2Py,而不发送任何身体数据:
if(client.connect(host,port))
client.println("POST /ardulog/default/add/" + String(samptime)+ "/" + String(rpm) + " HTTP/1.1");
(但仍然没有从服务器接收结果页)