File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
examples/WebUSB/webusb_rgb Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change 31
31
// Which pin on the Arduino is connected to the NeoPixels?
32
32
// On a Trinket or Gemma we suggest changing this to 1
33
33
// use on-board neopixel PIN_NEOPIXEL if existed
34
- #ifdef PIN_NEOPIXEL
35
- #define PIN PIN_NEOPIXEL
36
- #else
37
- #define PIN 8
34
+ #ifndef PIN_NEOPIXEL
35
+ #define PIN_NEOPIXEL 8
38
36
#endif
39
37
40
38
// How many NeoPixels are attached to the Arduino?
41
- #define NUMPIXELS 10
39
+ // use on-board defined NEOPIXEL_NUM if existed
40
+ #ifndef NEOPIXEL_NUM
41
+ #define NEOPIXEL_NUM 10
42
+ #endif
42
43
43
44
// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.
44
45
// Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest
45
46
// example for more information on possible values.
46
- Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN , NEO_GRB + NEO_KHZ800);
47
+ Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NEOPIXEL_NUM, PIN_NEOPIXEL , NEO_GRB + NEO_KHZ800);
47
48
48
49
// USB WebUSB object
49
50
Adafruit_USBD_WebUSB usb_web;
@@ -62,6 +63,11 @@ void setup()
62
63
Serial.begin (115200 );
63
64
64
65
// This initializes the NeoPixel with RED
66
+ #ifdef NEOPIXEL_POWER
67
+ pinMode (NEOPIXEL_POWER, OUTPUT);
68
+ digitalWrite (NEOPIXEL_POWER, NEOPIXEL_POWER_ON);
69
+ #endif
70
+
65
71
pixels.begin ();
66
72
pixels.setBrightness (50 );
67
73
pixels.fill (0xff0000 );
You can’t perform that action at this time.
0 commit comments