mirror of
				https://github.com/KevinMidboe/python-gpiozero.git
				synced 2025-10-29 17:50:37 +00:00 
			
		
		
		
	Merge pull request #11 from waveform80/auto-cleanup
Ensure GPIO.cleanup is called
This commit is contained in:
		| @@ -1,6 +1,14 @@ | |||||||
| from __future__ import absolute_import | from __future__ import absolute_import | ||||||
|  |  | ||||||
|  | import atexit | ||||||
|  |  | ||||||
| from RPi import GPIO | from RPi import GPIO | ||||||
|  |  | ||||||
|  |  | ||||||
|  | def gpiozero_shutdown(): | ||||||
|  |     GPIO.cleanup() | ||||||
|  |  | ||||||
|  | atexit.register(gpiozero_shutdown) | ||||||
| GPIO.setmode(GPIO.BCM) | GPIO.setmode(GPIO.BCM) | ||||||
| GPIO.setwarnings(False) | GPIO.setwarnings(False) | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user