예제 #1
0
def get_message_value(can_id, bit):
        while True:
            json_data = json.dumps(
                    {'time':datetime.now().strftime('%H:%M:%S'), 'value': can.get_can_message(can_id, bit)})
            yield f"data:{json_data}\n\n"
            # delay system to ensure stability
            time.sleep(.1)
예제 #2
0
 def get_message_value(can_id):
     while True:
         json_data = json.dumps({
             'time':
             datetime.now().strftime('%y-%m-%d %H:%M:%S'),
             'value':
             can.get_can_message(can_id)
         })
         yield f"data:{json_data}\n\n"
         time.sleep(1)
예제 #3
0
def default():
    msg = can.get_can_message(0x0C0)
    if msg is None:
        msg = "No Data"
    return render_template('main.html', name='Main Page', value=msg)
    msg2 = can.get_can_message(0x0A6)