Uncategorized

Active today
Viewed 15 times

# How to use “State Diagrams” to describe the states of LEDs, Buttons, etc of a Rpi game machine？

I am trying to describe the states of all my units connected to the Raspberry Pi. I have several buttons, magnets, reed switches, LEDs, and other. This is a game and it has few phases. I want to describe states of each element for each phase and conditions to pass from one phase to another. I tried to use a state diagram, but there no states for elements. May be somebody has an example or the name of this diagram?

• Your question is unclear to me, but AFAIK, what you seem to be describing is in fact a state diagram. There are several “types” of state diagrams with different characteristics – perhaps that’s what you’re after? Try this Wikipedia article on state diagrams as a starter. – Seamus 2 hours ago
• Hi Dzam, welcome and nice to meet you. Ah let me see. You gaming system is a bit completed. Now let me summarize. (1) Your game system has physical devices such as LED, button, magnet, reed etc. (2) You system has “phases” such as (a) game setup, (b) game playing, (c) game over, (3) Each phase has sequential/concurrent “states” such as the following: (4) State x: (i) all LED on, (ii) all button not pushed, (iii), … (5) State y: (i) button 2 pushed, (ii) reed on, (iii) magnet demagnetized, … You might like to comment or make counter suggestion on how to describe it. / continue, .. – tlfong01 1 hour ago
• You might to wiki for a rough idea: (1) “State Diagram – Wikipedia“：en.wikipedia.org/wiki/State_diagram, (2) “UML State Machine – Wikipedia”：en.wikipedia.org/wiki/UML_state_machine. I like the UML wiki better. UML explains “actions” “trigger” “events”, “behaviour” “protocol” rather than state “transitions” It is good to use a pocket calculator example states: (a) switch on calculator, (b) push button (action) trigger events (LCD display digits), (c) protocols eg. to add two numbers, (i) “x > + > y > =” or (ii) “= > x > y > +”. State stuff is a hard. Go slow. Cheers. – tlfong01 49 mins ago
• And you don’t need newbie scary state diagrams with labelled circles and arrows. Those diagrams are very hard to draw nicely. For newbies toy projects, a flowchart can do as well: (1) Flowchart I2C event triggered state trnsisition: imgur.com/gallery/ja4GlM0. Actually even flowchart type state diagrams are also hard to draw. I am usually lazy and just draw timed decision charts. Please let me know if you wish to see my example of decision tables. Feel free to ask me other state diagrams questions newbies are too afraid to ask. Happy gaming. Cheers. – tlfong01 7 mins ago
• References: (1) “Digital 16bit Serial Output Type Ambient Light Sensor IC – RoHM Semi”:mouser.com/datasheet/2/348/bh1750fvi-e-186247.pdf (2) “Using the BH1750FVI I2C Digital Light Sensor – matt, RpiSpy 2015mar31”: raspberrypi-spy.co.uk/2015/03/…, (3) Using BH-1750 Light Sensor Problem raspberrypi.stackexchange.com/questions/112485/…. Cheers. – tlfong01 3 mins ago    Edit

Categories: Uncategorized

This site uses Akismet to reduce spam. Learn how your comment data is processed.