Arduino Scheduler Library NOT Working

Hi guys, I am a new member of this forum.I had a compile error with Arduino Scheduler library.
My main purpose controls of servo motor and Lcd display simulataneously and independent (or dependent).
I had many tutorial from internet But I will write just 2 of them from arduino.cc

My Codes; (from http://arduino.cc/en/Tutorial/MultipleBlinks)

// Include Scheduler since we want to manage multiple tasks.
#include <Scheduler.h>

int led1 = 13;
int led2 = 12;
int led3 = 11;

void setup() {
  Serial.begin(9600);

  // Setup the 3 pins as OUTPUT
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);

  // Add "loop2" and "loop3" to scheduling.
  // "loop" is always started by default.
  Scheduler.startLoop(loop2);
  Scheduler.startLoop(loop3);
}

// Task no.1: blink LED with 1 second delay.
void loop() {
  digitalWrite(led1, HIGH);

  // IMPORTANT:
  // When multiple tasks are running 'delay' passes control to
  // other tasks while waiting and guarantees they get executed.
  delay(1000);

  digitalWrite(led1, LOW);
  delay(1000);
}

// Task no.2: blink LED with 0.1 second delay.
void loop2() {
  digitalWrite(led2, HIGH);
  delay(100);
  digitalWrite(led2, LOW);
  delay(100);
}

// Task no.3: accept commands from Serial port
// '0' turns off LED
// '1' turns on LED
void loop3() {
  if (Serial.available()) {
    char c = Serial.read();
    if (c=='0') {
      digitalWrite(led3, LOW);
      Serial.println("Led turned off!");
    }
    if (c=='1') {
      digitalWrite(led3, HIGH);
      Serial.println("Led turned on!");
    }
  }

  // IMPORTANT:
  // We must call 'yield' at a regular basis to pass
  // control to other tasks.
  yield();
}

My errors;

MultipleFunctions3LEDs.ino:2:23: warning: Scheduler.h: No such file or directory
MultipleFunctions3LEDs.ino: In function 'void setup()':
MultipleFunctions3LEDs:19: error: 'Scheduler' was not declared in this scope
MultipleFunctions3LEDs.ino: In function 'void loop3()':
MultipleFunctions3LEDs:63: error: 'yield' was not declared in this scope

Second codes; (from Arduino Playground - Scheduler Library)

#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
}

My errors;

Oneledver1.ino:1:107: warning: Scheduler.h: No such file or directory
Oneledver1:3: error: 'Scheduler' does not name a type
Oneledver1.ino: In function 'void loop()':
Oneledver1:13: error: 'scheduler' was not declared in this scope
Oneledver1.ino: In function 'void setHigh()':
Oneledver1:23: error: 'scheduler' was not declared in this scope

if u have any idea (and/or suggesstion) pls share with me.
Best regards

