Hello guys!
I want run muliple task whit Scheduler lib.
but here is my error:
void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
Scheduler.startLoop(loop2);
}
exit status 1
expected unqualified-id before '.' token
Hello guys!
I want run muliple task whit Scheduler lib.
but here is my error:
void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
Scheduler.startLoop(loop2);
}
exit status 1
expected unqualified-id before '.' token
You expect help when you only provide 5 lines of your code ?
you did not initialize a scheduler object.
Scheduler scheduler = Scheduler(); //should be written into your code after #include <Scheduler.h>
5 lines of code would have been enough to see that! ![]()
Why use a library for such a simple double-blink at all?
const byte led1 = 12;
const byte led2 = 11;
void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
digitalWrite(led1, HIGH);
digitalWrite(led2, HIGH);
}
void loop() {
static unsigned long lastL1;
static unsigned long lastL2;
unsigned long topLoop = millis();
if (topLoop - lastL1 >= 1000) {
digitalWrite(led1, !digitalRead(led1));
lastL1 = topLoop;
}
if (topLoop - lastL2 >= 500) {
digitalWrite(led2, !digitalRead(led2));
lastL2 = topLoop;
}
}
sherzaad:
you did not initialize a scheduler object.Scheduler scheduler = Scheduler(); //should be written into your code after #include <Scheduler.h>
5 lines of code would have been enough to see that!
Yes, but they have to be the right five lines.
Did you bother to post the new error?
scheduler != Scheduler
Maybe have a look at the demo Several Things at a Time - no libraries required.
...R
So here is my code: :o
int led1 = 12;
int led2 = 11;
#include <Scheduler.h>
Scheduler scheduler = Scheduler();
void setup() {
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
}
void loop() {
Scheduler.startLoop(ledloop1);
Scheduler.startLoop(ledloop2);
}
void ledloop2()
//load led
{
digitalWrite(led2, HIGH);
delay(300);
digitalWrite(led2, LOW);
delay(300);
}
void ledloop1()
//traffic led
{
digitalWrite(led1, HIGH);
delay(1000);
digitalWrite(led1, LOW);
delay(1000);
}
The problem is in:
void loop() {
Scheduler.startLoop(ledloop1); //expected ';' before '}' token
Scheduler.startLoop(ledloop2); //expected ';' before '}' token
}
Please help me guys!
See reply #7
Why use a library for such a simple double-blink at all?
Aw, come on. When people post huge programs with a problem, we ask them to try to pare it down to a smaller example. Here was have a small example, and we're complaining that it doesn't justify the methodology?
I think it's perfect. Presumably the OP has a more complex program in mind, but is trying to start out with a simple example, and that's fine...
Scheduler scheduler = Scheduler();
:
void loop() {
Scheduler.startLoop(ledloop1);
Capitalization matters. "Scheduler" is the class name, but the INSTANCE of the scheduler you're creating is "scheduler", which means that the things like startLoop() should be scheduler.startLoop(ledloop1); instead of Scheduler.startLoop(ledloop1);
(This is one reason to not use the same name. It's be clearer if you had "Scheduler mySched = Scheduler();" and "mySched.startLoop(ledloop1);")
the problem is now
'class Scheduler' has no member named 'startLoop'
But i cant see the good code!! ![]()
"scheduler.startLoop(ledloop1);" etc.
Maybe the red(bad)/green(good) colour coding confused you.
The problem is :
:o :o :o :o :o :o
exit status 1
'class Scheduler' has no member named 'startLoop'
THIS is the problem.
We need the full error output, not just the little fragment that happens to be shown at the bottom of the console window because you didn't scroll up.
When you encounter an error you'll see a button on the right side of the orange bar "Copy error messages". Click that button. Paste the error in a message here using code tags.
hi the full error:
Arduino: 1.8.2 (Windows XP), Alaplap:"Arduino/Genuino Uno"
C:\Documents and Settings\Soma\Dokumentumok\Arduino\sketch_apr21bgfg\sketch_apr21bgfg.ino: In function 'void loop()':
sketch_apr21bgfg:14: error: 'class Scheduler' has no member named 'startLoop'
scheduler.startLoop(ledloop1);
^
exit status 1
'class Scheduler' has no member named 'startLoop'
Ennek a jelentésnek több információja lehetne
a "Bővebb kimenet mutatása fordításkor"
opció engedélyezésével a Fájl -> Beállítások-ban.
The problem is there are multiple libraries named "Scheduler". There is an official Arduino library by that name:
That library does have a function named startLoop. However, that library is not compatible with the Arduino Uno so I can tell that's not the library in use. I suspect you are instead using a different library named Scheduler. Please post a link to where you downloaded the Scheduler library. Use the chain links icon on the toolbar to make the link clickable.
I just found that other Scheduler library here. It's only for SAMD based Arduino like Due/Zero.
The OP did not say what kind of Arduino they are using, so either they have a SAMD Arduino and downloaded the wrong version, or they have an ATMega based Arduino and are going to be disappointed! Very matter indeed!
I downloader from here:
Scheduler Download
That could be the wrong version. What kind of Arduino are you using?