class Behavior

Hi, is this the right place to post an Arduino library?

The purpose is to break arduino programs into multiple "behaviors". Complex arduino programs can be tough to understand. setup() and loop() end up with a bunch of code, and it's hard to tell which bits of code are controlling different devices, which are unrelated bits of "control" logic, and what is "glue".

Go for it. You might also want to put it in the playground, and just link to it from this forum.

I'm trying to use the Behavior library. I have loaded the files into my hardware library, but i am having trouble with the syntax.

Here's a list of what I have tried:




any suggestions?

Behavior is a class, not a function. You'll need to derive a class from it, and have its "run" method call goStraight(). For example (and I haven't tested the code below so I'm sure it is wrong):

class GoStraight : public Behavior { public: void Run() { goStraight(); } }

Then, make sure to create an instance of GoStraight: GoStraight go_straight;

Then make sure to call Behavior::RunAllReady in loop().

I've made a bunch of changes to the Behavior class. I should upload the newest.

After using it for a while now, it really cleans your code up, but it chews up a lot of extra space. I've got ideas on how to fix some of that. But some of it is due to the AVR GCC doing weird things.