lcd_16x2_board
Last Modified: 2024-03-19 06:17:59
Created On: 2023-12-10 15:58:46
Owned By: evezor
Created By: anfro
Contributors: anfro, evezor
Public: True
Executable
# --------------------------------------
# lcd_16x2_board
# 65f69716bda9b82bcanv
__canvas_id__ = '65f69716bda9b82b'
# __version__ = TODO: add this
# --------------------------------------
def code_block(event, line1_pre, line1_val, line2_pre, line2_val):
return {"line1": f"{line1_pre}{round(line1_val, 2)}",
"line2": f"{line2_pre}{round(line2_val, 2)}"}
from floe import FP
from GpioLcd import GpioLcd
from CodeBlock import CodeBlock
from DigitalInput import DigitalInput
from DigitalOutput import DigitalOutput
from HbtLed import HbtLed
from CANBus import CANBus
from NeoPixel import NeoPixel
from ESP32Core import ESP32Core
from Variable import Variable
from Zorg import Zorg
def setup(iris):
CANBus(name="CANBus", pid=6545, rx=16, tx=4, adr=26, bus=0, baud=250000, rx_queue=25, terminal_debug=False, debug=False, active=True, bcast=False, iris=iris)
CodeBlock(name="code_block", pid=44338, code=code_block, kwargs=[FP(45549), FP(31256), FP(32931), FP(27267)], datatype="None", iris=iris)
DigitalInput(name="a", pid=29989, pin=39, pullup='None', debounce=200, invert=True, initial_value=False, datatype="bool", debug=False, active=True, bcast=True, iris=iris)
DigitalInput(name="b", pid=39132, pin=34, pullup='None', debounce=200, invert=True, initial_value=False, datatype="bool", debug=False, active=True, bcast=True, iris=iris)
DigitalInput(name="down", pid=39697, pin=35, 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="left", pid=12156, pin=26, pullup='pullup', debounce=200, invert=True, initial_value=False, datatype="bool", debug=False, active=True, bcast=True, iris=iris)
DigitalInput(name="right", pid=30594, pin=32, pullup='pullup', debounce=200, invert=True, initial_value=False, datatype="bool", debug=False, active=True, bcast=True, iris=iris)
DigitalInput(name="up", pid=10879, pin=15, pullup='pullup', 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)
GpioLcd(name="GpioLcd", pid=38610, d0_pin=12, d1_pin=13, d2_pin=15, d3_pin=18, d4_pin=19, d5_pin=21, d6_pin=22, d7_pin=23, rs_pin=27, enable_pin=14, num_lines=2, num_columns=16, initial_state=FP(43183), clear=None, datatype="dict", 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)
Variable(name="line1_pre", pid=45549, state='Temp: ', datatype="string", constant=False, debug=False, active=True, bcast=True, iris=iris)
Variable(name="line1_val", pid=31256, state=0.0, datatype="float", constant=False, debug=False, active=True, bcast=True, iris=iris)
Variable(name="line2_pre", pid=32931, state='val: ', datatype="string", constant=False, debug=False, active=True, bcast=True, iris=iris)
Variable(name="line2_val", pid=27267, state=0.0, datatype="float", constant=False, debug=False, active=True, bcast=True, iris=iris)
Variable(name="no_name", pid=43183, state={"line1": "16x2 LCD Module", "line2": " by Evezor"}, datatype="dict", constant=False, debug=False, active=True, bcast=True, iris=iris)
Zorg(name="Zorg", pid=34757, debug=False, active=True, bcast=False, iris=iris)
iris.add_hots({"38610": [44338], "44338": [31256, 27267, 32931, 45549]})
Canvas View:
Dependencies:
["GpioLcd", "CodeBlock", "DigitalInput", "DigitalOutput", "HbtLed", "CANBus", "NeoPixel", "ESP32Core", "Variable", "FileSender", "Zorg", "FileReceiver", "Parameter"]
Uppie code:
this code is used as the constructor in this canvas is dropped on a canvas above
{
"canvas_id": "65f69716bda9b82bcanv",
"zorg": true,
"busses": {
"CANBus": "26"
},
"ports": [
{
"name": "a",
"reference_id": "4ccb6a31-495e-fb36-3826-ca1c061c4da8",
"pid": 29989,
"type": "output",
"datatype": "bool",
"parameter_type": "DigitalInput"
},
{
"name": "b",
"reference_id": "c62362b7-c36a-20e3-9ca3-ef14d8de772b",
"pid": 39132,
"type": "output",
"datatype": "bool",
"parameter_type": "DigitalInput"
},
{
"name": "up",
"reference_id": "703080b8-387a-a806-2b5d-cb80328856c3",
"pid": 10879,
"type": "output",
"datatype": "bool",
"parameter_type": "DigitalInput"
},
{
"name": "left",
"reference_id": "50d58f6b-d694-8d2e-f93b-692b3768a751",
"pid": 12156,
"type": "output",
"datatype": "bool",
"parameter_type": "DigitalInput"
},
{
"name": "down",
"reference_id": "4d86a02f-ead4-b58b-35d0-d9e54fb14e24",
"pid": 39697,
"type": "output",
"datatype": "bool",
"parameter_type": "DigitalInput"
},
{
"name": "right",
"reference_id": "14bc7d91-dd44-6fe2-4060-d1b3b5cb3041",
"pid": 30594,
"type": "output",
"datatype": "bool",
"parameter_type": "DigitalInput"
},
{
"name": "line1_pre",
"reference_id": "a47db925-778a-2972-d3fa-f434f9d3c7d5",
"pid": 45549,
"type": "both",
"datatype": "string",
"parameter_type": "Variable"
},
{
"name": "line1_val",
"reference_id": "b849d089-d7f4-bdd1-e601-bdb45dcfcbab",
"pid": 31256,
"type": "both",
"datatype": "float",
"parameter_type": "Variable"
},
{
"name": "line2_pre",
"reference_id": "7021f6b0-14aa-ae35-aac6-1ecdef187ae7",
"pid": 32931,
"type": "both",
"datatype": "string",
"parameter_type": "Variable"
},
{
"name": "line2_val",
"reference_id": "5ca89a2a-866d-2a37-88fd-d224cf964a29",
"pid": 27267,
"type": "both",
"datatype": "float",
"parameter_type": "Variable"
}
]
}
Uppie subs:
{}
Canvas code:
[
{
"type": "CanvasID",
"id": "65f69716bda9b82bcanv",
"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": "26",
"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": "a",
"id": "4ccb6a31-495e-fb36-3826-ca1c061c4da8",
"ParameterType": "DigitalInput",
"datatype": "bool",
"pid": 29989,
"x": 1547.2162,
"y": 325.9835129882813,
"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": "b",
"id": "c62362b7-c36a-20e3-9ca3-ef14d8de772b",
"ParameterType": "DigitalInput",
"datatype": "bool",
"pid": 39132,
"x": 1547.2162,
"y": 468.8851000000002,
"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": "up",
"id": "703080b8-387a-a806-2b5d-cb80328856c3",
"ParameterType": "DigitalInput",
"datatype": "bool",
"pid": 10879,
"x": 1018.6168,
"y": 273.5793000000001,
"width": 90,
"height": 45,
"constants": {
"pin": "15",
"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": "d670df26-810d-29b5-3998-4b162120166e",
"x": 1260.1309003814697,
"y": 197.99492824707022,
"width": 218,
"height": 25,
"ports": [],
"text": "Buttons"
},
{
"type": "Parameter",
"name": "left",
"id": "50d58f6b-d694-8d2e-f93b-692b3768a751",
"ParameterType": "DigitalInput",
"datatype": "bool",
"pid": 12156,
"x": 835.6168,
"y": 392.9005129882812,
"width": 90,
"height": 45,
"constants": {
"pin": "26",
"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": "down",
"id": "4d86a02f-ead4-b58b-35d0-d9e54fb14e24",
"ParameterType": "DigitalInput",
"datatype": "bool",
"pid": 39697,
"x": 1018.6168,
"y": 499.90051298828143,
"width": 90,
"height": 45,
"constants": {
"pin": "35",
"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": "right",
"id": "14bc7d91-dd44-6fe2-4060-d1b3b5cb3041",
"ParameterType": "DigitalInput",
"datatype": "bool",
"pid": 30594,
"x": 1190.1168,
"y": 392.9005129882812,
"width": 90,
"height": 45,
"constants": {
"pin": "32",
"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": "GpioLcd",
"id": "38465246-4146-089d-7ee6-57bae82de653",
"ParameterType": "GpioLcd",
"datatype": "dict",
"pid": 38610,
"x": 563.2929999999999,
"y": 883.1649282470702,
"width": 68,
"height": 42,
"constants": {
"d0_pin": "12",
"d1_pin": "13",
"d2_pin": "15",
"d3_pin": "18",
"d4_pin": "19",
"d5_pin": "21",
"d6_pin": "22",
"d7_pin": "23",
"rs_pin": "27",
"enable_pin": "14",
"num_lines": "2",
"num_columns": "16"
},
"up_data": {
"can_go_up": true,
"type": "output",
"order": 999,
"up": false
},
"debug": false,
"active": true,
"broadcast": false
},
{
"type": "Variable",
"id": "46950380-4b85-2bfe-a6aa-fe84051f3950",
"name": "no_name",
"class": "Dict",
"datatype": "dict",
"state": "{\"line1\": \"16x2 LCD Module\",\"line2\": \" by Evezor\"}",
"pid": 43183,
"up_data": {
"type": "both",
"order": 999,
"up": false
},
"constant": false,
"x": 74.07370000000009,
"y": 791.1495,
"width": 298,
"height": 24,
"debug": false,
"active": true,
"broadcast": true
},
{
"type": "Variable",
"id": "a47db925-778a-2972-d3fa-f434f9d3c7d5",
"name": "line1_pre",
"class": "String",
"datatype": "string",
"state": "Temp: ",
"pid": 45549,
"up_data": {
"type": "both",
"order": 999,
"up": true
},
"constant": false,
"x": 137.1352,
"y": 315.4969,
"width": 59,
"height": 33,
"debug": false,
"active": true,
"broadcast": true
},
{
"type": "Variable",
"id": "b849d089-d7f4-bdd1-e601-bdb45dcfcbab",
"name": "line1_val",
"class": "Float",
"datatype": "float",
"state": "0.0",
"pid": 31256,
"up_data": {
"type": "both",
"order": 999,
"up": true
},
"constant": false,
"x": 139.6352,
"y": 406.05891298828124,
"width": 54,
"height": 32,
"debug": false,
"active": true,
"broadcast": true
},
{
"type": "CodeBlock",
"name": "code_block",
"pid": 44338,
"kwargs": [
"line1_pre",
"line1_val",
"line2_pre",
"line2_val"
],
"iris": false,
"id": "2adc0145-5f3d-a2d8-1ee7-922f65901fad",
"x": 344.8712,
"y": 589.4269129882813,
"code": "return {\"line1\": f\"{line1_pre}{round(line1_val, 2)}\", \n\"line2\": f\"{line2_pre}{round(line2_val, 2)}\"}\n\n"
},
{
"type": "Variable",
"id": "7021f6b0-14aa-ae35-aac6-1ecdef187ae7",
"name": "line2_pre",
"class": "String",
"datatype": "string",
"state": "val: ",
"pid": 32931,
"up_data": {
"type": "both",
"order": 999,
"up": true
},
"constant": false,
"x": 137.1352,
"y": 517.0589129882812,
"width": 48,
"height": 30,
"debug": false,
"active": true,
"broadcast": true
},
{
"type": "Variable",
"id": "5ca89a2a-866d-2a37-88fd-d224cf964a29",
"name": "line2_val",
"class": "Float",
"datatype": "float",
"state": "0.0",
"pid": 27267,
"up_data": {
"type": "both",
"order": 999,
"up": true
},
"constant": false,
"x": 137.1352,
"y": 603.2961282470702,
"width": 46,
"height": 29,
"debug": false,
"active": true,
"broadcast": true
},
{
"type": "Parameter",
"name": "Zorg",
"id": "ee3d5bd4-9163-11b9-5c24-9dbb03da5da6",
"ParameterType": "Zorg",
"datatype": null,
"pid": 34757,
"x": 1002.5,
"y": 723.5,
"width": 85,
"height": 40,
"up_data": {
"can_go_up": false,
"up": false
},
"debug": false,
"active": true,
"broadcast": false
},
{
"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"
}
},
{
"type": "HoverConnection",
"id": "2b2ebe85-cf89-2900-e3fa-be1bada9fffa",
"bus": "local",
"vertex": [
{
"x": 193.6352,
"y": 422.05891298828124
},
{
"x": 284.3852,
"y": 422.05891298828124
},
{
"x": 284.3852,
"y": 641.4269129882813
},
{
"x": 344.8712,
"y": 641.4269129882813
}
],
"source": {
"node": "b849d089-d7f4-bdd1-e601-bdb45dcfcbab",
"port": "output0"
},
"target": {
"node": "2adc0145-5f3d-a2d8-1ee7-922f65901fad",
"port": "input"
}
},
{
"type": "HoverConnection",
"id": "5a588ba0-926c-bb21-d603-908b4629a2a4",
"bus": "local",
"vertex": [
{
"x": 183.1352,
"y": 617.7961282470702
},
{
"x": 262.5352000000003,
"y": 617.7961282470702
},
{
"x": 262.5352000000003,
"y": 641.4269129882813
},
{
"x": 344.8712,
"y": 641.4269129882813
}
],
"source": {
"node": "5ca89a2a-866d-2a37-88fd-d224cf964a29",
"port": "output0"
},
"target": {
"node": "2adc0145-5f3d-a2d8-1ee7-922f65901fad",
"port": "input"
}
},
{
"type": "HoverConnection",
"id": "946f6f81-8d4e-5b33-9b4f-0af8b210b061",
"bus": "local",
"vertex": [
{
"x": 185.1352,
"y": 532.0589129882812
},
{
"x": 272.6352,
"y": 532.0589129882812
},
{
"x": 272.6352,
"y": 641.4269129882813
},
{
"x": 344.8712,
"y": 641.4269129882813
}
],
"source": {
"node": "7021f6b0-14aa-ae35-aac6-1ecdef187ae7",
"port": "output0"
},
"target": {
"node": "2adc0145-5f3d-a2d8-1ee7-922f65901fad",
"port": "input"
}
},
{
"type": "HoverConnection",
"id": "449a4d40-ce0f-ba3a-44fd-d1ce12fc8f69",
"bus": "local",
"vertex": [
{
"x": 196.1352,
"y": 331.9969
},
{
"x": 296.0352000000002,
"y": 331.9969
},
{
"x": 296.0352000000002,
"y": 641.4269129882813
},
{
"x": 344.8712,
"y": 641.4269129882813
}
],
"source": {
"node": "a47db925-778a-2972-d3fa-f434f9d3c7d5",
"port": "output0"
},
"target": {
"node": "2adc0145-5f3d-a2d8-1ee7-922f65901fad",
"port": "input"
}
},
{
"type": "HoverConnection",
"id": "34ddc124-6ab4-fa41-663b-ebebff865891",
"bus": "local",
"vertex": [
{
"x": 430.8712,
"y": 641.4269129882813
},
{
"x": 477.10663161010734,
"y": 641.4269129882813
},
{
"x": 477.10663161010734,
"y": 898.8489282470701
},
{
"x": 563.2929999999999,
"y": 893.6649282470702
}
],
"source": {
"node": "2adc0145-5f3d-a2d8-1ee7-922f65901fad",
"port": "event"
},
"target": {
"node": "38465246-4146-089d-7ee6-57bae82de653",
"port": "input"
}
},
{
"type": "HoverConnection",
"id": "f1a20f7d-be47-89fc-9426-7d6519e7c10e",
"bus": "local",
"vertex": [
{
"x": 372.0737000000001,
"y": 803.1495
},
{
"x": 461.46254999999996,
"y": 803.1495
},
{
"x": 461.46254999999996,
"y": 909.3489282470701
},
{
"x": 563.2929999999999,
"y": 904.1649282470702
}
],
"source": {
"node": "46950380-4b85-2bfe-a6aa-fe84051f3950",
"port": "output0"
},
"target": {
"node": "38465246-4146-089d-7ee6-57bae82de653",
"port": "initial_state"
}
},
{
"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": "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"
}
}
]