Arduino State Machine experiments
I have made this repository which was not at first visible in my GitHub as it is private and I needed to log in.
I have now made this repository public.
I have begun to use Mermaid (https://mermaid.js.org/intro/getting-started.html) as a way of making diagrams for Finite State Machines.
Mermaid can be used to make a range of different diagrams and they can be coded as special text in GitHub pages using Markdown.
stateDiagram-v2
state: "Door"
open --> closed : Closing
closed --> open : Opening
There needs to be some other text between diagrams.
stateDiagram-v2
direction LR
state: "Door"
open --> closed : Closing
closed --> open : Opening
stateDiagram-v2
direction LR
state: "Door"
open --> closed : Closing
closed --> open : Opening
closed --> locked : Locking
locked --> closed : Unlocking
stateDiagram-v2
direction LR
state: "Door"
open --> closed : Closing
open --> locked : XX Cannot lock
closed --> open : Opening
closed --> locked : Locking
locked --> closed : Unlocking
locked --> open : XX Cannot open
stateDiagram-v2
direction LR
state: "Door"
open --> closed_unlocked : Closing
closed_unlocked --> open : Opening
closed_unlocked --> locked : Locking
locked --> closed_unlocked : Unlocking
stateDiagram-v2
direction LR
state: "Door"
open_unlocked --> closed_unlocked : Closing
closed_unlocked --> open_unlocked : Opening
closed_unlocked --> closed_locked : Locking
closed_locked --> closed_unlocked : Unlocking
stateDiagram-v2
direction LR
state: "Door Closed"
[*] --> A : want to lock
state A {
[*] --> Unlocked
Unlocked --> Locked : Locking
Locked --> Unlocked : Unlocking
Unlocked --> [*]
}
[*] --> B : want to open
state B {
[*] --> Closed
Closed --> Open : Opening
Open --> Closed : Closing
Closed --> [*]
}
I am putting my examples for the Embedded Template Library Arduino library into a folder here.
Some of these codes use the StateMachine library and some have been changed to use TaskManagerIO instead.
Empty base case
Example with serial monitor output
This is the first example to blink the LED.
Example using enum class instead of enum.
This is a new example which replaces the previous output using the Arduino moustache for output.
This shows how a format can be defined for the output of the description of a state which will then output one of an array of state descriptions.
This has now been extended to allow for run time values and also error reporting.
The extensions have now been moved to the moustache library.
Timers example from the StateMachine library.