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)
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())))
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))
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]
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]
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]
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())))
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))
def clear(self): """Clear the screen. """ self._modi().write( set_property(self.id, 20, bytes(2), PropertyDataType.RAW))
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]
def clear(self): self._modi().write( set_property(self.id, 20, bytes(2), PropertyDataType.RAW))
def text(self, text): self.clear() for cmd in set_property(self.id, 17, text, PropertyDataType.STRING): self._modi().write(cmd)
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]
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]
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]
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]
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]