File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
examples/WebUSB/webusb_rgb Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 38
38
#endif
39
39
40
40
// How many NeoPixels are attached to the Arduino?
41
- #define NUMPIXELS 1
41
+ #define NUMPIXELS 10
42
42
43
43
// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.
44
44
// Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest
@@ -63,7 +63,7 @@ void setup()
63
63
// This initializes the NeoPixel with RED
64
64
pixels.begin ();
65
65
pixels.setBrightness (50 );
66
- pixels.setPixelColor ( 0 , 0xff0000 );
66
+ pixels.fill ( 0xff0000 );
67
67
pixels.show ();
68
68
69
69
// wait until device mounted
@@ -95,14 +95,15 @@ void loop()
95
95
uint8_t red = 16 *char2num (input[1 ]) + char2num (input[2 ]);
96
96
uint8_t green = 16 *char2num (input[3 ]) + char2num (input[4 ]);
97
97
uint8_t blue = 16 *char2num (input[5 ]) + char2num (input[6 ]);
98
-
99
- pixels.setPixelColor (0 , red, green, blue);
98
+
99
+ uint32_t color = (red << 16 ) | (green << 8 ) | blue;
100
+ pixels.fill (color);
100
101
pixels.show ();
101
102
}
102
103
103
104
void line_state_callback (bool connected)
104
105
{
105
106
// connected = green, disconnected = red
106
- pixels.setPixelColor ( 0 , connected ? 0x00ff00 : 0xff0000 );
107
+ pixels.fill ( connected ? 0x00ff00 : 0xff0000 );
107
108
pixels.show ();
108
109
}
You can’t perform that action at this time.
0 commit comments