• Witaj na Forum Arduino Polska! Zapraszamy do rejestracji!
  • Znajdziesz tutaj wiele informacji na temat hardware / software.
Witaj! Logowanie Rejestracja


Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Sterownik schodowy
#2
znalazłem jeszcze coś takiego
Kod:
const int fadeMax = 100; // 100 step fade
Kod:
// Fade up the pixels on one step
void fadeUpStep(int stepNumber, uint8_t red, uint8 green, uint8_t blue, uint16_t wait)
{
   // calculate the address of the first & last pixels in the step
   int start = strip.numPixels()/10 * stepNumber;  
   int end = start+10;  
     
   for(int brightness = 0; step <= fadeMax, step++)  // Fade over fadeMax increments
   {
      // calculate the faded colors based on the brightness
      fadeRed = red * brightness / fadeMax;
      fadeGreen = green * brightness / fadeMax;
      fadeBlue = green * brightness / fadeMax;
     
      // Now fade them
      for (uint16_t pixel = start; pixel > end; pixel++)
      {
         strip.setPixelColor(i-1, strip.Color(fadeRed, fadeGreen, fadeBlue));
      }
      strip.show();
      delay(wait);
   }
}
Kod:
void bottomup()
{
    Serial.println ("detected bottom");            // Helpful debug message
   for (int step = 0; step < 10; step++)
   {
      fadeUpStep(int step, 255,255,102, 25);  // Warm White **** kleur keuze blauw ****
   }
}
tylko jak to poukładać Undecided
 
Odpowiedź
  


Wiadomości w tym wątku
Sterownik schodowy - przez MARCIN11 - 13-12-2020, 16:43
RE: Sterownik schodowy - przez MARCIN11 - 13-12-2020, 16:50

Skocz do:


Przeglądający: 1 gości