#include #ifdef __AVR__ #include #endif #define LED_PIN 1 // hinter LED_Pin die Nummer des Pins angeben an dem das Datenkabel der LEDs angeschlossen ist, beim ATtiny ist der obere 3. Pin die 1! #define LED_COUNT 1 // hinter LED_Count die Anzahl der LEDs angeben // vorher 40 Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800); //int Drucksensor = A0; // hinter = den Pin angeben an dem der Drucksensor angeschlossen ist int Schalter = 0; // beim ATtiny der obere ganz rechte Pin ist 0! // int StromDrucksensor = 5; // Stromzufuhr für den Drucksensor - immer auf High int Messwert; uint32_t magenta = strip.Color(0, 0, 255); // grün, rot, blau - für eingegossene WS2812b LEDs! uint32_t white = strip.Color(255, 255, 255); // weiss void setup(){ // Serial.begin(115200); #if defined(__AVR_ATtiny85__) && (F_CPU == 16000000) clock_prescale_set(clock_div_1); #endif strip.begin(); strip.show(); strip.setBrightness(60); // Helligkeit der LED einstellen (255 ist maximale Helligkeit) // pinMode(StromDrucksensor, OUTPUT); pinMode(Schalter, INPUT_PULLUP); } void loop(){ // uint32_t rgbcolor = strip.ColorHSV(hue, saturation, value); rainbow(200); // digitalWrite(StromDrucksensor, HIGH); /* Messwert = analogRead(Drucksensor); if(Messwert <= 30) { LedSchuhe(); } else { LedSchuheStatus(); } Serial.println(Messwert); */ /* Messwert = digitalRead(Schalter); if (Messwert==0) // vorher statt 0 HIGH { LedSchuhe(); } else { LedSchuheStatus(); } // Serial.println(Messwert); */ } // Rainbow cycle along whole strip. Pass delay time (in ms) between frames. void rainbow(int wait) { // Hue of first pixel runs 5 complete loops through the color wheel. // Color wheel has a range of 65536 but it's OK if we roll over, so // just count from 0 to 5*65536. Adding 256 to firstPixelHue each time // means we'll make 5*65536/256 = 1280 passes through this loop: for(long firstPixelHue = 0; firstPixelHue < 5*65536; firstPixelHue += 256) { // strip.rainbow() can take a single argument (first pixel hue) or // optionally a few extras: number of rainbow repetitions (default 1), // saturation and value (brightness) (both 0-255, similar to the // ColorHSV() function, default 255), and a true/false flag for whether // to apply gamma correction to provide 'truer' colors (default true). strip.rainbow(firstPixelHue); // Above line is equivalent to: // strip.rainbow(firstPixelHue, 1, 255, 255, true); strip.show(); // Update strip with new contents delay(wait); // Pause for a moment } } void LedSchuhe(){ strip.fill(magenta, 0, 1); // zweite Zahl von 40 auf 1 strip.show(); delay(10); strip.clear(); strip.show(); } void LedSchuheStatus(){ strip.fill(white, 0, 1); // zweite Zahl von 4 auf 1 strip.show(); delay(10); strip.clear(); strip.show(); }