Try these links... for ideas...
UK traffic lights and FSM
The above link will take you to a tutorial about Finite State Machines (FSM).
The model is based on the UK traffic light sequence.
Here's a link to the Node-RED flow.
Node-RED flow
Trust you enjoy reading the tutorial.
I was asked the other day about how to create a Finite State Machine (FSM) with different delays between various transitions. Here is a simple example, based on the UK traffic light sequence, that makes use of the msg.delay option in the Delay node.
Here's a screenshot of the flow.
[sunday_FSM_A]
[{"id":"be3ab1ef.3f0a68","type":"tab","label":"Traffic Lights with variable delay","disabled":false,"info":"","env":[]},{"id":"743e732.c12228c","type":"function","z":"be3ab1ef.3f0a68","name":"Decode…
I posted this project way back in November 2021, so 4-years old now.
This is a photo of the original project installed on my garage wall...
[sunday_roller_door_B]
This week I took another look at the project with a view to bringing it up-to-date.
These are the changes I've implemented...
Re-written the code using Micro-Python
Removed the ESP-01S and re-routed D4 to drive the transistor that drives the relay
Swapped the Wemos D1 Mini for an ESP32-S2-Mini (faster processor and more PSRAM)
E…
Got a bit bored this afternoon so I knocked-up this demo flow. It has a finite state machine (FSM) for each of the 6 signals and an animated slider to mimic a train journey. To keep things simple there is only one buffer block (caution block) - you can obviously modify that by introducing additional blocks and signals.
BOD means Block Occupancy Detector.
Hope you find it useful.
[ScreenShot059]
[ScreenShot060]
[ScreenShot061]
The Node-RED flow is below as together with the screenshots it …
This tutorial documents the steps to build a controller that will boot-up / shut-down an Orange Pi or Raspberry Pi in a graceful way so as to minimise the risk of losing data or corrupting files.
I recently purchased an Orange Pi 5 Pro with a 64GB eMMC and a 512GB NVMe SSD, then installed OpenMediaVault (OMV) on it to serve as a small Network-Attached Storage (NAS) device on my home network. Although OMV provides a web-based user interface for managing the NAS and shutting it down in a controll…
You can code an FSM using 'case' constructs in pure JavaScript.
There are also a number of Node-RED Nodes that implement FSMs...
(I've not used them as I code mine in JS), here is just one as an example...
Do a search for FSM in the flows library tab - you'll find countless nodes.
Finally, here's a link to a tutorial on FSMs I wrote for my IoT students a few years ago...
4 Likes