zorg_dmx_rtc_board

Last Modified: 2024-03-17 07:09:57

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

Owned By: evezor

Created By: anfro

Contributors: anfro, evezor

Public: True


Executable


        
# --------------------------------------
#   zorg_dmx_rtc_board
#   65f69745caf91c09canv
__canvas_id__ = '65f69745caf91c09'
# __version__ = TODO: add this
# --------------------------------------
from floe import FP

from NeoPixel import NeoPixel
from I2C import I2C
from DigitalOutput import DigitalOutput
from DigitalInput import DigitalInput
from WebsocketServer import WebsocketServer
from HbtLed import HbtLed
from Pcf8563 import Pcf8563
from Zorg import Zorg
from ESP32Core import ESP32Core
from CANBus import CANBus
def setup(iris):
  CANBus(name="CANBus", pid=6545, rx=2, tx=4, adr=11, bus=0, baud=250000, rx_queue=25, terminal_debug=False, debug=False, active=True, bcast=False, iris=iris)
  DigitalInput(name="down", pid=56289, pin=39, pullup='None', 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=21343, pin=21, pullup='pullup', debounce=200, invert=True, initial_value=False, datatype="bool", debug=False, active=True, bcast=True, iris=iris)
  DigitalInput(name="plus", pid=30366, pin=14, pullup='pullup', debounce=200, invert=True, initial_value=False, datatype="bool", debug=False, active=True, bcast=True, iris=iris)
  DigitalInput(name="up", pid=46941, pin=34, pullup='None', debounce=200, invert=True, initial_value=False, datatype="bool", debug=False, active=True, bcast=True, iris=iris)
  DigitalOutput(name="can_slp", pid=11397, pin=13, invert=False, initial_value=False, datatype="bool", debug=False, active=True, bcast=False, iris=iris)
  DigitalOutput(name="relay", pid=34645, pin=22, invert=False, initial_value=False, datatype="bool", debug=False, active=True, bcast=False, iris=iris)
  ESP32Core(name="ESP32Core", pid=6074, wifi=True, hbt_led=FP(50487), neo_status=FP(47403), function_button=FP(2276), bus=FP(6545), zorg=FP(59291), webserver=FP(53339), debug=False, active=True, bcast=False, iris=iris)
  HbtLed(name="HbtLed", pid=50487, pin=15, delay=1000, datatype="int", debug=False, active=True, bcast=False, iris=iris)
  I2C(name="I2C", pid=45892, sda=26, scl=27, bus=0, baud=400000, debug=False, active=True, bcast=False, iris=iris)
  NeoPixel(name="neo_status", pid=47403, pin=12, number_of_pixels=1, animation=0, delay=200, animations=None, datatype="rgb", debug=False, active=True, bcast=False, iris=iris)
  Pcf8563(name="rtc", pid=23367, i2c=FP(45892), datatype="bool", debug=False, active=True, bcast=True, iris=iris)
  WebsocketServer(name="WebsocketServer", pid=53339, datatype="null", debug=False, active=True, bcast=False, iris=iris)
  Zorg(name="Zorg", pid=59291, debug=False, active=True, bcast=False, iris=iris)
  iris.add_hots({})


      

Canvas View:


Dependencies:


["I2C", "NeoPixel", "DigitalOutput", "FileSender", "Pcf8563", "DigitalInput", "FileReceiver", "WebsocketServer", "HbtLed", "Parameter", "Zorg", "ESP32Core", "CANBus"]
    

Uppie code:

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

{
  "canvas_id": "65daa9fc02fc80e3canv",
  "zorg": true,
  "busses": {
    "CANBus": "11"
  },
  "ports": [
    {
      "name": "relay",
      "reference_id": "96906580-3660-5cf8-b9b3-166f6e6ea5ca",
      "pid": 34645,
      "type": "input",
      "datatype": "bool",
      "parameter_type": "DigitalOutput"
    },
    {
      "name": "up",
      "reference_id": "61ca9c2b-dc34-5d52-aba6-54c6026d6906",
      "pid": 46941,
      "type": "output",
      "datatype": "bool",
      "parameter_type": "DigitalInput"
    },
    {
      "name": "down",
      "reference_id": "e4033fad-560f-b7b4-1a41-b6f9dbc49d0c",
      "pid": 56289,
      "type": "output",
      "datatype": "bool",
      "parameter_type": "DigitalInput"
    },
    {
      "name": "plus",
      "reference_id": "ec522129-32b4-e75a-7347-aac5540b782b",
      "pid": 30366,
      "type": "output",
      "datatype": "bool",
      "parameter_type": "DigitalInput"
    },
    {
      "name": "minus",
      "reference_id": "c2879c91-4f72-8aa8-516a-03a00cdcde7d",
      "pid": 21343,
      "type": "output",
      "datatype": "bool",
      "parameter_type": "DigitalInput"
    }
  ]
}
    

