Go Down

Topic: New library: arduino-fsm (Read 809 times) previous topic - next topic

jonblack

I've created a new arduino library called arduino-fsm for implementing a finite state machine1. It's similar to this library2; however, the user triggers a transition by sending an event, allowing the client to remove the need for complex switch statements in their code. This is really an implementation of the State design pattern, using callbacks instead of inheritence.

The code is available on github: https://github.com/jonblack/arduino-fsm

See the example code for a guide on using it. I'll follow up with a blog post soon. It's worth noting the following callbacks:

* on_enter (when a state is entered)
* on_exit (when a state is exited)
* on_transition (when transitioning from one state to another)

Each callback is optional.

Questions? Post here. Clear bugs? See the github issue tracker.

[1] https://en.wikipedia.org/wiki/Finite-state_machine
[2] http://playground.arduino.cc/Code/FiniteStateMachine

robtillaart

Thanks for sharing, bookmarked!
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Chris72622

May you add some more examples, please (because it's a little bit tricky for beginners like me)?  :~

Greetz Chris
https://github.com/jeffThompson/DarkArduinoTheme

Chris72622

Nowhere i can find the documentation of timeInCurrentState().

Please help!  :smiley-eek:

Greetz Chris
https://github.com/jeffThompson/DarkArduinoTheme

Chris72622

Nowhere i can still find the documentation of timeInCurrentState().

Please help!  :smiley-eek:

Greetz Chris
https://github.com/jeffThompson/DarkArduinoTheme

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy