Ejemplo n.º 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)
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 def turnOn(self) -> None:
     GpioInterface.writePin(self.pin, True)
Ejemplo n.º 4
0
 def __init__(self, pin: int):
     self.pin = pin
     GpioInterface.setup(self.pin, GpioInterface.OUT)
Ejemplo n.º 5
0
 def turnOff(self) -> None:
     GpioInterface.writePin(self.pin, False)
Ejemplo n.º 6
0
 def isPressed(self) -> bool:
     return not GpioInterface.readPin(self.pin)
Ejemplo n.º 7
0
 def destroy():
     Peripherals.laser.turnOff()
     Peripherals.gimbal.destroy()
     GpioInterface.destroy()
Ejemplo n.º 8
0
 def isMotionDetected(self) -> bool:
     return GpioInterface.readPin(self.pin)