stack_light

Last Modified: 2024-04-09 08:26:06

Created On: 2023-12-10 15:58:46

Owned By: evezor

Created By: anfro

Contributors: anfro, evezor

Public: True


Executable


        
# --------------------------------------
#   stack_light
#   65f69726abd8badecanv
__canvas_id__ = '65f69726abd8bade'
# __version__ = TODO: add this
# --------------------------------------
from floe import FP

from NeoPixel import NeoPixel
from ESP32Core import ESP32Core
from HbtLed import HbtLed
from CANBus import CANBus
from DigitalInput import DigitalInput
from DigitalOutput import DigitalOutput
def setup(iris):
  CANBus(name='CANBus', pid=6545, rx=16, tx=4, adr=25, bus=0, baud=250000, rx_queue=25, terminal_debug=False, debug=False, active=True, bcast=False, iris=iris)
  DigitalInput(name='buzz_button', pid=56103, pin=22, pullup='pullup', debounce=200, invert=True, initial_value=False, datatype="bool", debug=False, active=True, bcast=True, iris=iris)
  DigitalInput(name='function_button', pid=2276, pin=36, pullup='None', debounce=200, invert=True, initial_value=False, datatype="bool", debug=False, active=True, bcast=True, iris=iris)
  DigitalInput(name='minus', pid=25546, pin=23, pullup='pullup', debounce=200, invert=True, initial_value=False, datatype="bool", debug=False, active=True, bcast=True, iris=iris)
  DigitalInput(name='off', pid=11853, pin=39, pullup='None', debounce=200, invert=True, initial_value=False, datatype="bool", debug=False, active=True, bcast=True, iris=iris)
  DigitalInput(name='plus', pid=8138, pin=33, pullup='pullup', debounce=200, invert=True, initial_value=False, datatype="bool", debug=False, active=True, bcast=True, iris=iris)
  DigitalOutput(name='blue', pid=34605, pin=26, invert=False, initial_value=False, datatype="bool", debug=False, active=True, bcast=False, iris=iris)
  DigitalOutput(name='buzz', pid=59149, pin=32, invert=False, initial_value=False, datatype="bool", debug=False, active=True, bcast=False, iris=iris)
  DigitalOutput(name='can_slp', pid=11397, pin=2, invert=False, initial_value=False, datatype="bool", debug=False, active=True, bcast=False, iris=iris)
  DigitalOutput(name='green', pid=12777, pin=27, invert=False, initial_value=False, datatype="bool", debug=False, active=True, bcast=False, iris=iris)
  DigitalOutput(name='red', pid=38681, pin=12, invert=False, initial_value=False, datatype="bool", debug=False, active=True, bcast=False, iris=iris)
  DigitalOutput(name='white', pid=30304, pin=25, invert=False, initial_value=False, datatype="bool", debug=False, active=True, bcast=False, iris=iris)
  DigitalOutput(name='yellow', pid=29843, pin=14, invert=False, initial_value=False, datatype="bool", debug=False, active=True, bcast=False, iris=iris)
  ESP32Core(name='ESP32Core', pid=6074, wifi=False, hbt_led=FP(50487), neo_status=FP(47403), function_button=FP(2276), bus=FP(6545), zorg=None, webserver=None, debug=False, active=True, bcast=False, iris=iris)
  HbtLed(name='HbtLed', pid=50487, pin=5, delay=1000, datatype="int", debug=False, active=True, bcast=False, iris=iris)
  NeoPixel(name='neo_status', pid=47403, pin=17, number_of_pixels=1, animation=0, delay=200, animations=None, datatype="rgb", debug=False, active=True, bcast=False, iris=iris)
  iris.add_hots({})


      

Canvas View:


Dependencies:


["NeoPixel", "ESP32Core", "HbtLed", "Parameter", "FileReceiver", "CANBus", "DigitalInput", "DigitalOutput"]
    

Uppie code:

this code is used as the constructor in this canvas is dropped on a canvas above

