NeoPixels: Sketch funktioniert leider nicht
hallo zusammen,
leider klappt es mit dem unten angegebenen scatch nicht wie gewünscht.
konkret bedeutet es, dass er im ersten if noch auf bewegung colorwipeup durchläuft, danach tut sich leider nichts mehr.
hab schon erdenklich varianten durchgespielt, aber keine lösung gefunden.
bin für jede art von hilfe dankbar!
viele grüße!
leider klappt es mit dem unten angegebenen scatch nicht wie gewünscht.
konkret bedeutet es, dass er im ersten if noch auf bewegung colorwipeup durchläuft, danach tut sich leider nichts mehr.
hab schon erdenklich varianten durchgespielt, aber keine lösung gefunden.
bin für jede art von hilfe dankbar!
viele grüße!
code: [select]
#include <adafruit_neopixel.h>
adafruit_neopixel strip = adafruit_neopixel(150, 13, neo_grb + neo_khz800);
int motionpin = 8;
int sensemotion = 0;
void setup() {
pinmode(motionpin, input);
strip.begin();
strip.show();
}
void loop() {
sensemotion = digitalread (motionpin);
if (sensemotion == high) {
colorwipeup(strip.color(255, 0, 0), 50);
strip.show();
rainbowcycle(20);
}
else {
digitalwrite (motionpin, low);
colorwipe(strip.color(0, 0, 0), 20);
strip.show();
}
}
void rainbowcycle(uint8_t wait) {
uint16_t i, j;
for(j=0; j<256*2; j++) { // 5 cycles of colors on wheel
for(i=0; i<strip.numpixels(); i++) {
strip.setpixelcolor(i, wheel(((i * 256 / strip.numpixels()) + j) & 255));
}
strip.show();
delay(20);
}
}
void colorwipe(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<strip.numpixels(); i++) {
strip.setpixelcolor(i, c);
strip.show();
delay(20);
}
}
void colorwipeup(uint32_t c, uint8_t wait) {
for(uint16_t i=strip.numpixels()-1; >= 0; i--) {
strip.setpixelcolor(i, c);
strip.show();
delay(20);
}
}
uint32_t wheel(byte wheelpos) {
wheelpos = 255 - wheelpos;
if(wheelpos < 85) {
return strip.color(255 - wheelpos * 3, 0, wheelpos * 3);
}
if(wheelpos < 170) {
wheelpos -= 85;
return strip.color(0, wheelpos * 3, 255 - wheelpos * 3);
}
wheelpos -= 170;
return strip.color(wheelpos * 3, 255 - wheelpos * 3, 0);
}
fehlt sensemotion nicht im setup-teil als out-oder input??
Arduino Forum > International > Deutsch (Moderator: uwefed) > NeoPixels: Sketch funktioniert leider nicht
arduino
Comments
Post a Comment