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):
110
110
self .is_led_blinking = False
111
111
112
112
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
+ """
113
123
if "rgb_led" in self .__dict__ :
114
124
self .rgb_led [0 ] = (r , g , b )
115
125
self .rgb_led .write ()
Original file line number Diff line number Diff line change 2
2
3
3
class Reflectance :
4
4
5
-
6
-
7
5
_DEFAULT_REFLECTANCE_INSTANCE = None
8
6
9
7
@classmethod
Original file line number Diff line number Diff line change 1
1
from machine import Pin , PWM
2
+ import sys
2
3
3
4
class Servo :
4
5
@@ -22,11 +23,12 @@ def get_default_servo(cls, index:int):
22
23
if cls ._DEFAULT_SERVO_TWO_INSTANCE is None :
23
24
cls ._DEFAULT_SERVO_TWO_INSTANCE = cls ("SERVO_2" )
24
25
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 :
26
28
if cls ._DEFAULT_SERVO_THREE_INSTANCE is None :
27
29
cls ._DEFAULT_SERVO_THREE_INSTANCE = cls ("SERVO_3" )
28
30
servo = cls ._DEFAULT_SERVO_THREE_INSTANCE
29
- elif index == 4 :
31
+ elif index == 4 and "RP2350" in sys . implementation . _machine :
30
32
if cls ._DEFAULT_SERVO_FOUR_INSTANCE is None :
31
33
cls ._DEFAULT_SERVO_FOUR_INSTANCE = cls ("SERVO_4" )
32
34
servo = cls ._DEFAULT_SERVO_FOUR_INSTANCE
You can’t perform that action at this time.
0 commit comments