Da gibt eine ganze Menge von, Du meinst vermutlich den UNO.
Probiere mal dies:
#include <Adafruit_NeoPixel.h>
#define PIN 6
#define NUMPIXELS 2
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
#define BRIGHTNESS 50
void setup() {
pixels.begin();
pixels.setBrightness(50);
pixels.show();
}
void loop() {
if(haus(0) || haus(1)) pixels.show();
}
bool haus(byte zimmer)
{
uint32_t jetzt = millis();
static uint32_t vorhin[NUMPIXELS] = {0, 0};
const uint32_t zeit[NUMPIXELS] = {1000, 500};
static bool ANaus[NUMPIXELS] = {false, false};
const uint32_t farbe[NUMPIXELS] = {pixels.Color(0, 100, 0), pixels.Color(100, 0, 0)};
bool neu = false;
if (jetzt - vorhin[zimmer] >= zeit[zimmer])
{
if (ANaus[zimmer]) {
pixels.setPixelColor(zimmer, farbe[zimmer]);
}
else {
pixels.setPixelColor(zimmer, pixels.Color(0, 0, 0));
}
vorhin[zimmer] = jetzt;
ANaus[zimmer] = !ANaus[zimmer];
neu = true;
}
return neu;
}
Blinkt es, wie Du möchtest?