Beispiel #1
0
    def set(self, on):
        """Set the value of a solenoid.

        :param on: True will turn the solenoid output on. False will turn the solenoid output off.
        :type on: bool
        """
        hal.setSolenoid(self.solenoidHandle, on)
Beispiel #2
0
    def set(self, on):
        """Set the value of a solenoid.

        :param on: Turn the solenoid output off or on.
        :type on: bool
        """
        hal.setSolenoid(self.port, on)
    def set(self, on):
        """Set the value of a solenoid.

        :param on: True will turn the solenoid output on. False will turn the solenoid output off.
        :type on: bool
        """
        hal.setSolenoid(self.solenoidHandle, on)
Beispiel #4
0
    def set(self, on):
        """Set the value of a solenoid.

        :param on: Turn the solenoid output off or on.
        :type on: bool
        """
        with self.mutex:
            hal.setSolenoid(self.port, on)
    def set(self, value, mask):
        """Set the value of a solenoid.

        :param value: The value you want to set on the module.
        :param mask: The channels you want to be affected.
        """
        with self.mutex:
            for i in range(SensorBase.kSolenoidChannels):
                local_mask = 1 << i
                if (mask & local_mask) != 0:
                    hal.setSolenoid(self.ports[i], (value & local_mask) != 0)
Beispiel #6
0
    def set(self, value, mask):
        """Set the value of a solenoid.

        :param value: The value you want to set on the module.
        :param mask: The channels you want to be affected.
        """
        with self.mutex:
            for i in range(SensorBase.kSolenoidChannels):
                local_mask = 1 << i
                if (mask & local_mask) != 0:
                    hal.setSolenoid(self.ports[i], (value & local_mask) != 0)
Beispiel #7
0
    def set(self, value):
        """Set the value of a solenoid.

        :param value: The value to set (Off, Forward, Reverse)
        :type  value: :class:`DoubleSolenoid.Value`
        """

        if value == self.Value.kOff:
            hal.setSolenoid(self.forwardHandle, False)
            hal.setSolenoid(self.reverseHandle, False)
        elif value == self.Value.kForward:
            hal.setSolenoid(self.reverseHandle, False)
            hal.setSolenoid(self.forwardHandle, True)
        elif value == self.Value.kReverse:
            hal.setSolenoid(self.forwardHandle, False)
            hal.setSolenoid(self.reverseHandle, True)
        else:
            raise ValueError("Invalid argument '%s'" % value)
    def set(self, value: Value) -> None:
        """Set the value of a solenoid.

        :param value: The value to set (Off, Forward, Reverse)
        """

        if value == self.Value.kOff:
            hal.setSolenoid(self.forwardHandle, False)
            hal.setSolenoid(self.reverseHandle, False)
        elif value == self.Value.kForward:
            hal.setSolenoid(self.reverseHandle, False)
            hal.setSolenoid(self.forwardHandle, True)
        elif value == self.Value.kReverse:
            hal.setSolenoid(self.forwardHandle, False)
            hal.setSolenoid(self.reverseHandle, True)
        else:
            raise ValueError("Invalid argument '%s'" % value)
    def set(self, value):
        """Set the value of a solenoid.

        :param value: The value to set (Off, Forward, Reverse)
        :type  value: :class:`DoubleSolenoid.Value`
        """

        if value == self.Value.kOff:
            hal.setSolenoid(self.forwardPort, False)
            hal.setSolenoid(self.reversePort, False)
        elif value == self.Value.kForward:
            hal.setSolenoid(self.reversePort, False)
            hal.setSolenoid(self.forwardPort, True)
        elif value == self.Value.kReverse:
            hal.setSolenoid(self.forwardPort, False)
            hal.setSolenoid(self.reversePort, True)
        else:
            raise ValueError("Invalid argument '%s'" % value)
 def set(self, on):
     print(f"Solenoid::set({on})")
     hal.setSolenoid(self.solenoidHandle, on)