1
我遇到了一個問題,我曾經成功使用代碼向Ubidots發送數據,但現在我無法發送它,我嘗試使用另一個Ubidots帳戶並且它也沒有工作。有人可以幫助我,非常感謝你。 PS。該代碼可以使設備與WIFI連接,但不能將數據發送到Ubidots。Arduino UNO(9600)與Wizfi250不能發送數據到Ubidots
#include "UbidotsWizFi250.h"
#define TOKEN "YNbIJdlwtH8s9p4xYNlZTuqhB6bfYY" // Replace it with your Ubidots token
#define ID "5795e2f876254249c8ce246a" // Replace it with your Ubidots' variable ID
#define WLAN_SSID "XXXXX" // Your WiFi SSID, cannot be longer than 32 characters!
#define WLAN_PASS "xxxxxxxxx" // Replace it with your WiFi pass
// Security can be OPEN, WEP, WPA, WPAAES, WPA2AES, WPA2TKIP, WPA2
#define WLAN_SECURITY "WPA2"
Ubidots client(TOKEN);
void setup() {
Serial.begin(9600);
while(!client.wifiConnection(WLAN_SSID, WLAN_PASS, WLAN_SECURITY));
}
void loop() {
int value = analogRead(A4);
client.add(ID,value);
client.sendAll();
Serial.println("--------------------");
delay(1000);
}
https://github.com/NaSao/MoistureAlarm/blob/master/pushUbidotsData.ino在這裏你可以找到我的代碼 –