Note: What I did before post this error message ;)?
*I downloaded Scheduler library and added to library files.
*Scheduler.h added written program file
*Scheduler.h opened and changed "Wprogram.h" to "Arduino.h".
*Tried (not worked for me) >> Arduino Scheduler not working - Product Design - Arduino Forum
*Tried (not worked for me) >> input - Arduino : time scheduler is not working - Stack Overflow
*I tried Arduino 1.04 and 1.03 in Windows 64 bit (failed)
;.(((

*I downloaded Scheduler library and added to library files.

To what "library files"? How?

The error messages indicate that "the wrong one" and "incorrectly" are the answers to these questions.

*Scheduler.h added written program file

No idea what this means.

Not that it matters. The first issue needs to be dealt with first.

PaulS:

*I downloaded Scheduler library and added to library files.

To what "library files"? How?

The error messages indicate that "the wrong one" and "incorrectly" are the answers to these questions.

*Scheduler.h added written program file

No idea what this means.

Not that it matters. The first issue needs to be dealt with first.


If you take a glance at first line of examples (of codes).You will see #include <Scheduler.h>
Scheduler library
Downloaded from; Arduino Playground - HomePage
pls look at above link

and
Maybe I know wrong. If you use any library on arduino (or C, C# whatever), you should add refence dlls or libraries to written program file.

thanks for reply+best regards

Where exactly did you put the library files ?
Please do not simply answer "in the libraries folder", be more explicit.

UKHeliBob:
Where exactly did you put the library files ?
Please do not simply answer "in the libraries folder", be more explicit.

Firstly I have Scheduler (library) file downloaded from Arduino Playground - HomePage
(You can look at to Download, install and import part)
and added to arduino-1.0.4\libraries (just copy and paste(inside the libraries file))

Secondly I have a program code (my own code)
for ex;sketch_may24a.ino (my codes) sketch_may24a(file name)
I took Scheduler.h from Scheduler (library) file and copy and paste to sketch_may24a(file name)

I hope this is more understandable
if u have any more question pls post it
thanks

Furthermore
If you know any (basic) example with Scheduler library (or run to multiple functions at sametime) , you can share links or codes.

and added to arduino-1.0.4\libraries

That is the problem.
Read this http://arduino.cc/en/Guide/Libraries It explains where the library files should be installed.

I read the installation tutorial.
I did not install automatically , I did that manuel (2.version) (I think library installed well because when i import it is written #include <Scheduler.h> on code line)
As shown on the picture there is no import library>>ADD LIBRARY...

Read the manual installation instructions on the page I linked to, then follow them. User contributed libraries do not go into arduino-1.0.4\libraries.

Here are the instructions from that link

For example, if you're installing a library called "ArduinoParty", uncompress ArduinoParty.zip. It should contain a folder called ArduinoParty, with files like ArduinoParty.cpp and ArduinoParty.h inside. (If the .cpp and .h files aren't in a folder, you'll need to create one. In this case, you'd make a folder called "ArduinoParty" and move into it all the files that were in the ZIP file, like ArduinoParty.cpp and ArduinoParty.h.)
Drag the ArduinoParty folder into this folder (your libraries folder). Under Windows, it will likely be called "My Documents\Arduino\libraries". For Mac users, it will likely be called "Documents/Arduino/libraries". On Linux, it will be the "libraries" folder in your sketchbook.
Your Arduino library folder should now look like this (on Windows):
My Documents\Arduino\libraries\ArduinoParty\ArduinoParty.cpp
My Documents\Arduino\libraries\ArduinoParty\ArduinoParty.h
My Documents\Arduino\libraries\ArduinoParty\examples

Does that match where you have put the Scheduler library folder and its files ?

UKHeliBob:
Read the manual installation instructions on the page I linked to, then follow them. User contributed libraries do not go into arduino-1.0.4\libraries.

Here are the instructions from that link

For example, if you're installing a library called "ArduinoParty", uncompress ArduinoParty.zip. It should contain a folder called ArduinoParty, with files like ArduinoParty.cpp and ArduinoParty.h inside. (If the .cpp and .h files aren't in a folder, you'll need to create one. In this case, you'd make a folder called "ArduinoParty" and move into it all the files that were in the ZIP file, like ArduinoParty.cpp and ArduinoParty.h.)
Drag the ArduinoParty folder into this folder (your libraries folder). Under Windows, it will likely be called "My Documents\Arduino\libraries". For Mac users, it will likely be called "Documents/Arduino/libraries". On Linux, it will be the "libraries" folder in your sketchbook.
Your Arduino library folder should now look like this (on Windows):
My Documents\Arduino\libraries\ArduinoParty\ArduinoParty.cpp
My Documents\Arduino\libraries\ArduinoParty\ArduinoParty.h
My Documents\Arduino\libraries\ArduinoParty\examples

Does that match where you have put the Scheduler library folder and its files ?

I had done it
D:\arduino-1.0.3\libraries\Scheduler\Scheduler.cpp
D:\arduino-1.0.3\libraries\Scheduler\Scheduler.h
and example file and keywords.txt in D:\arduino-1.0.3\libraries\Scheduler\

still not compiled =( =(=(

Could you compile in your computer the basic example;
http://playground.arduino.cc/Code/Scheduler
thanks

I had done it
D:\arduino-1.0.3\libraries\Scheduler\Scheduler.cpp
D:\arduino-1.0.3\libraries\Scheduler\Scheduler.h
and example file and keywords.txt in D:\arduino-1.0.3\libraries\Scheduler\

That is NOT where user downloaded libraries go. Re-read all the stuff above that is telling you that. When you get the library installed in the correct place, the samples will compile.

PaulS:

I had done it
D:\arduino-1.0.3\libraries\Scheduler\Scheduler.cpp
D:\arduino-1.0.3\libraries\Scheduler\Scheduler.h
and example file and keywords.txt in D:\arduino-1.0.3\libraries\Scheduler\

That is NOT where user downloaded libraries go. Re-read all the stuff above that is telling you that. When you get the library installed in the correct place, the samples will compile.

After coffee break , I will do it again all of them.
To night or tomorrow I will wrote result positive or negative

I will do it again all of them

When you do it do not put the libraries in the same place you did before. Put them in the right place this time.

I just tried it and it workes fine. But re-reading your original question I noticed two things: you nowhere mention the board you are using. The scheduler only works for the Due. And you can only use the Beta release 1.5.n (presently 1.5.2) of the IDE. Once you have the 1.5.2 running doe the following: In the IDE under 'tools' you select the Due as device. Than under under 'sketch' you import the Scheduler library into your sketch. And than the sketch compiles successfully. At least on my Mac. :wink:

Have fun!

Hi AlfredJingle,
I read your post.You are right about arduino type which must be Arduino Due. But I also tried another (or same library) which is at Arduino Playground - Scheduler Library.
At first it did not work on my system. If I remember correctly, I open scheduler library file > scheduler.h> and changed wiring.h to arduino.h
Now it works on my platform(arduino mega) :slight_smile:
sorry for late post+best regards

will scheduler.h works on arduino uno???

maneeesh:
will scheduler.h works on arduino uno???

Are you able to read plain English sentences?

https://www.arduino.cc/en/pmwiki.php?n=Reference/Scheduler

There is written: "The Scheduler library enables the Arduino Due to run multiple functions at the same time."

First sentence in the first paragraph.

If you are not running an Arduino DUE, you cannot use the scheduler library.

Sometimes it's as easy as reading the first sentence in the first paragraph of a page on the Internet.