pylint is clean
This commit is contained in:
parent
eb7736574b
commit
eeff432dbf
1 changed files with 6 additions and 6 deletions
|
|
@ -8,7 +8,7 @@ from digitalio import DigitalInOut, Direction
|
||||||
photocell = analogio.AnalogIn(board.A1) # analog #1 same pin as Digital #2
|
photocell = analogio.AnalogIn(board.A1) # analog #1 same pin as Digital #2
|
||||||
darkness_min = (2 ** 16) * .05 # light level < 5% means darkness
|
darkness_min = (2 ** 16) * .05 # light level < 5% means darkness
|
||||||
|
|
||||||
# setup speaker
|
# setup speaker
|
||||||
speaker = DigitalInOut(board.D1)
|
speaker = DigitalInOut(board.D1)
|
||||||
speaker.direction = Direction.OUTPUT
|
speaker.direction = Direction.OUTPUT
|
||||||
|
|
||||||
|
|
@ -25,7 +25,7 @@ def play_tone(tone_value, duration):
|
||||||
|
|
||||||
for i in range(0, duration):
|
for i in range(0, duration):
|
||||||
i += tone_value * 2
|
i += tone_value * 2
|
||||||
speaker.value = True
|
speaker.value = True
|
||||||
time.sleep(tone_value / microseconds)
|
time.sleep(tone_value / microseconds)
|
||||||
speaker.value = False
|
speaker.value = False
|
||||||
time.sleep(tone_value / microseconds)
|
time.sleep(tone_value / microseconds)
|
||||||
|
|
@ -34,12 +34,12 @@ def play_tone(tone_value, duration):
|
||||||
while True:
|
while True:
|
||||||
|
|
||||||
# when photocell goes dark (less than 5%)
|
# when photocell goes dark (less than 5%)
|
||||||
# turn on audio
|
# turn on audio
|
||||||
# rotate stepper
|
# rotate stepper
|
||||||
if photocell.value < darkness_min:
|
if photocell.value < darkness_min:
|
||||||
chirp() # bird chirp noise
|
chirp() # bird chirp noise
|
||||||
if ( servo.angle == 0 ):
|
if servo.angle == 0:
|
||||||
servo.angle = 180 # rotate bird head 180 degrees
|
servo.angle = 180 # rotate bird head 180 degrees
|
||||||
else:
|
else:
|
||||||
servo.angle = 0
|
servo.angle = 0
|
||||||
time.sleep(.5) # leave some time to complete rotation
|
time.sleep(.5) # leave some time to complete rotation
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue