mirror of
				https://github.com/KevinMidboe/python-gpiozero.git
				synced 2025-10-29 17:50:37 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			26 lines
		
	
	
		
			362 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			362 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from RPi import GPIO
 | |
| 
 | |
| 
 | |
| class OutputDevice(object):
 | |
|     def __init__(self, pin):
 | |
|         self.pin = pin
 | |
|         GPIO.setup(pin, GPIO.OUT)
 | |
| 
 | |
|     def on(self):
 | |
|         GPIO.output(self.pin, True)
 | |
| 
 | |
|     def off(self):
 | |
|         GPIO.output(self.pin, False)
 | |
| 
 | |
| 
 | |
| class LED(OutputDevice):
 | |
|     pass
 | |
| 
 | |
| 
 | |
| class Buzzer(OutputDevice):
 | |
|     pass
 | |
| 
 | |
| 
 | |
| class Motor(OutputDevice):
 | |
|     pass
 |