예제 #1
0
 def initialise():
     GpioInterface.initialise()
     Peripherals.motion_sensor = MotionSensor(14)
     Peripherals.laser = Laser(4)
     Peripherals.laser.turnOff()
     Peripherals.gimbal = Gimbal(3, 2)
     Peripherals.audio = AudioInterface()
     Peripherals.button = Button(15)
예제 #2
0
파일: servo.py 프로젝트: Lewak/Turret
 def setAngle(self, angleDegrees: float) -> None:
     position = angleDegrees * (
         Servo._maxPosition - Servo._minPosition) / 180 + Servo._minPosition
     position = min(position, Servo._maxPosition)
     position = max(position, Servo._minPosition)
     GpioInterface.setServoPosition(self.pin, position)
예제 #3
0
파일: laser.py 프로젝트: Lewak/Turret
 def turnOn(self) -> None:
     GpioInterface.writePin(self.pin, True)
예제 #4
0
파일: laser.py 프로젝트: Lewak/Turret
 def __init__(self, pin: int):
     self.pin = pin
     GpioInterface.setup(self.pin, GpioInterface.OUT)
예제 #5
0
파일: laser.py 프로젝트: Lewak/Turret
 def turnOff(self) -> None:
     GpioInterface.writePin(self.pin, False)
예제 #6
0
파일: button.py 프로젝트: Lewak/Turret
 def isPressed(self) -> bool:
     return not GpioInterface.readPin(self.pin)
예제 #7
0
 def destroy():
     Peripherals.laser.turnOff()
     Peripherals.gimbal.destroy()
     GpioInterface.destroy()
예제 #8
0
 def isMotionDetected(self) -> bool:
     return GpioInterface.readPin(self.pin)