2013-05-08 7 views
2

Arduino 시간 스케줄러를 사용하려고합니다. here의 코드를 복사했지만 라이브러리를 가져 왔지만 컴파일되지 않았습니다. 여기에 컴파일 오류 코드와 코드 자체는 다음과 같습니다Arduino : 시간 스케줄러가 작동하지 않습니다.

오류 :

In file included from time2.ino:1: 
C:\arduino\arduino-1.0.3\libraries\Scheduler/Scheduler.h:62: error: 'byte' does not name a type 
C:\arduino\arduino-1.0.3\libraries\Scheduler/Scheduler.h:64: error: 'NUMBER_OF_SCHEDULED_ACTIONS' was not declared in this scope 
C:\arduino\arduino-1.0.3\libraries\Scheduler/Scheduler.h:65: error: 'byte' does not name a type 

코드 :

#include <Scheduler.h> // [url=http://playground.arduino.cc/uploads/Code/Scheduler.zip]Scheduler.zip[/url] 

Scheduler scheduler = Scheduler();  //create a scheduler 

const byte ledPin = 13;    //LED on pin 13 

void setup(){ 
    Serial.begin(9600);     //Iitialize the UART 
    pinMode(ledPin,OUTPUT);    //set pin 13 to OUTPUT 
} 

void loop(){ 
    scheduler.update();     //update the scheduler, maybe it is time to execute a function? 

    if (Serial.available()){   //if we have recieved anything on the Serial 
    scheduler.schedule(setHigh,500); //schedule a setHigh call in 500 milliseconds 
    Serial.flush();     //flush Serial so we do not schedule multiple setHigh calls 
    } 
} 

void setHigh(){ 
    digitalWrite(ledPin,HIGH);   //set ledPin HIGH 
    scheduler.schedule(setLow,500);  //schedule setLow to execute in 500 milliseconds 
} 

void setLow(){ 
    digitalWrite(ledPin,LOW);   //set ledPin LOW 
} 

어떻게이 문제를 해결할 수 있습니까?

답변

5

라이브러리가 1.0.0 이상을 준수하지 않습니다. .

변경은 다음 \ 스케줄러 \ Scheduler.h 교체 :

< #include <WProgram.h> 
--- 
> #if defined(ARDUINO) && ARDUINO >= 100 
> #include "Arduino.h" 
> #else 
> #include "WProgram.h" 
> #endif 

그런 다음 그것을 컴파일, 나를 위해 적어도.

+0

고맙습니다. – mohammad

+0

@ 모하마드 당신도 맞는 대답을 받아 들여야합니다. 이것은이 사이트에 대한 감사의 말입니다. – Alexey

관련 문제