SHARE
TWEET

Untitled

a guest Sep 16th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <Adafruit_NeoPixel.h>
  2. #define PIN       D6
  3. #define NUMPIXELS 16
  4.  
  5. Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
  6.  
  7. /**
  8.  * Werte von 0..360 auf 0..65k mappen
  9.  */
  10. uint16_t degree2uint16(int degree) {
  11.   return degree * 65536/360;
  12. }
  13.  
  14. void setup() {
  15.   Serial.begin(9600);
  16.   pixels.begin();
  17. }
  18.  
  19. void loop() {
  20.  
  21.   for (unsigned int degree = 0; degree < 360; degree++) {
  22.  
  23.     uint16_t adafruitHueValue = degree2uint16( degree);
  24.     Serial.print(degree);
  25.     Serial.print("° = ");
  26.     Serial.println(adafruitHueValue);
  27.    
  28.     uint32_t color = pixels.ColorHSV( adafruitHueValue );
  29.     for (int i=0; i < NUMPIXELS; i++) {
  30.       pixels.setPixelColor( i,  color );
  31.     }
  32.     pixels.show();
  33.  
  34.     delay(80);
  35.   }
  36.  
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top