Files
Artem Kashaev 5521d8da5d Enhance IR control functionality and configuration
- Updated angle_minus value in config.json for switch calibration.
- Added support for seminsu devices in load_seminsus function.
- Implemented polling logic for seminsu devices in main.py.
- Adjusted switch position representation from "-" and "+" to "1" and "0".
- Introduced IRRxTxPollPair class for IR communication in ir_pair.py.
- Created ir_test.py for testing IR functionality with configurable parameters.
2025-12-26 10:05:41 +05:00

20 lines
510 B
Python

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 = "1" # 1 - минус, 0 - плюс
self.set_minus()
def set_minus(self):
self.servo.angle(self.angle_minus)
self.pos = "1"
def set_plus(self):
self.servo.angle(self.angle_plus)
self.pos = "0"