@@ -0,0 +1,792 @@
+import time%0Alastsave = 0%0A%0A%0Aif time.time() - lastsave %3E 0.2:%0A%09lastsave = time.time()%0A%09%0A%0A%09%0A%09%0A%09%0A%09 %0Adef init():%0A gpio.setmode(gpio.BCM)%0A gpio.setup(17, gpio.OUT)%0A gpio.setup(22, gpio.OUT)%0A gpio.setup(23, gpio.OUT)%0A gpio.setup(24, gpio.OUT)%0A %0Adef forward(tf):%0A init()%0A lastsave = time.time()%0A gpio.output(17, True)%0A gpio.output(22, False)%0A gpio.output(23, True) %0A gpio.output(24, False)%0A#time.sleep(tf)%0A gpio.cleanup()%0A %0Adef reverse(tf):%0A init()%0A lastsave = time.time()%0A gpio.output(17, False)%0A gpio.output(22, True)%0A gpio.output(23, False) %0A gpio.output(24, True)%0A#time.sleep(tf)%0A gpio.cleanup()%0A%0A %0A try:%0A%09while True:%0A%09%09print %22forward%22%0A%09%09forward(1)%0A%09%09if time.time() - lastsave %3E 1:%0A%09%09print %22backward%22%0A%09%09reverse(1)%0A%09%09if time.time() - lastsave %3E 1:%0Aexcept KeyboardInterrupt:%0A        gpio.cleanup()%0A

Test met time.time.