-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNexopixel3322PLUTO.ino
43 lines (38 loc) · 1.1 KB
/
Nexopixel3322PLUTO.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* Created by ArduinoGetStarted.com
*
* This example code is in the public domain
*
* Tutorial page: https://arduinogetstarted.com/tutorials/arduino-neopixel-led-strip
*/
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif
#define PIN_NEO_PIXEL 8 // Arduino pin that connects to NeoPixel
#define NUM_PIXELS 150 // The number of LEDs (pixels) on NeoPixel
#define DELAY_INTERVAL 2000 // 250ms pause between each pixel
Adafruit_NeoPixel NeoPixel(NUM_PIXELS, PIN_NEO_PIXEL, NEO_GRB + NEO_KHZ800);
void setup() {
NeoPixel.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
NeoPixel.setBrightness(1000000);
pinMode(40, INPUT); // Digital port #40 on the Arduino
}
// method to set and show every LEDS
void setLed(int r, int g, int b){
for (int pixel = 0; pixel < NUM_PIXELS; pixel++) {
NeoPixel.setPixelColor(pixel, NeoPixel.Color(r, g, b));
}
NeoPixel.show();
}
void loop() {
if(digitalRead(40) == HIGH){
setLed(0,255,0);
delay(200);
setLed(0,0,0);
delay(200);
}
else{
showLed(0,150,255);
}
}