我有一个Arduino Uno WiFi,我正在尝试使用UnoWifiDevEd库中的RestClient示例启动此PHP脚本,但我只能将该板连接到服务器。
有人可以帮帮我吗?
以下是代码:
#include <Wire.h>
#include <UnoWiFiDevEd.h>
void setup() {
const char* connector = "rest";
const char* server = "https://________.com";
const char* method = "POST";
const char* resource = "/send.php";
Serial.begin(9600);
Ciao.begin();
pinMode(2, INPUT);
delay(10000);
doRequest(connector, server, resource, method);
}
void loop() {
}
void doRequest(const char* conn, const char* server, const char* command, const char* method){
CiaoData data = Ciao.write(conn, server, command, method);
if (!data.isEmpty()){
Ciao.println( "State: " + String (data.get(1)) );
Ciao.println( "Response: " + String (data.get(2)) );
Serial.println( "State: " + String (data.get(1)) );
Serial.println( "Response: " + String (data.get(2)) );
}
else{
Ciao.println ("Write Error");
}
}
答案 0 :(得分:0)
如果是Arduino.org Arduino UNO WiFi Developer Edition,请使用WiFi链接UNO WiFi Serial1 library