Arduino:时间安排程序无法正常工作

moh*_*mad 2 input arduino multiprocessing

我正在尝试使用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
Run Code Online (Sandbox Code Playgroud)

码:

#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
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能解决这个问题?

mpf*_*aga 5

该库不符合1.0.0+.

更改替换以下.\ Scheduler\Scheduler.h:

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

然后它至少会为我编译.