핫스팟으로도 해보았고 API 키도 받아서
서버접속함수부분을
client.println("GET /data/2.5/weather?q="+location+"&mode=xml"); 에서
client.println("GET /data/2.5/weather?q="+location+"=8eae77cc884c4c9fd092b3f7cafc8623&mode=xml"); 로 바꾸어서 실행시켰습니다.
그런데 저런결과가 나왔습니다.
코코아팹은 누구나 창의적 아이디어를 현실로 만들어 낼 수 있도록
만들고, 공유하고, 배울 수 있는 터전이
되고자 합니다.
아이디와 비밀번호를 잊으셨나요?아이디 / 비밀번호 찾기
코코아팹 회원이 아니신가요? 회원가입
weathercube에서 날씨받아오는 부분 질문드립니다
dkstnwjd | 2015-11-26
|
|
---|---|
weathercube를 만들어보려고하는데 서버연결까지는 된것같은데 다음과 같이 나오고 진행지 되지 않습니다. 무엇이 문제일까요 ㅠ |
|
핫스팟으로도 해보았고 API 키도 받아서 서버접속함수부분을 client.println("GET /data/2.5/weather?q="+location+"&mode=xml"); 에서 client.println("GET /data/2.5/weather?q="+location+"=8eae77cc884c4c9fd092b3f7cafc8623&mode=xml"); 로 바꾸어서 실행시켰습니다. 그런데 저런결과가 나왔습니다. 제가 사용한 weather cube의 전체 코드입니다.
안녕하세요! 현재 올려주신 소스에서 서버 접속이 불안정하여, 아두이노 예제 중 WiFiClinent repeating을 활용해 날씨 데이터 받아오게 수정하였습니다. 우선 APPID도 잘못 넣어주셨구요. 현재 APPID= 빠져있네요. 날씨 데이터를 가져오는 소스는 아래와 같습니다. 위 소스와 마찬가지로 openweathermap API를 이용해 날씨 데이터를 가져오는 소스이구요. 확인해 보시면 weathercode를 반복적으로 받아오는 것을 확인하실 수 있습니다. 나머지 기능 동작에 해당하는 변수와 함수들은 위치에 맞게 넣어주시면 되구요. 아래 소스를 base로 활용하시면 됩니다.
/* This sketch connects to a a web server and makes a request Circuit: created 23 April 2012 http://www.arduino.cc/en/Tutorial/WifiWebClientRepeating #include <SPI.h> int status = WL_IDLE_STATUS; // Initialize the Wifi client library // server address: unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds String location = "seoul"; boolean readingWeather = false; void setup() { // check for the presence of the shield: String fv = WiFi.firmwareVersion(); // attempt to connect to Wifi network: // wait 10 seconds for connection: void loop() { if (inChar == '\n') { // if ten seconds have passed since your last connection, } // this method makes a HTTP connection to the server: // if there's a successful connection: // note the time that the connection was made:
// print your WiFi shield's IP address: // print the received signal strength: int getInt(String input) |
|
이전글 | 하나의 아두이노에 두 개 이상의 RFID 사용은 어떻게 하나요? ... | 2015-11-26 |
다음글 | 안녕하십니까~ | 2015-11-27 |
Klant 2015-11-27 09:04:21
weather cube는 openweathermap API를 사용합니다.
현재 API를 사용하기 위해서는 API 키를 넣어줘야 하는데요(예전에는 API키를 요구하지 않았습니다)
혹시 API키를 넣어주셨나요 ?
안넣어주셨다면 아래 링크에 API 키를 삽입하는 방법에 대해 나와있으니 참고하시고 넣어주시면 되구요.
http://kocoafab.cc/make/564
집에서 사용하는 와이파이 공유기로 와이파이를 잡아주셨다면, 핸드폰 핫스팟으로 와이파이를 잡아주신 후 시도해보세요.
공유기의 보안 설정에 관련되서 안되는 경우도 종종 있거든요.
현재 시리얼 모니터로만 봤을 때 서버에 연결은 되는 것 같습니다.
API 키를 검토해주세요!