Hello,
I'm about a week out from a project deadline. My project relies heavily on the SMlib
http://playground.arduino.cc/Code/SMlib
I've used this library extensively and it's worked like a charm every time. I do a lot of simple robotics so it's a perfect fit. The problem is, last night I began working on a Teensy for part of the project. It has worked with the SMlib before, for a huge project that ran great. I installed the latest update to the IDE, then I installed the latest Teensy addon, and now NO project using the SMlib will compile! The IDE says that the states are not declared when they clearly are. The very simple example code won't even compile. Here's an example:
#include <SM.h>
SM Simple(S1);//create simple statemachine
#define toggle 9//pin to toggle led on and off
#define led 13
void setup(){
pinMode(led, OUTPUT);
}
void loop(){
EXEC(Simple);//run statemachine
}
State S1(){
digitalWrite(led, HIGH);//turn led on
if(digitalRead(toggle)) Simple.Set(S2);//wait for toggle pin to go high and change state to S2
}
State S2(){
if(!digitalRead(toggle)) Simple.Set(S3);//wait for toggle pin to go low and change state to S3
}
State S3(){
digitalWrite(led, LOW);//turn led off
if(digitalRead(toggle)) Simple.Set(S4);//wait for toggle pin to go high and change state to S4
}
State S4(){
if(!digitalRead(toggle)) Simple.Set(S1);//wait for toggle pin to go low and change state to S1
}
and it kicks out this error message:
Arduino: 1.6.6 (Mac OS X), TD: 1.26, Board: "Teensy 3.2 / 3.1, Serial, 96 MHz optimized (overclock), US English"
example_2:4: error: 'S1' was not declared in this scope
SM Simple(S1);//create simple statemachine
^
exit status 1
'S1' was not declared in this scope
Anybody have any ideas? I'm supposed to start implementing today but now I'm stuck.
Here's a vid of a project I had where all these things worked before: