Add initial project files including configuration and LED control scripts
- Create .gitignore to exclude unnecessary files - Add .micropico for project identification - Implement config.json for switch configurations - Develop led_panel_blink.py for LED control with color cycling - Create main.py to manage switch commands and interactions - Introduce servo.py for servo control functionality - Define switch.py to handle switch operations with servo integration
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
from servo import Servo
|
||||
|
||||
|
||||
class Switch:
|
||||
def __init__(self, id, pin, angle_minus, angle_plus):
|
||||
self.id = id
|
||||
self.pin = pin
|
||||
self.angle_minus = angle_minus
|
||||
self.angle_plus = angle_plus
|
||||
self.servo = Servo(pin)
|
||||
self.pos = "-"
|
||||
self.set_minus()
|
||||
|
||||
def set_minus(self):
|
||||
self.servo.angle(self.angle_minus)
|
||||
self.pos = "-"
|
||||
|
||||
def set_plus(self):
|
||||
self.servo.angle(self.angle_plus)
|
||||
self.pos = "+"
|
||||
Reference in New Issue
Block a user