Display-o-tron key assignment changes


Before I confuse myself totally. I would like some advice.
I want to create a state machine and update and assign key actions depending on the state.
Can I use:
def touch_cancel(channel,event)
if config.disstate==1 :
do some things
if config.distate==2 :
do some other things

Is there a better way? I’m a beginner hobby programmer. I couldn’t find any info on the threads or on other forums.


This seems like a pretty sensible way of accomplishing what you want.

Note, you can format your code on the forums using three backticks like so:

Your code here

Or by indenting it with 4 spaces.