#!/usr/bin/env python3

import time
import datetime
import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BOARD)
GPIO.setup(21, GPIO.IN)
GPIO.setup(19, GPIO.IN)

while True:
    time.sleep(0.5)
    date_str = datetime.datetime.now().strftime("%d/%m/%Y %H:%M:%S")
    if GPIO.input(19) == 0:
        print("%s - pin 19 down (back door opened !)" % date_str)
    if GPIO.input(21) == 0:
        print("%s - pin 21 down (front door opened !)" % date_str)
