#ix_pkg.py stored in . . /Desktop/ix def ixTestB(s): #ixTestB.py return s #def end ixTestB.py ########################### def ixTestC(s): #ixTestC.py return s #def end ixTestC.py ########################### def initCD2(PPin): import RPi.GPIO as GPIO #By D@CC on 2023KNov01 #PPin-2 is PPout (tested with PPin = 40) GPIO.setmode(GPIO.BOARD) #physical Board numbers # GPIO.BMB BroadCoM numbering eg GPIO #s isBadPin= ((PPin-2==1) or (PPin-2==17)) # they are 3v3 # Ground pins won't work either, nor 5v0 pins if not isBadPin: GPIO.setup(PPin-2,GPIO.OUT) print("turn On phys pin:", PPin-2) GPIO.output(PPin-2, True) #if end GPIO.setup(PPin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) # on a Raspberry Pi, PullUpDown is a 10k resistor # a photoresistor photocell (CD) when lit is 100. # when dark is >10k0. return #def end initCD2(PPin) ########################### def readCD2(PPin): import RPi.GPIO as GPIO #By D@CC on 2023KNov01 #Purpose: to return True if both CDs are covered #HW: my device "CD2_Dongle(c)" #Tested with PPin=40 reading=GPIO.input(PPin) # reading is True if the CD photoCells are Dark # Make them dark by covering them with a finger if reading: state=False else: state=True #if end return state #def end readCD2(PPin)