Matt's Mathematical Magic Machine (M4)

This is just pure fun!!!

Think of a number between 1 and 15 and this magical machine will find out what it is for you.

Here's the magical code with an embedded FSM (it uses the node ui_table which you may need to install).
I've used the 'dark theme' for the dashboard. You might want to change the (yellow) font colour.

[{"id":"c54a85f8.963e","type":"subflow","name":"Card_4","info":"","category":"","in":[{"x":180,"y":240,"wires":[{"id":"86ee4cdf.bb6158"},{"id":"dc9e4802.e40fa"}]}],"out":[{"x":680,"y":340,"wires":[{"id":"7dd1d003.a49328","port":0},{"id":"1bd4fd1f.19ac7b","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"19458b4e.29a1cd","type":"ui_table","z":"c54a85f8.963e","group":"2c7a0b78.a0cdec","name":"Card_4","order":2,"width":"4","height":"2","columns":[{"field":"col_1","title":"","width":"25%","align":"center","formatter":"html","formatterParams":{"target":"_blank"}},{"field":"col_2","title":"","width":"25%","align":"center","formatter":"html","formatterParams":{"target":"_blank"}},{"field":"col_3","title":"","width":"25%","align":"center","formatter":"html","formatterParams":{"target":"_blank"}},{"field":"col_4","title":"","width":"25%","align":"center","formatter":"html","formatterParams":{"target":"_blank"}}],"outputs":0,"cts":false,"x":720,"y":200,"wires":[]},{"id":"b454b22d.c1415","type":"change","z":"c54a85f8.963e","name":"Card_4_numbers","rules":[{"t":"set","p":"payload","pt":"msg","to":"[{\"col_1\":\"<font color='yellow'><b>8</b></font>\",\"col_2\":\"<font color='yellow'><b>9</b></font>\",\"col_3\":\"<font color='yellow'><b>10</b></font>\",\"col_4\":\"<font color='yellow'><b>11</b></font>\"},{\"col_1\":\"<font color='yellow'><b>12</b></font>\",\"col_2\":\"<font color='yellow'><b>13</b></font>\",\"col_3\":\"<font color='yellow'><b>14</b></font>\",\"col_4\":\"<font color='yellow'><b>15</b></font>\"}]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":200,"wires":[["19458b4e.29a1cd"]]},{"id":"86ee4cdf.bb6158","type":"function","z":"c54a85f8.963e","name":"","func":"if (msg.payload ==\"active\"){\n    node.send( [{payload:1},null] );\n}\nelse if (msg.payload==\"invisible\") {\n    node.send( [null,{payload:1}] );\n}","outputs":2,"noerr":0,"x":310,"y":240,"wires":[["b454b22d.c1415"],["a5a3334b.79f348"]]},{"id":"a5a3334b.79f348","type":"change","z":"c54a85f8.963e","name":"Card_1_blank","rules":[{"t":"set","p":"payload","pt":"msg","to":"[]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":480,"y":260,"wires":[["19458b4e.29a1cd"]]},{"id":"dc9e4802.e40fa","type":"function","z":"c54a85f8.963e","name":"","func":"if (msg.payload ==\"invisible\"){\n    msg.background=\"#333333\";\n    msg.colour=\"#333333\";\n    return msg;\n}\nelse if (msg.payload==\"active\") {\n    msg.background=\"#097479\";\n    msg.colour=\"yellow\";\n    return msg;\n}","outputs":1,"noerr":0,"x":310,"y":320,"wires":[["7dd1d003.a49328","1bd4fd1f.19ac7b"]]},{"id":"1bd4fd1f.19ac7b","type":"ui_button","z":"c54a85f8.963e","name":"","group":"2c7a0b78.a0cdec","order":3,"width":"2","height":"1","passthru":false,"label":"Not here","tooltip":"","color":"{{msg.colour}}","bgcolor":"{{msg.background}}","icon":"","payload":"card_4_button_no","payloadType":"str","topic":"card_4","x":460,"y":380,"wires":[[]]},{"id":"7dd1d003.a49328","type":"ui_button","z":"c54a85f8.963e","name":"","group":"2c7a0b78.a0cdec","order":4,"width":"2","height":"1","passthru":false,"label":"On this card","tooltip":"","color":"{{msg.colour}}","bgcolor":"{{msg.background}}","icon":"","payload":"card_4_button_yes","payloadType":"str","topic":"card_4","x":470,"y":320,"wires":[[]]},{"id":"2c7a0b78.a0cdec","type":"ui_group","z":"","name":"Card 4","tab":"92b49313.50562","order":5,"disp":true,"width":"4","collapse":false},{"id":"347d68a.2262f98","type":"subflow","name":"Card_3","info":"","category":"","in":[{"x":180,"y":220,"wires":[{"id":"8a78d724.c598f8"},{"id":"63acc5fa.a000e4"}]}],"out":[{"x":700,"y":340,"wires":[{"id":"78d02b2f.7ad404","port":0},{"id":"3377b469.0302dc","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"8a78d724.c598f8","type":"function","z":"347d68a.2262f98","name":"","func":"if (msg.payload ==\"active\"){\n    node.send( [{payload:1},null] );\n}\nelse if (msg.payload==\"invisible\") {\n    node.send( [null,{payload:1}] );\n}","outputs":2,"noerr":0,"x":330,"y":220,"wires":[["2b795cfe.8b57bc"],["299afd56.1c9a12"]]},{"id":"1b7e8262.6a4e4e","type":"ui_table","z":"347d68a.2262f98","group":"8f92204.0c2956","name":"Card_3","order":2,"width":"4","height":"2","columns":[{"field":"col_1","title":"","width":"25%","align":"center","formatter":"html","formatterParams":{"target":"_blank"}},{"field":"col_2","title":"","width":"25%","align":"center","formatter":"html","formatterParams":{"target":"_blank"}},{"field":"col_3","title":"","width":"25%","align":"center","formatter":"html","formatterParams":{"target":"_blank"}},{"field":"col_4","title":"","width":"25%","align":"center","formatter":"html","formatterParams":{"target":"_blank"}}],"outputs":0,"cts":false,"x":760,"y":200,"wires":[]},{"id":"2b795cfe.8b57bc","type":"change","z":"347d68a.2262f98","name":"Card_3_numbers","rules":[{"t":"set","p":"payload","pt":"msg","to":"[{\"col_1\":\"<font color='yellow'><b>4</b></font>\",\"col_2\":\"<font color='yellow'><b>5</b></font>\",\"col_3\":\"<font color='yellow'><b>6</b></font>\",\"col_4\":\"<font color='yellow'><b>7</b></font>\"},{\"col_1\":\"<font color='yellow'><b>12</b></font>\",\"col_2\":\"<font color='yellow'><b>13</b></font>\",\"col_3\":\"<font color='yellow'><b>14</b></font>\",\"col_4\":\"<font color='yellow'><b>15</b></font>\"}]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":200,"wires":[["1b7e8262.6a4e4e"]]},{"id":"63acc5fa.a000e4","type":"function","z":"347d68a.2262f98","name":"","func":"if (msg.payload ==\"invisible\"){\n    msg.background=\"#333333\";\n    msg.colour=\"#333333\";\n    return msg;\n}\nelse if (msg.payload==\"active\") {\n    msg.background=\"#097479\";\n    msg.colour=\"yellow\";\n    return msg;\n}","outputs":1,"noerr":0,"x":310,"y":340,"wires":[["78d02b2f.7ad404","3377b469.0302dc"]]},{"id":"78d02b2f.7ad404","type":"ui_button","z":"347d68a.2262f98","name":"","group":"8f92204.0c2956","order":3,"width":"2","height":"1","passthru":false,"label":"Not here","tooltip":"","color":"{{msg.colour}}","bgcolor":"{{msg.background}}","icon":"","payload":"card_3_button_no","payloadType":"str","topic":"card_3","x":500,"y":380,"wires":[[]]},{"id":"3377b469.0302dc","type":"ui_button","z":"347d68a.2262f98","name":"","group":"8f92204.0c2956","order":4,"width":"2","height":"1","passthru":false,"label":"On this card","tooltip":"","color":"{{msg.colour}}","bgcolor":"{{msg.background}}","icon":"","payload":"card_3_button_yes","payloadType":"str","topic":"card_3","x":510,"y":340,"wires":[[]]},{"id":"299afd56.1c9a12","type":"change","z":"347d68a.2262f98","name":"Card_1_blank","rules":[{"t":"set","p":"payload","pt":"msg","to":"[]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":260,"wires":[["1b7e8262.6a4e4e"]]},{"id":"8f92204.0c2956","type":"ui_group","z":"","name":"Card 3","tab":"92b49313.50562","order":4,"disp":true,"width":"4","collapse":false},{"id":"a55a5ef6.8582f8","type":"subflow","name":"Card_2","info":"","category":"","in":[{"x":180,"y":180,"wires":[{"id":"9d95b1d3.03a2d8"},{"id":"b0f1ab78.46d0b"}]}],"out":[{"x":860,"y":260,"wires":[{"id":"36c5af19.668ec","port":0},{"id":"a6cef922.e905e8","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"d4df9bce.a376a8","type":"ui_table","z":"a55a5ef6.8582f8","group":"56afeb62.aff3e4","name":"Card_2","order":2,"width":"4","height":"2","columns":[{"field":"col_1","title":"","width":"25%","align":"center","formatter":"html","formatterParams":{"target":"_blank"}},{"field":"col_2","title":"","width":"25%","align":"center","formatter":"html","formatterParams":{"target":"_blank"}},{"field":"col_3","title":"","width":"25%","align":"center","formatter":"html","formatterParams":{"target":"_blank"}},{"field":"col_4","title":"","width":"25%","align":"center","formatter":"html","formatterParams":{"target":"_blank"}}],"outputs":0,"cts":false,"x":720,"y":180,"wires":[]},{"id":"a6cef922.e905e8","type":"ui_button","z":"a55a5ef6.8582f8","name":"","group":"56afeb62.aff3e4","order":3,"width":"2","height":"1","passthru":false,"label":"Not here","tooltip":"","color":"{{msg.colour}}","bgcolor":"{{msg.background}}","icon":"","payload":"card_2_button_no","payloadType":"str","topic":"card_2","x":720,"y":280,"wires":[[]]},{"id":"36c5af19.668ec","type":"ui_button","z":"a55a5ef6.8582f8","name":"","group":"56afeb62.aff3e4","order":4,"width":"2","height":"1","passthru":false,"label":"On this card","tooltip":"","color":"{{msg.colour}}","bgcolor":"{{msg.background}}","icon":"","payload":"card_2_button_yes","payloadType":"str","topic":"card_2","x":730,"y":240,"wires":[[]]},{"id":"1ed618b0.0ba9d7","type":"change","z":"a55a5ef6.8582f8","name":"Card_2_numbers","rules":[{"t":"set","p":"payload","pt":"msg","to":"[{\"col_1\":\"<font color='yellow'><b>2</b></font>\",\"col_2\":\"<font color='yellow'><b>3</b></font>\",\"col_3\":\"<font color='yellow'><b>6</b></font>\",\"col_4\":\"<font color='yellow'><b>7</b></font>\"},{\"col_1\":\"<font color='yellow'><b>10</b></font>\",\"col_2\":\"<font color='yellow'><b>11</b></font>\",\"col_3\":\"<font color='yellow'><b>14</b></font>\",\"col_4\":\"<font color='yellow'><b>15</b></font>\"}]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":160,"wires":[["d4df9bce.a376a8"]]},{"id":"9d95b1d3.03a2d8","type":"function","z":"a55a5ef6.8582f8","name":"","func":"if (msg.payload ==\"active\"){\n    node.send( [{payload:1},null] );\n}\nelse if (msg.payload==\"invisible\") {\n    node.send( [null,{payload:1}] );\n}","outputs":2,"noerr":0,"x":330,"y":180,"wires":[["1ed618b0.0ba9d7"],["74687d62.f08804"]]},{"id":"74687d62.f08804","type":"change","z":"a55a5ef6.8582f8","name":"Card_1_blank","rules":[{"t":"set","p":"payload","pt":"msg","to":"[]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":200,"wires":[["d4df9bce.a376a8"]]},{"id":"b0f1ab78.46d0b","type":"function","z":"a55a5ef6.8582f8","name":"","func":"if (msg.payload ==\"invisible\"){\n    msg.background=\"#333333\";\n    msg.colour=\"#333333\";\n    return msg;\n}\nelse if (msg.payload==\"active\") {\n    msg.background=\"#097479\";\n    msg.colour=\"yellow\";\n    return msg;\n}","outputs":1,"noerr":0,"x":490,"y":260,"wires":[["36c5af19.668ec","a6cef922.e905e8"]]},{"id":"56afeb62.aff3e4","type":"ui_group","z":"","name":"Card 2","tab":"92b49313.50562","order":3,"disp":true,"width":"4","collapse":false},{"id":"d5134c50.b0844","type":"subflow","name":"Card_1","info":"","category":"","in":[{"x":180,"y":140,"wires":[{"id":"3d76f0e.abc539"},{"id":"141d8274.746df6"}]}],"out":[{"x":880,"y":220,"wires":[{"id":"91025910.75ce18","port":0},{"id":"c5072348.3a4e9","port":0}]}],"env":[],"color":"#DDAA99"},{"id":"66ad408e.82d1a8","type":"ui_table","z":"d5134c50.b0844","group":"6a584447.9a0d44","name":"Card_1","order":1,"width":"4","height":"2","columns":[{"field":"col_1","title":"","width":"25%","align":"center","formatter":"html","formatterParams":{"target":"_blank"}},{"field":"col_2","title":"","width":"25%","align":"center","formatter":"html","formatterParams":{"target":"_blank"}},{"field":"col_3","title":"","width":"25%","align":"center","formatter":"html","formatterParams":{"target":"_blank"}},{"field":"col_4","title":"","width":"25%","align":"center","formatter":"html","formatterParams":{"target":"_blank"}}],"outputs":0,"cts":false,"x":720,"y":140,"wires":[]},{"id":"c5072348.3a4e9","type":"ui_button","z":"d5134c50.b0844","name":"","group":"6a584447.9a0d44","order":2,"width":"2","height":"1","passthru":false,"label":"Not here","tooltip":"","color":"{{msg.colour}}","bgcolor":"{{msg.background}}","icon":"","payload":"card_1_button_no","payloadType":"str","topic":"card_1","x":720,"y":240,"wires":[[]]},{"id":"91025910.75ce18","type":"ui_button","z":"d5134c50.b0844","name":"","group":"6a584447.9a0d44","order":3,"width":"2","height":"1","passthru":false,"label":"On this card","tooltip":"","color":"{{msg.colour}}","bgcolor":"{{msg.background}}","icon":"","payload":"card_1_button_yes","payloadType":"str","topic":"card_1","x":730,"y":200,"wires":[[]]},{"id":"6964aa68.081f44","type":"change","z":"d5134c50.b0844","name":"Card_1_numbers","rules":[{"t":"set","p":"payload","pt":"msg","to":"[{\"col_1\":\"<font color='yellow'><b>1</b></font>\",\"col_2\":\"<font color='yellow'><b>3</b></font>\",\"col_3\":\"<font color='yellow'><b>5</b></font>\",\"col_4\":\"<font color='yellow'><b>7</b></font>\"},{\"col_1\":\"<font color='yellow'><b>9</b></font>\",\"col_2\":\"<font color='yellow'><b>11</b></font>\",\"col_3\":\"<font color='yellow'><b>13</b></font>\",\"col_4\":\"<font color='yellow'><b>15</b></font>\"}]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":530,"y":120,"wires":[["66ad408e.82d1a8"]]},{"id":"60762f1e.700608","type":"change","z":"d5134c50.b0844","name":"Card_1_blank","rules":[{"t":"set","p":"payload","pt":"msg","to":"[]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":520,"y":160,"wires":[["66ad408e.82d1a8"]]},{"id":"3d76f0e.abc539","type":"function","z":"d5134c50.b0844","name":"","func":"if (msg.payload ==\"active\"){\n    node.send( [{payload:1},null] );\n}\nelse if (msg.payload==\"invisible\") {\n    node.send( [null,{payload:1}] );\n}","outputs":2,"noerr":0,"x":330,"y":140,"wires":[["6964aa68.081f44"],["60762f1e.700608"]]},{"id":"141d8274.746df6","type":"function","z":"d5134c50.b0844","name":"","func":"if (msg.payload ==\"invisible\"){\n    msg.background=\"#333333\";\n    msg.colour=\"#333333\";\n    return msg;\n}\nelse if (msg.payload==\"active\") {\n    msg.background=\"#097479\";\n    msg.colour=\"yellow\";\n    return msg;\n}","outputs":1,"noerr":0,"x":490,"y":220,"wires":[["91025910.75ce18","c5072348.3a4e9"]]},{"id":"6a584447.9a0d44","type":"ui_group","z":"","name":"Card 1","tab":"92b49313.50562","order":2,"disp":true,"width":"4","collapse":false},{"id":"92b49313.50562","type":"ui_tab","z":"","name":"Matt's Mathematical Magic Machine","icon":"track_changes","order":1,"disabled":false,"hidden":false},{"id":"64f9903d.6f24f","type":"ui_text","z":"43e22666.124e78","group":"401a6c07.03e684","order":1,"width":"3","height":"2","name":"","label":"Think of a number between 1 and 15. <br>Click which card it appears on.","format":"{{msg.payload}}","layout":"col-center","x":340,"y":60,"wires":[]},{"id":"81ce0aa1.0341c","type":"ui_button","z":"43e22666.124e78","name":"","group":"401a6c07.03e684","order":2,"width":"3","height":"1","passthru":false,"label":"Click to start","tooltip":"","color":"","bgcolor":"","icon":"","payload":"start_button","payloadType":"str","topic":"","x":130,"y":300,"wires":[["1a7702dd.acb95d"]]},{"id":"481a6aad.387bcc","type":"ui_text","z":"43e22666.124e78","group":"f4850f12.6d7a","order":0,"width":"2","height":"3","name":"Answer","label":"{{msg.payload}}","format":"","layout":"col-center","x":820,"y":420,"wires":[]},{"id":"1a7702dd.acb95d","type":"function","z":"43e22666.124e78","name":"m4_fsm","func":"var fsm_state = flow.get(\"fsm_m4_state_reg\") || \"instruction\";\n\nvar result = flow.get(\"result\") || 0;\n\nif (msg.payload == \"reset\")\n{\n    flow.set(\"result\",0);\n    fsm_state= \"instruction\";\n    node.status({text:\"State register = instruction\"});\n    node.send( [{payload:\"invisible\"},{payload: \"invisible\"},{payload: \"invisible\"},{payload: \"invisible\"},{payload: \"invisible\"}] );\n}\n\nswitch (fsm_state)\n   {\n        case \"instruction\":\n        if (msg.payload == \"start_button\") {\n            flow.set(\"result\",0);\n            fsm_state = \"card_1\";\n            node.status({text:\"State register = card_1\"});\n            node.send( [{payload:\"active\"},{payload: \"invisible\"},{payload: \"invisible\"},{payload: \"invisible\"},{payload: \"invisible\"}] );\n        }\n        break;\n       \n        case \"card_1\":\n        if (msg.payload == \"card_1_button_yes\")\n        {\n            result = 1;\n            fsm_state = \"card_2\";\n            node.status({text:\"State register = card_2\"});\n            node.send( [{payload:\"invisible\"},{payload: \"active\"},{payload: \"invisible\"},{payload: \"invisible\"},{payload: \"invisible\"}] );\n        }\n        else if (msg.payload == \"card_1_button_no\") {\n            result = 0;\n            fsm_state = \"card_2\";\n            node.status({text:\"State register = card_2\"});\n            node.send( [{payload:\"invisible\"},{payload: \"active\"},{payload: \"invisible\"},{payload: \"invisible\"},{payload: \"invisible\"}] );\n        }\n        break;\n       \n        case \"card_2\":\n        if (msg.payload == \"card_2_button_yes\")\n        {   \n            result = result + 2;\n            fsm_state = \"card_3\";\n            node.status({text:\"State register = card_3\"});\n            node.send( [{payload:\"invisible\"},{payload: \"invisible\"},{payload: \"active\"},{payload: \"invisible\"},{payload: \"invisible\"}] );\n        }\n        else if (msg.payload == \"card_2_button_no\")\n        {\n            fsm_state = \"card_3\";\n            node.status({text:\"State register = card_3\"});\n            node.send( [{payload:\"invisible\"},{payload: \"invisible\"},{payload: \"active\"},{payload: \"invisible\"},{payload: \"invisible\"}] );\n        }\n        break;\n        \n        case \"card_3\":\n        if (msg.payload == \"card_3_button_yes\")\n        {   \n            result = result + 4;\n            fsm_state = \"card_4\";\n            node.status({text:\"State register = card_4\"});\n            node.send( [{payload:\"invisible\"},{payload: \"invisible\"},{payload: \"invisible\"},{payload: \"active\"},{payload: \"invisible\"}] );\n        }\n        else if (msg.payload == \"card_3_button_no\")\n        {\n            fsm_state = \"card_4\";\n            node.status({text:\"State register = card_4\"});\n            node.send( [{payload:\"invisible\"},{payload: \"invisible\"},{payload: \"invisible\"},{payload: \"active\"},{payload: \"invisible\"}] );\n        }\n        break;\n        \n        case \"card_4\":\n        if (msg.payload == \"card_4_button_yes\")\n        {   \n            result = result + 8;\n            fsm_state = \"answer\";\n            node.status({text:\"State register = answer\"+result});\n            node.send( [{payload:\"invisible\"},{payload: \"invisible\"},{payload: \"invisible\"},{payload: \"invisible\"},{payload: \"active\"}] );\n        }\n        else if (msg.payload == \"card_4_button_no\")\n        {\n            fsm_state = \"answer\";\n            node.status({text:\"State register = answer\"+result});\n            node.send( [{payload:\"invisible\"},{payload: \"invisible\"},{payload: \"invisible\"},{payload: \"invisible\"},{payload: \"active\"}] );\n        }\n        break;\n        \n        case \"answer\":\n        if (msg.payload == \"start_button\")\n        {   \n            result = 0;\n            fsm_state = \"card_1\";\n            node.status({text:\"State register = card_1\"});\n            node.send( [{payload:\"active\"},{payload: \"invisible\"},{payload: \"invisible\"},{payload: \"invisible\"},{payload: \"invisible\"}] );\n        }\n        break;\n   }\n\nflow.set(\"fsm_m4_state_reg\", fsm_state);\nflow.set(\"result\",result);\n\n","outputs":5,"noerr":0,"x":440,"y":300,"wires":[["95c47a96.578a4"],["7f93e788.59c9e"],["ad593190.e35778"],["449f1e17.b161e8"],["2671dc3d.c14e1c"]]},{"id":"16c0fdd7.2ad03a","type":"inject","z":"43e22666.124e78","name":"","topic":"","payload":"reset","payloadType":"str","repeat":"","crontab":"","once":true,"onceDelay":"0.1","x":130,"y":160,"wires":[["ae4f31fe.414028"]]},{"id":"f56fbc75.083538","type":"link in","z":"43e22666.124e78","name":"fsm_in","links":["93849dac.5874f"],"x":355,"y":220,"wires":[["1a7702dd.acb95d"]]},{"id":"93849dac.5874f","type":"link out","z":"43e22666.124e78","name":"buttons","links":["f56fbc75.083538"],"x":795,"y":240,"wires":[]},{"id":"95c47a96.578a4","type":"subflow:d5134c50.b0844","z":"43e22666.124e78","name":"","x":650,"y":240,"wires":[["93849dac.5874f"]]},{"id":"7f93e788.59c9e","type":"subflow:a55a5ef6.8582f8","z":"43e22666.124e78","name":"","x":650,"y":280,"wires":[["93849dac.5874f"]]},{"id":"ad593190.e35778","type":"subflow:347d68a.2262f98","z":"43e22666.124e78","name":"","x":650,"y":320,"wires":[["93849dac.5874f"]]},{"id":"449f1e17.b161e8","type":"subflow:c54a85f8.963e","z":"43e22666.124e78","name":"","x":650,"y":360,"wires":[["93849dac.5874f"]]},{"id":"ae4f31fe.414028","type":"function","z":"43e22666.124e78","name":"","func":"flow.set('result',0);\nflow.set(\"fsm_m4_state_register\",\"instruction\");\nmsg.payload=\"reset\";\nreturn msg;","outputs":1,"noerr":0,"x":270,"y":160,"wires":[["e907457f.faa208"]]},{"id":"2671dc3d.c14e1c","type":"function","z":"43e22666.124e78","name":"","func":"if (msg.payload == \"active\") {\n    var result = flow.get('result') || 0;\n    msg.payload = \"The answer is: \"+result;\n    return msg;\n}\nelse if (msg.payload == \"invisible\") {\n    msg.payload = \"\";\n    return msg;\n}\n","outputs":1,"noerr":0,"x":650,"y":420,"wires":[["481a6aad.387bcc"]]},{"id":"e907457f.faa208","type":"delay","z":"43e22666.124e78","name":"","pauseType":"delay","timeout":"1","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":240,"y":220,"wires":[["1a7702dd.acb95d"]]},{"id":"401a6c07.03e684","type":"ui_group","z":"","name":"Instruction","tab":"92b49313.50562","order":1,"disp":true,"width":"3","collapse":false},{"id":"f4850f12.6d7a","type":"ui_group","z":"","name":"Answer","tab":"92b49313.50562","order":6,"disp":true,"width":"2","collapse":false}]

Here's a screenshot of the NR flow.


Happy New Year

6 Likes

Oh - someone has been playing with their Christmas crackers I see :rofl: