hx711_board

Last Modified: 2024-04-09 08:33:22

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

Owned By: evezor

Created By: anfro

Contributors: anfro, evezor

Public: True


Executable


        
# --------------------------------------
#   hx711_board
#   65f69730da945356canv
__canvas_id__ = '65f69730da945356'
# __version__ = TODO: add this
# --------------------------------------
from floe import FP

from NeoPixel import NeoPixel
from ESP32Core import ESP32Core
from HbtLed import HbtLed
from Hx711 import Hx711
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=24, bus=0, baud=250000, rx_queue=25, terminal_debug=False, debug=False, active=True, bcast=False, iris=iris)
  DigitalInput(name='a', pid=12156, pin=22, pullup='pullup', debounce=200, invert=True, initial_value=False, datatype="bool", debug=False, active=True, bcast=True, iris=iris)
  DigitalInput(name='b', pid=52824, pin=21, 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)
  DigitalOutput(name='can_slp', pid=11397, pin=2, 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)
  Hx711(name='Hx711', pid=27668, d_out=19, pd_sck=18, channel='CHANNEL_A_128', tare=FP(12156), datatype="float", debug=False, active=True, bcast=True, 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", "I2C", "ESP32Core", "HbtLed", "Parameter", "Hx711", "FileReceiver", "CANBus", "DigitalInput", "DigitalOutput"]
    

Uppie code:

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

{
  "canvas_id": "65f69730da945356canv",
  "zorg": false,
  "busses": {
    "CANBus": "24"
  },
  "ports": [
    {
      "name": "a",
      "reference_id": "50d58f6b-d694-8d2e-f93b-692b3768a751",
      "pid": 12156,
      "type": "output",
      "datatype": "bool",
      "parameter_type": "DigitalInput"
    },
    {
      "name": "b",
      "reference_id": "6320fd17-48a0-fd36-66ee-46fe1581f8df",
      "pid": 52824,
      "type": "output",
      "datatype": "bool",
      "parameter_type": "DigitalInput"
    }
  ]
}
    

Uppie subs:


{}
    

Canvas code:


[
  {
    "type": "CanvasID",
    "id": "65f69730da945356canv",
    "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": 1869.3853,
    "y": 304.9602,
    "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": 1582.3853,
    "y": 290.30179999999996,
    "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": 1559.3853,
    "y": 223.30179999999996,
    "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": 1611.3853,
    "y": 393.201,
    "width": 79,
    "height": 43,
    "constants": {
      "rx": "16",
      "tx": "4",
      "adr": "24",
      "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": 1832.940868701172,
    "y": 231.30179999999996,
    "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": 1548.0333,
    "y": 139.02221298828124,
    "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": 1896.0742,
    "y": 139.02221298828124,
    "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": "a",
    "id": "50d58f6b-d694-8d2e-f93b-692b3768a751",
    "ParameterType": "DigitalInput",
    "datatype": "bool",
    "pid": 12156,
    "x": 383.61341797180177,
    "y": 544.2328129882812,
    "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": "NotePad",
    "id": "45f1c230-3787-6632-4d97-7f37fd9910b7",
    "x": 396.5884183532715,
    "y": 299.7517998092651,
    "width": 192,
    "height": 25,
    "ports": [],
    "text": "Button"
  },
  {
    "type": "Parameter",
    "name": "b",
    "id": "6320fd17-48a0-fd36-66ee-46fe1581f8df",
    "ParameterType": "DigitalInput",
    "datatype": "bool",
    "pid": 52824,
    "x": 383.61341797180177,
    "y": 392.201,
    "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": "Parameter",
    "name": "Hx711",
    "id": "a4fda2b6-1126-22cb-9185-c4b86a224d9c",
    "ParameterType": "Hx711",
    "datatype": "float",
    "pid": 27668,
    "x": 614.3833312988281,
    "y": 482.201,
    "width": 75,
    "height": 40,
    "constants": {
      "d_out": "19",
      "pd_sck": "18",
      "channel": "CHANNEL_A_128"
    },
    "up_data": {
      "can_go_up": true,
      "type": "output",
      "order": 999,
      "up": false
    },
    "debug": false,
    "active": true,
    "broadcast": true
  },
  {
    "type": "HoverConnection",
    "id": "5870db5d-f6b7-f6fe-6125-413115e7aadc",
    "bus": "local",
    "vertex": [
      {
        "x": 473.61341797180177,
        "y": 559.2328129882812
      },
      {
        "x": 543.9983746353149,
        "y": 559.2328129882812
      },
      {
        "x": 543.9983746353149,
        "y": 508.8676666666667
      },
      {
        "x": 614.3833312988281,
        "y": 508.8676666666667
      }
    ],
    "source": {
      "node": "50d58f6b-d694-8d2e-f93b-692b3768a751",
      "port": "event"
    },
    "target": {
      "node": "a4fda2b6-1126-22cb-9185-c4b86a224d9c",
      "port": "tare"
    }
  },
  {
    "type": "HoverConnection",
    "id": "65be2b61-ca8d-e5e3-81ff-af3dd48ce324",
    "bus": "local",
    "vertex": [
      {
        "x": 1677.3853,
        "y": 307.30179999999996
      },
      {
        "x": 1757.3853,
        "y": 307.30179999999996
      },
      {
        "x": 1757.3853,
        "y": 375.24591428571426
      },
      {
        "x": 1869.3853,
        "y": 375.24591428571426
      }
    ],
    "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": 1632.3853,
        "y": 249.96846666666661
      },
      {
        "x": 1776.3853,
        "y": 249.96846666666661
      },
      {
        "x": 1776.3853,
        "y": 351.8173428571428
      },
      {
        "x": 1869.3853,
        "y": 351.8173428571428
      }
    ],
    "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": 1690.3853,
        "y": 414.701
      },
      {
        "x": 1759.8853,
        "y": 414.701
      },
      {
        "x": 1759.8853,
        "y": 398.6744857142857
      },
      {
        "x": 1869.3853,
        "y": 398.6744857142857
      }
    ],
    "source": {
      "node": "094dfcb9-7772-56e1-d37f-10f852b3fd3e",
      "port": "self"
    },
    "target": {
      "node": "9e65d461-88ea-d923-2508-c70738045031",
      "port": "bus"
    }
  },
  {
    "type": "HoverConnection",
    "id": "825c8068-d774-af1f-4d9a-32a158ca9744",
    "bus": "local",
    "vertex": [
      {
        "x": 1622.0333,
        "y": 159.02221298828124
      },
      {
        "x": 1794.3853,
        "y": 159.02221298828124
      },
      {
        "x": 1794.3853,
        "y": 328.38877142857143
      },
      {
        "x": 1869.3853,
        "y": 328.38877142857143
      }
    ],
    "source": {
      "node": "7906fc95-7e4b-9ed1-dab9-abd07d17d0c2",
      "port": "self"
    },
    "target": {
      "node": "9e65d461-88ea-d923-2508-c70738045031",
      "port": "hbt_led"
    }
  }
]