File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed
Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -110,6 +110,16 @@ def led_blink(self, frequency: int=0):
110110 self .is_led_blinking = False
111111
112112 def set_rgb_led (self , r :int , g :int , b :int ):
113+ """
114+ Sets the Neopixel RGB LED to a specified color. Throws a NotImplementedError on the XRP Beta
115+
116+ :param r: The amount of red in the desired color
117+ :type r: int
118+ :param g: The amount of green in the desired color
119+ :type g: int
120+ :param b: The amount of blue in the desired color
121+ :type b: int
122+ """
113123 if "rgb_led" in self .__dict__ :
114124 self .rgb_led [0 ] = (r , g , b )
115125 self .rgb_led .write ()
Original file line number Diff line number Diff line change 22
33class Reflectance :
44
5-
6-
75 _DEFAULT_REFLECTANCE_INSTANCE = None
86
97 @classmethod
Original file line number Diff line number Diff line change 11from machine import Pin , PWM
2+ import sys
23
34class Servo :
45
@@ -22,11 +23,12 @@ def get_default_servo(cls, index:int):
2223 if cls ._DEFAULT_SERVO_TWO_INSTANCE is None :
2324 cls ._DEFAULT_SERVO_TWO_INSTANCE = cls ("SERVO_2" )
2425 servo = cls ._DEFAULT_SERVO_TWO_INSTANCE
25- elif index == 3 :
26+ return Exception ("Invalid servo index" )
27+ elif index == 3 and "RP2350" in sys .implementation ._machine :
2628 if cls ._DEFAULT_SERVO_THREE_INSTANCE is None :
2729 cls ._DEFAULT_SERVO_THREE_INSTANCE = cls ("SERVO_3" )
2830 servo = cls ._DEFAULT_SERVO_THREE_INSTANCE
29- elif index == 4 :
31+ elif index == 4 and "RP2350" in sys . implementation . _machine :
3032 if cls ._DEFAULT_SERVO_FOUR_INSTANCE is None :
3133 cls ._DEFAULT_SERVO_FOUR_INSTANCE = cls ("SERVO_4" )
3234 servo = cls ._DEFAULT_SERVO_FOUR_INSTANCE
You can’t perform that action at this time.
0 commit comments