{
  "canvas_id": "65f69726abd8badecanv",
  "zorg": false,
  "busses": {
    "CANBus": "25"
  },
  "ports": [
    {
      "name": "minus",
      "reference_id": "923a0b8c-ad84-aa34-bc52-6ad0cb5b15bf",
      "pid": 25546,
      "type": "output",
      "datatype": "bool",
      "parameter_type": "DigitalInput"
    },
    {
      "name": "buzz_button",
      "reference_id": "615d4e33-f4cd-303e-c93e-b9d8103b10bd",
      "pid": 56103,
      "type": "output",
      "datatype": "bool",
      "parameter_type": "DigitalInput"
    },
    {
      "name": "plus",
      "reference_id": "b20d2b51-7126-2aad-ef2c-494f75da0129",
      "pid": 8138,
      "type": "output",
      "datatype": "bool",
      "parameter_type": "DigitalInput"
    },
    {
      "name": "off",
      "reference_id": "4dbed4bf-74ef-b403-3337-9324b59f4017",
      "pid": 11853,
      "type": "output",
      "datatype": "bool",
      "parameter_type": "DigitalInput"
    },
    {
      "name": "buzz",
      "reference_id": "41bda20c-33b7-7529-949d-9e22fe925aa2",
      "pid": 59149,
      "type": "input",
      "datatype": "bool",
      "parameter_type": "DigitalOutput"
    },
    {
      "name": "white",
      "reference_id": "4c80bae9-2f93-4a48-89ce-ed759f39df02",
      "pid": 30304,
      "type": "input",
      "datatype": "bool",
      "parameter_type": "DigitalOutput"
    },
    {
      "name": "blue",
      "reference_id": "91fa29cb-658e-beb8-b73f-ae7402d8f157",
      "pid": 34605,
      "type": "input",
      "datatype": "bool",
      "parameter_type": "DigitalOutput"
    },
    {
      "name": "green",
      "reference_id": "44b70a06-c422-5e42-9022-a67515fa3b34",
      "pid": 12777,
      "type": "input",
      "datatype": "bool",
      "parameter_type": "DigitalOutput"
    },
    {
      "name": "yellow",
      "reference_id": "ccfd21f4-37a0-cab9-57bb-29b2b20448ea",
      "pid": 29843,
      "type": "input",
      "datatype": "bool",
      "parameter_type": "DigitalOutput"
    },
    {
      "name": "red",
      "reference_id": "9ca9f72a-b19e-3ed2-7bc4-ccec77c0939c",
      "pid": 38681,
      "type": "input",
      "datatype": "bool",
      "parameter_type": "DigitalOutput"
    }
  ]
}
    

Uppie subs:


{}
    

Canvas code:


