/*
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// # # # # # ###### ####### ####### # #######
// ## ## # # ## # # # # # # # # #
// # # # # # # # # # # # # # # # # #
// # # # # # # # # # # # # # # # #####
// # # ####### # # # # # # # # ####### #
// # # # # # ## # # # # # # # #
// # # # # # # ###### ####### ####### # # #
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#include <Adafruit_NeoPixel.h>
#define LED_PIN 6
#define LED_COUNT 34
// Declare our NeoPixel strip object:
Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
// setup() function -- runs once at startup --------------------------------
void setup() {
Serial.begin(9600);
Serial.println("MZF_MODENA");
Serial.println("Addressable WS 2811");
Serial.println("by MANDOZAF");
strip.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
strip.show(); // Turn OFF all pixels ASAP
strip.setBrightness(255); // Set BRIGHTNESS to about 1/5 (max = 255)
}
// loop() function -- runs repeatedly as long as board is on ---------------
void loop() {
// strip.setPixelColor(0, strip.Color(0, 0, 255));
// strip.setPixelColor(7, strip.Color(0, 255, 0));
// strip.setPixelColor(9, strip.Color(0, 255, 0));
// strip.setPixelColor(15, strip.Color(0, 255, 0));
// strip.setPixelColor(17, strip.Color(0, 255, 0));
// strip.setPixelColor(25, strip.Color(0, 255, 0));
// strip.setPixelColor(29, strip.Color(0, 255, 0));
// strip.show();
// Fill along the length of the strip in various colors...
biru(strip.Color(0, 0, 255), 100);
hijau(strip.Color(0, 255, 0), 100);
delay(500);
clear();
delay(1000);
}
void biru(uint32_t color, int wait) {
for (int i = 0; i < 7; i++) { // For each pixel in strip...
strip.setPixelColor(i, color); // Set pixel's color (in RAM)
strip.show(); // Update strip to match
delay(wait); // Pause for a moment
}
}
void hijau(uint32_t color, int wait) {
for (int i = 0; i < 27; i++) { // For each pixel in strip...
strip.setPixelColor(i + 7, color); // Set pixel's color (in RAM)
strip.show(); // Update strip to match
delay(wait); // Pause for a moment
}
}
void clear() {
for (int i = 0; i < strip.numPixels(); i++) { // For each pixel in strip...
strip.setPixelColor(i, strip.Color(0, 0, 0)); // Set pixel's color (in RAM)
strip.show(); // Update strip to match // Pause for a moment
}
}