5521d8da5d
- 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.
20 lines
510 B
Python
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" |