안녕하세요.
수박쨈선생님의 도어 알람이 구현을 위해 무단히 노력중입니다ㅠㅠ
잘 안되는 부분이 있어서 질문 하겠습니다!!
알려주신 코드소스로 업로드하고 시리얼모니터를 확인하면 에러부분이 있습니다.
그리고 또 의문점이 드는건 pushingbox 사이트에서 Test Scenario를 눌러도 핸드폰에는 알람이 안 울립니다
그 전까지는 잘 따라하였습니다~
혹시 어디가 문제인지 알 수 있으실까요??ㅠ
사용한 코드입니다.
#include
#include "WizFi250.h"
#define DEVICEID "deviceID"
char ssid[] = "iptime333";
char pass[] = "*******";
int status = WL_IDLE_STATUS;
char server[] = "api.pushingbox.com";
unsigned long lastConnectionTime = 0;
const unsigned long postingInterval = 5000L;
boolean getIsConnected = false;
String rcvbuf;
WiFiClient client;
void httpRequest();
void printWifiStatus();
void setup()
{
Serial.begin(115200);
Serial.println(F("\r\nSerial Init"));
pinMode(8, INPUT_PULLUP);
WiFi.init();
if (WiFi.status() == WL_NO_SHIELD) {
Serial.println("WiFi shield not present");
// don't continue
while (true);
}
while ( status != WL_CONNECTED) {
Serial.print("Attempting to connect to WPA SSID: ");
Serial.println(ssid);
status = WiFi.begin(ssid, pass);
}
Serial.println("You're connected to the network");
printWifiStatus();
}
void loop()
{
while (client.available()) {
char c = client.read();
if ( c != NULL ) {
if (rcvbuf.length() > 20)
rcvbuf = "";
rcvbuf += c;
Serial.write(c);
}
}
if (millis() - lastConnectionTime > postingInterval) {
if (digitalRead(8)) {
httpRequest();
}
}
rcvbuf = "";
}
void httpRequest()
{
Serial.println();
client.stop();
if (client.connect(server, 80)) {
Serial.println("Connecting...");
client.print(F("GET /pushingbox?devid=vEC5667668DE0745"));
client.print(DEVICEID);
client.print(F(" HTTP/1.1\r\n"));
client.print(F("Host: api.pushingbox.com\r\n"));
client.print(F("User-Agent: Arduino\r\n"));
client.print(F("\r\n\r\n"));
lastConnectionTime = millis();
getIsConnected = true;
}
else {
Serial.println("Connection failed");
getIsConnected = false;
}
}
void printWifiStatus() {
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
long rssi = WiFi.RSSI();
Serial.print("Signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");
}
시리얼 모니터 에러 부분입니다.
[WizFi250] Connecting to api.pushingbox.com
Connecting...
HTTP/1.1 400 InvalidQueryParameterValue
Set-Cookie: 60gpBAK=R1224194687; path=/; expires=Tue, 13-Dec-2016 12:10:41 GMT
Date: Tue, 13 Dec 2016 11:05:49 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Set-Cookie: 60gp=R2337129332; path=/; expires=Tue, 13-Dec-2016 12:11:23 GMT
Server: Apache
Content-Location: pushingbox.php
Vary: negotiate,Accept-Encoding
TCN: choice
X-Powered-By: PHP/5.5.35
3e
<?xml version="1.0" encoding="UTF-8"?><error>Bad DevID</error>
0
|