import time import random from canard import can, bus from canard.hw import socketcan from canard.file import jsondb parser = jsondb.JsonDbParser() b = parser.parse('hydrobot_can.json') dev = socketcan.SocketCanDev("can1") dev.start() temp = 65.5 humid = 0.90 press = 100 while True: temp = max(0x00, min(0xFF, random.randint(-1, 1)/2 + temp)) humid = max(0x00, min(0xFF, random.randint(-1, 1)/100 + humid)) press = max(0x00, min(0xFF, random.randint(-1, 1) + press)) print(b.AirTemp.Temperature.value) b.AirTemp.Temperature.value = temp b.AirTemp.Humidity.value = humid b.AirTemp.Pressure.value = press dev.send(b.AirTemp.encode()) time.sleep(1)