Ich bekomme folgende Fehlermeldung:
Code: Alles auswählen
Exception in thread Thread-3:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "InteraktivTest.py", line 28, in countdown
time.sleep(1)
NameError: global name 'time' is not defined
Code: Alles auswählen
from time import sleep
import RPi.GPIO as GPIO
import os
import threading
from omxplayer.player import OMXPlayer
GPIO.setmode(GPIO.BOARD)
button1=35
button2=36
button3=37
imagefilmpfad="/home/pi/Standanimation.m4v"
v1vidpfad="/home/pi/V1Auto.m4v"
v2vidpfad="/home/pi/V2Auto.m4v"
finalRoadstarpfad="/home/pi/AutoV1.mov"
backround=0
Videoduration=0
timer=1
GPIO.setup(button1,GPIO.IN,pull_up_down=GPIO.PUD_UP)
GPIO.setup(button2,GPIO.IN,pull_up_down=GPIO.PUD_UP)
GPIO.setup(button3,GPIO.IN,pull_up_down=GPIO.PUD_UP)
def countdown():
global Videoduration
timer = Videoduration
print "timer start"
while 0==0:
if timer>0:
timer = timer - 1
time.sleep(1)
elif timer<=0:
print "timer ende"
global backround
backround=0
while 1==1:
if GPIO.input(button1)==0:
print "Button 1 wurde gedrueckt"
player.quit()
sleep(0.025)
player = OMXPlayer(v2vidpfad)
Videoduration=player.duration()
print "fertig"
t = threading.Thread(target=countdown)
t.start()
if GPIO.input(button2)==0:
print "Button 2 wurde gedrueckt"
player.quit()
sleep(0.025)
player = OMXPlayer(v1vidpfad)
Videoduration=player.duration()
t = threading.Thread(target=countdown)
t.start()
LG
Steffen Rohwer