Skip to content

Commit

Permalink
Add p.stop() for PWM pin for cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
egoistka committed Nov 23, 2020
1 parent 728cddc commit 120f274
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions Code/Python_Code/06.2.1_Alertor/Alertor.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def stopAlertor():

def destroy():
GPIO.output(buzzerPin, GPIO.LOW) # Turn off buzzer
p.stop() # stop PWM
GPIO.cleanup() # Release GPIO resource

if __name__ == '__main__': # Program entrance
Expand Down
1 change: 1 addition & 0 deletions Code/Python_Code/08.1.1_Softlight/Softlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def loop():
time.sleep(0.03)

def destroy():
p.stop() # stop PWM
GPIO.cleanup()
adc.close()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ def loop():

def destroy():
adc.close()
p_Red.stop() # stop PWM
p_Green.stop() # stop PWM
p_Blue.stop() # stop PWM
GPIO.cleanup()

if __name__ == '__main__': # Program entrance
Expand Down
1 change: 1 addition & 0 deletions Code/Python_Code/10.1.1_Nightlamp/Nightlamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def loop():

def destroy():
adc.close()
p.stop() # stop PWM
GPIO.cleanup()

if __name__ == '__main__': # Program entrance
Expand Down
1 change: 1 addition & 0 deletions Code/Python_Code/13.1.1_Motor/Motor.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def loop():
time.sleep(0.01)

def destroy():
p.stop() # stop PWM
GPIO.cleanup()

if __name__ == '__main__': # Program entrance
Expand Down

0 comments on commit 120f274

Please sign in to comment.