#!/usr/bin/python3
-import time, socket, os, stat
+import time, socket, os, stat, atexit
from datetime import datetime
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BOARD)
# ******** main *********
+# at the end do a cleanup
+atexit.register(GPIO.cleanup);
+
# convert list of pin objects to dictionary for command lookup
pindict = {}
for pin in pinlist:
# close connection cleanly
conn.close()
-# FIXME will this be executed after receiving a terminating signal?
-GPIO.cleanup()
-