정보나눔

오픈소스하드웨어 프로젝트에 대한 다양한 정보를 나누는 공간입니다.

마그네틱 도어 센서 질문..
한우영 | 2015-09-28

#include <SPI.h> // needed in Arduino 0019 or later
#include <Ethernet.h>
#include <Twitter.h>

int val;

void setup() {
 pinMode(8, INPUT_PULLUP);   //디지털 8번핀에 연결
}
 void loop() {
   val = digitalRead(8);
   if(val == 1);
       byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

// If you don't specify the IP address, DHCP is used(only in Arduino 1.0 or later).


// Your Token to Tweet (get it from http://arduino-tweet.appspot.com/)
Twitter twitter("3414897019-8uQuHUzSLByP33wnMgf78huC4Foxc2QKzpRBHPv");

// Message to post

char msg[] = "(값)";

  Ethernet.begin(mac);
  // or you can use DHCP for autoomatic IP address configuration.
  // Ethernet.begin(mac);
  Serial.begin(9600);
  
  Serial.println("connecting ...");
  if (twitter.post(msg)) {
    // Specify &Serial to output received response to Serial.
    // If no output is required, you can just omit the argument, e.g.
    // int status = twitter.wait();
    int status = twitter.wait(&Serial);
    if (status == 200) {
      Serial.println("OK.");
    } else {
      Serial.print("failed : code ");
      Serial.println(status);
    }
  } else {
    Serial.println("connection failed.");
  }
 }
 
  

 

 

 

이거 마그네틱 도어 센서로 트위터 올리는 것인데... 계속.. 값이 1 이든 말든 계속 트윗이 올라가고,,

 

con27 GMT
Server: Google Frontend
Content-Length: 27

Error 503 - Too many accessfailed : code 503

 

시리얼 모니터에서 이 오류가 반복됩니다.

 

도와주세요!!

프로필사진

수박쨈 2015-09-29 08:39:40

if(val == 1);

조건문 if에서 뒷부분에 중괄호 사용으로 블럭처리가 아닌 세미콜론으로 문장마침 구조로 되어 있습니다. 

조건문이 실행되지 않으니 이 부분 확인해보세요.

이전글   |    아두이노 다른 웹서버와 연동 질문 드립니다. ... 2015-09-26
다음글   |    2015년 서울메이커페어] 국내 첫 드론파이트 개최!! [다양한 경품 증정 ... 2015-09-29