Uppie subs:


{}
    

Canvas code:


[
  {
    "type": "CanvasID",
    "id": "65f69745caf91c09canv",
    "x": 26.786299999999983,
    "y": 24.64382824707031,
    "selectable": false,
    "draggable": true,
    "text": "CanvasID: 65f69745caf91c09canv",
    "canvas_type": "core"
  },
  {
    "type": "Parameter",
    "name": "ESP32Core",
    "id": "9e65d461-88ea-d923-2508-c70738045031",
    "ParameterType": "ESP32Core",
    "datatype": null,
    "pid": "6074",
    "x": 1754.7108518622163,
    "y": 233.73128044604772,
    "width": 95,
    "height": 164,
    "constants": {
      "wifi": true
    },
    "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": 1467.7108518622163,
    "y": 219.0728804460477,
    "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": 1444.7108518622163,
    "y": 152.0728804460477,
    "width": 73,
    "height": 40,
    "constants": {
      "pin": "12",
      "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": 1496.7108518622163,
    "y": 321.97208044604776,
    "width": 79,
    "height": 43,
    "constants": {
      "rx": "2",
      "tx": "4",
      "adr": "11",
      "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": 1704.2108518622163,
    "y": 148.82408044604773,
    "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": 1433.3588518622164,
    "y": 67.79329343432896,
    "width": 74,
    "height": 40,
    "constants": {
      "pin": "15"
    },
    "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": 1754.7108518622163,
    "y": 51.82408044604772,
    "width": 95,
    "height": 50,
    "constants": {
      "pin": "13"
    },
    "up_data": {
      "can_go_up": true,
      "type": "input",
      "order": 999,
      "up": false
    },
    "debug": false,
    "active": true,
    "broadcast": false
  },
  {
    "type": "Parameter",
    "name": "relay",
    "id": "96906580-3660-5cf8-b9b3-166f6e6ea5ca",
    "ParameterType": "DigitalOutput",
    "datatype": "bool",
    "pid": 34645,
    "x": 1020.2903566171112,
    "y": 184.4166717529297,
    "width": 95,
    "height": 50,
    "constants": {
      "pin": "22"
    },
    "up_data": {
      "can_go_up": true,
      "type": "input",
      "order": 999,
      "up": true
    },
    "debug": false,
    "active": true,
    "broadcast": false
  },
  {
    "type": "NotePad",
    "id": "12a3c684-2aa7-8de8-c4d8-261a927095ac",
    "x": 171.38333129882812,
    "y": 137.16669178009033,
    "width": 215.23333740234375,
    "height": 25,
    "ports": [],
    "text": "Realtime Clock"
  },
  {
    "type": "Parameter",
    "name": "Zorg",
    "id": "59daea0b-989d-c66d-e1b9-decbd402659c",
    "ParameterType": "Zorg",
    "datatype": null,
    "pid": 59291,
    "x": 1427.8588518622164,
    "y": 414.58335876464844,
    "width": 85,
    "height": 40,
    "up_data": {
      "can_go_up": false,
      "up": false
    },
    "debug": false,
    "active": true,
    "broadcast": false
  },
  {
    "type": "Parameter",
    "name": "WebsocketServer",
    "id": "4415ba88-de30-7b36-399c-a0d57c2a299d",
    "ParameterType": "WebsocketServer",
    "datatype": "null",
    "pid": 53339,
    "x": 1518.7108518622163,
    "y": 479.58335876464844,
    "width": 115,
    "height": 35,
    "up_data": {
      "can_go_up": false,
      "type": "output",
      "order": 999,
      "up": false
    },
    "debug": false,
    "active": true,
    "broadcast": false
  },
  {
    "type": "Parameter",
    "name": "I2C",
    "id": "7755df86-678b-3cf3-34af-99de89dba0bb",
    "ParameterType": "I2C",
    "datatype": null,
    "pid": 45892,
    "x": 106.46666717529297,
    "y": 271.58335876464844,
    "width": 60,
    "height": 31,
    "constants": {
      "sda": "26",
      "scl": "27",
      "bus": "0",
      "baud": "400000"
    },
    "up_data": {
      "can_go_up": false,
      "up": false
    },
    "debug": false,
    "active": true,
    "broadcast": false
  },
  {
    "type": "Parameter",
    "name": "rtc",
    "id": "e079d8e9-0b29-2f30-59ae-da968ce3d4bb",
    "ParameterType": "Pcf8563",
    "datatype": "bool",
    "pid": 23367,
    "x": 271.08335876464844,
    "y": 196.08335876464844,
    "width": 75,
    "height": 41,
    "constants": {},
    "up_data": {
      "can_go_up": true,
      "type": "output",
      "order": 999,
      "up": false
    },
    "debug": false,
    "active": true,
    "broadcast": true
  },
  {
    "type": "Parameter",
    "name": "up",
    "id": "61ca9c2b-dc34-5d52-aba6-54c6026d6906",
    "ParameterType": "DigitalInput",
    "datatype": "bool",
    "pid": 46941,
    "x": 645.0833587646484,
    "y": 186.9166717529297,
    "width": 90,
    "height": 45,
    "constants": {
      "pin": "34",
      "pullup": "None",
      "debounce": 200
    },
    "up_data": {
      "can_go_up": true,
      "type": "output",
      "order": 999,
      "up": true
    },
    "debug": false,
    "active": true,
    "broadcast": true
  },
  {
    "type": "Parameter",
    "name": "down",
    "id": "e4033fad-560f-b7b4-1a41-b6f9dbc49d0c",
    "ParameterType": "DigitalInput",
    "datatype": "bool",
    "pid": 56289,
    "x": 645.0833587646484,
    "y": 286,
    "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": "Parameter",
    "name": "plus",
    "id": "ec522129-32b4-e75a-7347-aac5540b782b",
    "ParameterType": "DigitalInput",
    "datatype": "bool",
    "pid": 30366,
    "x": 645.0833587646484,
    "y": 385.9166717529297,
    "width": 90,
    "height": 45,
    "constants": {
      "pin": "14",
      "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": "minus",
    "id": "c2879c91-4f72-8aa8-516a-03a00cdcde7d",
    "ParameterType": "DigitalInput",
    "datatype": "bool",
    "pid": 21343,
    "x": 645.0833587646484,
    "y": 495.9166717529297,
    "width": 90,
    "height": 45,
    "constants": {
      "pin": "21",
      "pullup": "pullup",
      "debounce": 200
    },
    "up_data": {
      "can_go_up": true,
      "type": "output",
      "order": 999,
      "up": true
    },
    "debug": false,
    "active": true,
    "broadcast": true
  },
  {
    "type": "HoverConnection",
    "id": "7140da17-242d-7c91-ac8f-711be1323d36",
    "bus": "local",
    "vertex": [
      {
        "x": 1633.7108518622163,
        "y": 497.08335876464844
      },
      {
        "x": 1675.2108518622163,
        "y": 497.08335876464844
      },
      {
        "x": 1675.2108518622163,
        "y": 374.3027090174763
      },
      {
        "x": 1754.7108518622163,
        "y": 374.3027090174763
      }
    ],
    "source": {
      "node": "4415ba88-de30-7b36-399c-a0d57c2a299d",
      "port": "self"
    },
    "target": {
      "node": "9e65d461-88ea-d923-2508-c70738045031",
      "port": "webserver"
    }
  },
  {
    "type": "HoverConnection",
    "id": "3f658083-625d-614a-c703-d4270120db8f",
    "bus": "local",
    "vertex": [
      {
        "x": 1575.7108518622163,
        "y": 343.47208044604776
      },
      {
        "x": 1645.2108518622163,
        "y": 343.47208044604776
      },
      {
        "x": 1645.2108518622163,
        "y": 327.44556616033344
      },
      {
        "x": 1754.7108518622163,
        "y": 327.44556616033344
      }
    ],
    "source": {
      "node": "094dfcb9-7772-56e1-d37f-10f852b3fd3e",
      "port": "self"
    },
    "target": {
      "node": "9e65d461-88ea-d923-2508-c70738045031",
      "port": "bus"
    }
  },
  {
    "type": "HoverConnection",
    "id": "65be2b61-ca8d-e5e3-81ff-af3dd48ce324",
    "bus": "local",
    "vertex": [
      {
        "x": 1562.7108518622163,
        "y": 236.0728804460477
      },
      {
        "x": 1642.7108518622163,
        "y": 236.0728804460477
      },
      {
        "x": 1642.7108518622163,
        "y": 304.016994731762
      },
      {
        "x": 1754.7108518622163,
        "y": 304.016994731762
      }
    ],
    "source": {
      "node": "755f08c5-a527-574e-94c4-ec22787d7c83",
      "port": "event"
    },
    "target": {
      "node": "9e65d461-88ea-d923-2508-c70738045031",
      "port": "function_button"
    }
  },
  {
    "type": "HoverConnection",
    "id": "8592d4ba-52c1-1160-9eb6-05127a76dedc",
    "bus": "local",
    "vertex": [
      {
        "x": 166.46666717529297,
        "y": 287.08335876464844
      },
      {
        "x": 218.7750129699707,
        "y": 287.08335876464844
      },
      {
        "x": 218.7750129699707,
        "y": 223.41669209798178
      },
      {
        "x": 271.08335876464844,
        "y": 223.41669209798178
      }
    ],
    "source": {
      "node": "7755df86-678b-3cf3-34af-99de89dba0bb",
      "port": "self"
    },
    "target": {
      "node": "e079d8e9-0b29-2f30-59ae-da968ce3d4bb",
      "port": "i2c"
    }
  },
  {
    "type": "HoverConnection",
    "id": "2b775f03-5aa3-3fe4-bb75-ac541beaf49c",
    "bus": "local",
    "vertex": [
      {
        "x": 1517.7108518622163,
        "y": 178.73954711271435
      },
      {
        "x": 1661.7108518622163,
        "y": 178.73954711271435
      },
      {
        "x": 1661.7108518622163,
        "y": 280.58842330319055
      },
      {
        "x": 1754.7108518622163,
        "y": 280.58842330319055
      }
    ],
    "source": {
      "node": "c02b1b9a-83a0-4dc8-6c78-b233f6794e97",
      "port": "self"
    },
    "target": {
      "node": "9e65d461-88ea-d923-2508-c70738045031",
      "port": "neo_status"
    }
  },
  {
    "type": "HoverConnection",
    "id": "6f0a4303-6c16-8b77-8137-475c542d914f",
    "bus": "local",
    "vertex": [
      {
        "x": 1512.8588518622164,
        "y": 434.58335876464844
      },
      {
        "x": 1654.3971053134323,
        "y": 434.58335876464844
      },
      {
        "x": 1654.3971053134323,
        "y": 350.8741375889049
      },
      {
        "x": 1754.7108518622163,
        "y": 350.8741375889049
      }
    ],
    "source": {
      "node": "59daea0b-989d-c66d-e1b9-decbd402659c",
      "port": "self"
    },
    "target": {
      "node": "9e65d461-88ea-d923-2508-c70738045031",
      "port": "zorg"
    }
  },
  {
    "type": "HoverConnection",
    "id": "825c8068-d774-af1f-4d9a-32a158ca9744",
    "bus": "local",
    "vertex": [
      {
        "x": 1507.3588518622164,
        "y": 87.79329343432896
      },
      {
        "x": 1679.7108518622163,
        "y": 87.79329343432896
      },
      {
        "x": 1679.7108518622163,
        "y": 257.15985187461916
      },
      {
        "x": 1754.7108518622163,
        "y": 257.15985187461916
      }
    ],
    "source": {
      "node": "7906fc95-7e4b-9ed1-dab9-abd07d17d0c2",
      "port": "self"
    },
    "target": {
      "node": "9e65d461-88ea-d923-2508-c70738045031",
      "port": "hbt_led"
    }
  }
]