예제 #1
0
    def text(self, text):
        """
        :param text: Text to display.
        """
        self.clear()

        for cmd in set_property(self.id, 17, text, PropertyDataType.STRING):
            self._modi().write(cmd)
예제 #2
0
 def rgb(self, red=None, green=None, blue=None):
     if red == None and green == None and blue == None:
         return (self.red(), self.green(), self.blue())
     else:
         self._modi().write(
             set_property(self.id, 16,
                          (red if red != None else self.red(),
                           green if green != None else self.green(),
                           blue if blue != None else self.blue())))
예제 #3
0
 def tune(self, frequency=None, volume=None):
     if frequency == None and volume == None:
         return (self.frequency(), self.volume())
     else:
         self._modi().write(
             set_property(
                 self.id, 16,
                 (frequency if frequency != None else self.frequency(),
                  volume if volume != None else self.volume()),
                 PropertyDataType.FLOAT))
예제 #4
0
    def second_degree(self, degree=None):
        """
        :param int degree: Angle to set the second motor.

        If *degree* is ``None``,

        :return: Angle of the second motor.
        :rtype: float
        """
        if degree != None:
            self._modi().write(
                set_property(self.id, 18, (self.first_degree(), degree, 0)))
        else:
            return self._properties[PropertyType.SECOND_DEGREE]
예제 #5
0
    def second_speed(self, speed=None):
        """
        :param int degree: Angular speed to set the second motor.

        If *speed* is ``None``,

        :return: Angular speed of the second motor.
        :rtype: float
        """
        if speed != None:
            self._modi().write(
                set_property(self.id, 17, (self.first_speed(), speed, 0)))
        else:
            return self._properties[PropertyType.SECOND_SPEED]
예제 #6
0
    def first_torque(self, torque=None):
        """
        :param int degree: Torque to set the first motor.

        If *torque* is ``None``,

        :return: Torque of the first motor.
        :rtype: float
        """
        if torque != None:
            self._modi().write(
                set_property(self.id, 16, (torque, self.second_torque(), 0)))
        else:
            return self._properties[PropertyType.FIRST_TORQUE]
예제 #7
0
    def rgb(self, red=None, green=None, blue=None):
        """
        * If either *red*, *green*, or *blue* is not ``None``,

        :param int red: Red component to set or ``None``.
        :param int green: Green component to set or ``None``.
        :param int blue: Blue component to set or ``None``.

        The ``None`` component retains its previous value.

        * If *red*, *green* and *blue* are ``None``,

        :return: Tuple of red, green and blue.
        :rtype: tuple
        """
        if red == None and green == None and blue == None:
            return (self.red(), self.green(), self.blue())
        else:
            self._modi().write(
                set_property(self.id, 16,
                             (red if red != None else self.red(),
                              green if green != None else self.green(),
                              blue if blue != None else self.blue())))
예제 #8
0
    def tune(self, frequency=None, volume=None):
        """
        * If either *frequency* or *volume* is not ``None``,

        :param float frequency: Frequency to set or ``None``.
        :param float volume: Volume to set or ``None``.

        The ``None`` component retains its previous value.

        * If *frequency* and *volume* are ``None``,

        :return: Tuple of frequency and volume.
        :rtype: tuple
        """
        if frequency == None and volume == None:
            return (self.frequency(), self.volume())
        else:
            self._modi().write(
                set_property(
                    self.id, 16,
                    (frequency if frequency != None else self.frequency(),
                     volume if volume != None else self.volume()),
                    PropertyDataType.FLOAT))
예제 #9
0
 def clear(self):
     """Clear the screen.
     """
     self._modi().write(
         set_property(self.id, 20, bytes(2), PropertyDataType.RAW))
예제 #10
0
 def first_speed(self, speed=None):
     if speed != None:
         self._modi().write(
             set_property(self.id, 17, (speed, self.second_speed(), 0)))
     else:
         return self._properties[PropertyType.FIRST_SPEED]
예제 #11
0
 def clear(self):
     self._modi().write(
         set_property(self.id, 20, bytes(2), PropertyDataType.RAW))
예제 #12
0
    def text(self, text):
        self.clear()

        for cmd in set_property(self.id, 17, text, PropertyDataType.STRING):
            self._modi().write(cmd)
예제 #13
0
 def first_degree(self, degree=None):
     if degree != None:
         self._modi().write(
             set_property(self.id, 18, (degree, self.second_degree(), 0)))
     else:
         return self._properties[PropertyType.FIRST_DEGREE]
예제 #14
0
 def second_torque(self, torque=None):
     if torque != None:
         self._modi().write(
             set_property(self.id, 16, (self.first_torque(), torque, 0)))
     else:
         return self._properties[PropertyType.SECOND_TORQUE]
예제 #15
0
 def first_torque(self, torque=None):
     if torque != None:
         self._modi().write(
             set_property(self.id, 16, (torque, self.second_torque(), 0)))
     else:
         return self._properties[PropertyType.FIRST_TORQUE]
예제 #16
0
 def second_speed(self, speed=None):
     if speed != None:
         self._modi().write(
             set_property(self.id, 17, (self.first_speed(), speed, 0)))
     else:
         return self._properties[PropertyType.SECOND_SPEED]
예제 #17
0
 def second_degree(self, degree=None):
     if degree != None:
         self._modi().write(
             set_property(self.id, 18, (self.first_degree(), degree, 0)))
     else:
         return self._properties[PropertyType.SECOND_DEGREE]