Exemple #1
0
    logfile = open("testing/abenalog.txt", "a+")
    timestamp = dt.datetime.now()
    logfile.write(f"{timestamp}: Device started\n")

    if not largeScreen:
        subprocess.run(["xinput", "map-to-output", "8", "DSI-1"])
    #else:
    #    subprocess.run(["xinput", "map-to-output", "8", "HDMI-1"])
    if isOnline and not checkInternet():
        isOnline = False

    # Initialize dispenser
    disp = dispenser.Dispenser()
    disp.init_GPIO()
    # Initialize LEDs
    leds = LEDs.LEDinit()
    disp.gelUpdate()
    pygame.time.set_timer(BLINKEVENT, 10000, True)
    monsterblinks = [monsterblinkL, monsterblinkM, monsterblinkR]

    # Initialize interaction variables
    flow = threading.Thread(target=interaction)
    threadevent = threading.Event()  #Used to terminate interaction thread
    trackID = 0  #ID of closest person
    altTrackID = 0  #ID of other random person
    gazeAtClosest = True
    pygame.time.set_timer(GAZEEVENT, 8000, True)  #Start gaze event
    videoKeys = []  #IDs of people present at last video showing
    prevKeys = []  #IDs of people present last iteration
    prevInteraction = 0  #What interaction scenario was last run
    #interactionWait = False #Indicate if waiting between interactions
Exemple #2
0
#  Import project specific files #
import LCD_Display           # Printing to LCD
import Matrix_Keypad         # Handing the keypad IO
import DHT11                # Temperature and humidity sensor
import PIR                  # Pyroelectric Infrared Motion Detector
import LEDs                 # LEDs for status and alert
import Alarm                # Alarm (buzzer/LED)
import CO_Sensor            # Carbon Monoxide detection
####################################################################
#  Class Instantiations  #

kp = MatrixKeypad.keypad()              # Keypad
pir = PIR.PIR()                         # Motion Detector
#dht = DHT11.DHT11Sensor()                # Temperature and humidity sensor
led = LEDs.LED()                        # Status/Alert LEDs
#alarm = Alarm.Alarm()                   # Alarm (buzzer)
co = CO_Sensor.COSensor()               # Carbon Monoxide Sensor
lcd = LCD_Display.AdafruitCharLCD()


def main():

    #camera = PiCamera()

    #camera.start_preview()
    #sleep(10)
    #camera.stop_preview()
    
    DHT11.read_sensor() # works, just needs averaging to handle occassional misreading