Ejemplo n.º 1
0
def heartbeat(request):
    cfg.watchdog = 0
    output = {}
    output['b'] = cfg.blue
    output['y'] = cfg.yellow
    output['c'] = cfg.chocks
    output['g'] = cfg.green
    output['v'] = cfg.video_status
    output['l'] = cfg.left_motor
    output['r'] = cfg.right_motor
    output['i1'] = hw.input_one_read()
    output['i2'] = hw.input_two_read()
    output['i3'] = hw.input_three_read()
    if hw.input_three_read():
        touchpad(3, True)
    output['i4'] = hw.input_four_read()
    if hw.input_four_read():
        touchpad(4, True)
    output['a1'] = hw.analog_one_read()
    output['a2'] = hw.analog_two_read()
    output['a3'] = hw.analog_three_read()
    output['a4'] = hw.analog_four_read()
    return response.json(output)
Ejemplo n.º 2
0
def heartbeat():
    cfg.watchdog = 0
    output = {}
    output['b'] = cfg.blue
    output['y'] = cfg.yellow
    output['c'] = cfg.chocks
    output['g'] = cfg.green
    output['f'] = cfg.video_fps
    output['v'] = cfg.video_status
    output['l'] = cfg.left_motor
    output['r'] = cfg.right_motor
    output['i1'] = hw.input_one_read()
    output['i2'] = hw.input_two_read()
    output['i3'] = hw.input_three_read()
    output['i4'] = hw.input_four_read()
    output['a1'] = hw.analog_one_read()
    output['a2'] = hw.analog_two_read()
    output['a3'] = hw.analog_three_read()
    output['a4'] = hw.analog_four_read()
    return json.dumps(output)
Ejemplo n.º 3
0
from mfrc522 import SimpleMFRC522
import os
#import paho.mqtt.client as mqtt
#import explorer hat configs:
import io_wrapper as hw
import app as app

#to shut-down Rpi
from subprocess import call

reader = SimpleMFRC522()
#client = mqtt.Client("SopoRFID")

try:
    #read input 2 in order to call RFID on explorer hat
    state = hw.input_four_read()
    print("Please place your key against the reader")

    def get_time():
        """ Returns a string with the time and date """
        return time.strftime("%d %b %Y %H:%M:%S", time.gmtime())

    if state == 1:
        id, name = reader.read()
        print(id)
        app.main()
        #name = name.strip()
        #if id == "863881349114":

    #rfidData = json.dumps({"carKey": carKey, "renterID": str(id), "timestamp": get_time()})
    #print("Connecting to Broker")