[
  {
    "type": "CanvasID",
    "id": "65f69726abd8badecanv",
    "x": 26.786299999999983,
    "y": 24.64382824707031,
    "selectable": false,
    "draggable": true,
    "text": "",
    "canvas_type": "core"
  },
  {
    "type": "Parameter",
    "name": "ESP32Core",
    "id": "9e65d461-88ea-d923-2508-c70738045031",
    "ParameterType": "ESP32Core",
    "datatype": null,
    "pid": "6074",
    "x": 2417.9577,
    "y": 272.2713,
    "width": 95,
    "height": 164,
    "constants": {
      "wifi": false
    },
    "up_data": {
      "can_go_up": false,
      "up": false
    },
    "debug": false,
    "active": true,
    "broadcast": false
  },
  {
    "type": "Parameter",
    "name": "function_button",
    "id": "755f08c5-a527-574e-94c4-ec22787d7c83",
    "ParameterType": "DigitalInput",
    "datatype": "bool",
    "pid": 2276,
    "x": 2130.9577,
    "y": 257.61289999999997,
    "width": 95,
    "height": 51,
    "constants": {
      "pin": "36",
      "pullup": "None",
      "debounce": 200
    },
    "up_data": {
      "can_go_up": true,
      "type": "output",
      "order": 999,
      "up": false
    },
    "debug": false,
    "active": true,
    "broadcast": true
  },
  {
    "type": "Parameter",
    "name": "neo_status",
    "id": "c02b1b9a-83a0-4dc8-6c78-b233f6794e97",
    "ParameterType": "NeoPixel",
    "datatype": "rgb",
    "pid": 47403,
    "x": 2107.9577,
    "y": 190.61289999999997,
    "width": 73,
    "height": 40,
    "constants": {
      "pin": "17",
      "number_of_pixels": 1
    },
    "up_data": {
      "can_go_up": true,
      "type": "input",
      "order": 999,
      "up": false
    },
    "debug": false,
    "active": true,
    "broadcast": false
  },
  {
    "type": "Parameter",
    "name": "CANBus",
    "id": "094dfcb9-7772-56e1-d37f-10f852b3fd3e",
    "ParameterType": "CANBus",
    "datatype": null,
    "pid": 6545,
    "x": 2159.9577,
    "y": 360.51210000000003,
    "width": 79,
    "height": 43,
    "constants": {
      "rx": "16",
      "tx": "4",
      "adr": "25",
      "bus": "0",
      "baud": 250000,
      "rx_queue": 25
    },
    "up_data": {
      "can_go_up": false,
      "up": false
    },
    "debug": false,
    "active": true,
    "broadcast": false
  },
  {
    "type": "NotePad",
    "id": "d62904e5-41be-2090-31f2-f67f776f676e",
    "x": 2367.4577,
    "y": 187.3641,
    "width": 218,
    "height": 25,
    "ports": [],
    "text": "Core Components"
  },
  {
    "type": "Parameter",
    "name": "HbtLed",
    "id": "7906fc95-7e4b-9ed1-dab9-abd07d17d0c2",
    "ParameterType": "HbtLed",
    "datatype": "int",
    "pid": 50487,
    "x": 2096.6057,
    "y": 106.33331298828125,
    "width": 74,
    "height": 40,
    "constants": {
      "pin": "5"
    },
    "up_data": {
      "can_go_up": false,
      "up": false
    },
    "debug": false,
    "active": true,
    "broadcast": false
  },
  {
    "type": "Parameter",
    "name": "can_slp",
    "id": "3a429d50-899d-cb28-be24-195f5663a9ee",
    "ParameterType": "DigitalOutput",
    "datatype": "bool",
    "pid": 11397,
    "x": 2417.9577,
    "y": 90.36410000000001,
    "width": 95,
    "height": 50,
    "constants": {
      "pin": "2"
    },
    "up_data": {
      "can_go_up": true,
      "type": "input",
      "order": 999,
      "up": false
    },
    "debug": false,
    "active": true,
    "broadcast": false
  },
  {
    "type": "Parameter",
    "name": "minus",
    "id": "923a0b8c-ad84-aa34-bc52-6ad0cb5b15bf",
    "ParameterType": "DigitalInput",
    "datatype": "bool",
    "pid": 25546,
    "x": 385.5659874298098,
    "y": 569.4843129882812,
    "width": 90,
    "height": 45,
    "constants": {
      "pin": "23",
      "pullup": "pullup",
      "debounce": 200
    },
    "up_data": {
      "can_go_up": true,
      "type": "output",
      "order": 999,
      "up": true
    },
    "debug": false,
    "active": true,
    "broadcast": true
  },
  {
    "type": "Parameter",
    "name": "buzz_button",
    "id": "615d4e33-f4cd-303e-c93e-b9d8103b10bd",
    "ParameterType": "DigitalInput",
    "datatype": "bool",
    "pid": 56103,
    "x": 385.5659874298098,
    "y": 455.66,
    "width": 90,
    "height": 45,
    "constants": {
      "pin": "22",
      "pullup": "pullup",
      "debounce": 200
    },
    "up_data": {
      "can_go_up": true,
      "type": "output",
      "order": 999,
      "up": true
    },
    "debug": false,
    "active": true,
    "broadcast": true
  },
  {
    "type": "Parameter",
    "name": "plus",
    "id": "b20d2b51-7126-2aad-ef2c-494f75da0129",
    "ParameterType": "DigitalInput",
    "datatype": "bool",
    "pid": 8138,
    "x": 385.5659874298098,
    "y": 673.9975,
    "width": 90,
    "height": 45,
    "constants": {
      "pin": "33",
      "pullup": "pullup",
      "debounce": "200"
    },
    "up_data": {
      "can_go_up": true,
      "type": "output",
      "order": 999,
      "up": true
    },
    "debug": false,
    "active": true,
    "broadcast": true
  },
  {
    "type": "Parameter",
    "name": "off",
    "id": "4dbed4bf-74ef-b403-3337-9324b59f4017",
    "ParameterType": "DigitalInput",
    "datatype": "bool",
    "pid": 11853,
    "x": 385.5659874298098,
    "y": 779.9308129882813,
    "width": 90,
    "height": 45,
    "constants": {
      "pin": "39",
      "pullup": "None",
      "debounce": 200
    },
    "up_data": {
      "can_go_up": true,
      "type": "output",
      "order": 999,
      "up": true
    },
    "debug": false,
    "active": true,
    "broadcast": true
  },
  {
    "type": "NotePad",
    "id": "de20fa9a-fac7-21f6-bc8b-f88d65e31781",
    "x": 398.1219546051027,
    "y": 366.1440856643677,
    "width": 218,
    "height": 25,
    "ports": [],
    "text": "Buttons"
  },
  {
    "type": "Parameter",
    "name": "buzz",
    "id": "41bda20c-33b7-7529-949d-9e22fe925aa2",
    "ParameterType": "DigitalOutput",
    "datatype": "bool",
    "pid": 59149,
    "x": 1255.9845,
    "y": 219.06632824707026,
    "width": 95,
    "height": 50,
    "constants": {
      "pin": "32"
    },
    "up_data": {
      "can_go_up": true,
      "type": "input",
      "order": 999,
      "up": true
    },
    "debug": false,
    "active": true,
    "broadcast": false
  },
  {
    "type": "Parameter",
    "name": "white",
    "id": "4c80bae9-2f93-4a48-89ce-ed759f39df02",
    "ParameterType": "DigitalOutput",
    "datatype": "bool",
    "pid": 30304,
    "x": 1255.9845,
    "y": 344.8833129882813,
    "width": 95,
    "height": 50,
    "constants": {
      "pin": "25"
    },
    "up_data": {
      "can_go_up": true,
      "type": "input",
      "order": 999,
      "up": true
    },
    "debug": false,
    "active": true,
    "broadcast": false
  },
  {
    "type": "Parameter",
    "name": "blue",
    "id": "91fa29cb-658e-beb8-b73f-ae7402d8f157",
    "ParameterType": "DigitalOutput",
    "datatype": "bool",
    "pid": 34605,
    "x": 1250.6495,
    "y": 474.1625,
    "width": 95,
    "height": 50,
    "constants": {
      "pin": "26"
    },
    "up_data": {
      "can_go_up": true,
      "type": "input",
      "order": 999,
      "up": true
    },
    "debug": false,
    "active": true,
    "broadcast": false
  },
  {
    "type": "Parameter",
    "name": "green",
    "id": "44b70a06-c422-5e42-9022-a67515fa3b34",
    "ParameterType": "DigitalOutput",
    "datatype": "bool",
    "pid": 12777,
    "x": 1250.6495,
    "y": 605.6625,
    "width": 95,
    "height": 50,
    "constants": {
      "pin": "27"
    },
    "up_data": {
      "can_go_up": true,
      "type": "input",
      "order": 999,
      "up": true
    },
    "debug": false,
    "active": true,
    "broadcast": false
  },
  {
    "type": "Parameter",
    "name": "yellow",
    "id": "ccfd21f4-37a0-cab9-57bb-29b2b20448ea",
    "ParameterType": "DigitalOutput",
    "datatype": "bool",
    "pid": 29843,
    "x": 1255.9845,
    "y": 737.2378129882813,
    "width": 95,
    "height": 50,
    "constants": {
      "pin": "14"
    },
    "up_data": {
      "can_go_up": true,
      "type": "input",
      "order": 999,
      "up": true
    },
    "debug": false,
    "active": true,
    "broadcast": false
  },
  {
    "type": "Parameter",
    "name": "red",
    "id": "9ca9f72a-b19e-3ed2-7bc4-ccec77c0939c",
    "ParameterType": "DigitalOutput",
    "datatype": "bool",
    "pid": 38681,
    "x": 1250.6495,
    "y": 882.2223129882814,
    "width": 95,
    "height": 50,
    "constants": {
      "pin": "12"
    },
    "up_data": {
      "can_go_up": true,
      "type": "input",
      "order": 999,
      "up": true
    },
    "debug": false,
    "active": true,
    "broadcast": false
  },
  {
    "type": "NotePad",
    "id": "c3cbd67b-a691-e3c4-eaf6-15c3d8277453",
    "x": 1266.6850000000002,
    "y": 127.03937132873531,
    "width": 189.624267578125,
    "height": 25,
    "ports": [],
    "text": "Lights"
  },
  {
    "type": "HoverConnection",
    "id": "825c8068-d774-af1f-4d9a-32a158ca9744",
    "bus": "local",
    "vertex": [
      {
        "x": 2170.6057,
        "y": 126.33331298828125
      },
      {
        "x": 2342.9577,
        "y": 126.33331298828125
      },
      {
        "x": 2342.9577,
        "y": 295.69987142857144
      },
      {
        "x": 2417.9577,
        "y": 295.69987142857144
      }
    ],
    "source": {
      "node": "7906fc95-7e4b-9ed1-dab9-abd07d17d0c2",
      "port": "self"
    },
    "target": {
      "node": "9e65d461-88ea-d923-2508-c70738045031",
      "port": "hbt_led"
    }
  },
  {
    "type": "HoverConnection",
    "id": "65be2b61-ca8d-e5e3-81ff-af3dd48ce324",
    "bus": "local",
    "vertex": [
      {
        "x": 2225.9577,
        "y": 274.61289999999997
      },
      {
        "x": 2305.9577,
        "y": 274.61289999999997
      },
      {
        "x": 2305.9577,
        "y": 342.5570142857143
      },
      {
        "x": 2417.9577,
        "y": 342.5570142857143
      }
    ],
    "source": {
      "node": "755f08c5-a527-574e-94c4-ec22787d7c83",
      "port": "event"
    },
    "target": {
      "node": "9e65d461-88ea-d923-2508-c70738045031",
      "port": "function_button"
    }
  },
  {
    "type": "HoverConnection",
    "id": "2b775f03-5aa3-3fe4-bb75-ac541beaf49c",
    "bus": "local",
    "vertex": [
      {
        "x": 2180.9577,
        "y": 217.27956666666662
      },
      {
        "x": 2324.9577,
        "y": 217.27956666666662
      },
      {
        "x": 2324.9577,
        "y": 319.12844285714283
      },
      {
        "x": 2417.9577,
        "y": 319.12844285714283
      }
    ],
    "source": {
      "node": "c02b1b9a-83a0-4dc8-6c78-b233f6794e97",
      "port": "self"
    },
    "target": {
      "node": "9e65d461-88ea-d923-2508-c70738045031",
      "port": "neo_status"
    }
  },
  {
    "type": "HoverConnection",
    "id": "3f658083-625d-614a-c703-d4270120db8f",
    "bus": "local",
    "vertex": [
      {
        "x": 2238.9577,
        "y": 382.01210000000003
      },
      {
        "x": 2308.4577,
        "y": 382.01210000000003
      },
      {
        "x": 2308.4577,
        "y": 365.9855857142857
      },
      {
        "x": 2417.9577,
        "y": 365.9855857142857
      }
    ],
    "source": {
      "node": "094dfcb9-7772-56e1-d37f-10f852b3fd3e",
      "port": "self"
    },
    "target": {
      "node": "9e65d461-88ea-d923-2508-c70738045031",
      "port": "bus"
    }
  }
]