ähnlich wie beim „analogen“ Termometer, nur in Rund…
Bilder
Arduino Code
#include <Adafruit_NeoPixel.h> #define Pin_Windrose 2 Adafruit_NeoPixel Windrose = Adafruit_NeoPixel(16, Pin_Windrose, NEO_GRB + NEO_KHZ800); void setup() { Windrose.begin(); Windrose.show(); } void loop() { LED_Windrose(); } void LED_Windrose() { int Wind3 = Windrichtung; //Windrichtung auslesen Serial.println(Wind3); if (Wind3 < 11) { Windrose.setPixelColor(0, 128, 0, 0); Windrose.setPixelColor(1, 0, 0, 0); Windrose.setPixelColor(2, 0, 0, 0); Windrose.setPixelColor(3, 0, 0, 0); Windrose.setPixelColor(4, 0, 0, 0); Windrose.setPixelColor(5, 0, 0, 0); Windrose.setPixelColor(6, 0, 0, 0); Windrose.setPixelColor(7, 0, 0, 0); Windrose.setPixelColor(8, 0, 0, 0); Windrose.setPixelColor(9, 0, 0, 0); Windrose.setPixelColor(10, 0, 0, 0); Windrose.setPixelColor(11, 0, 0, 0); Windrose.setPixelColor(12, 0, 0, 0); Windrose.setPixelColor(13, 0, 0, 0); Windrose.setPixelColor(14, 0, 0, 0); Windrose.setPixelColor(15, 0, 0, 0); Windrose.show(); Serial.println("N"); } if (Wind3 >= 11 && Wind3 < 33) { Windrose.setPixelColor(0, 0, 0, 0); Windrose.setPixelColor(1, 128, 0, 0); Windrose.setPixelColor(2, 0, 0, 0); Windrose.setPixelColor(3, 0, 0, 0); Windrose.setPixelColor(4, 0, 0, 0); Windrose.setPixelColor(5, 0, 0, 0); Windrose.setPixelColor(6, 0, 0, 0); Windrose.setPixelColor(7, 0, 0, 0); Windrose.setPixelColor(8, 0, 0, 0); Windrose.setPixelColor(9, 0, 0, 0); Windrose.setPixelColor(10, 0, 0, 0); Windrose.setPixelColor(11, 0, 0, 0); Windrose.setPixelColor(12, 0, 0, 0); Windrose.setPixelColor(13, 0, 0, 0); Windrose.setPixelColor(14, 0, 0, 0); Windrose.setPixelColor(15, 0, 0, 0); Windrose.show(); Serial.println("NNO"); } if (Wind3 >= 33 && Wind3 < 56) { Windrose.setPixelColor(0, 0, 0, 0); Windrose.setPixelColor(1, 0, 0, 0); Windrose.setPixelColor(2, 255, 0, 0); Windrose.setPixelColor(3, 0, 0, 0); Windrose.setPixelColor(4, 0, 0, 0); Windrose.setPixelColor(5, 0, 0, 0); Windrose.setPixelColor(6, 0, 0, 0); Windrose.setPixelColor(7, 0, 0, 0); Windrose.setPixelColor(8, 0, 0, 0); Windrose.setPixelColor(9, 0, 0, 0); Windrose.setPixelColor(10, 0, 0, 0); Windrose.setPixelColor(11, 0, 0, 0); Windrose.setPixelColor(12, 0, 0, 0); Windrose.setPixelColor(13, 0, 0, 0); Windrose.setPixelColor(14, 0, 0, 0); Windrose.setPixelColor(15, 0, 0, 0); Windrose.show(); Serial.println("NO"); } if (Wind3 >= 56 && Wind3 < 78) { Windrose.setPixelColor(0, 0, 0, 0); Windrose.setPixelColor(1, 0, 0, 0); Windrose.setPixelColor(2, 0, 0, 0); Windrose.setPixelColor(3, 255, 0, 0); Windrose.setPixelColor(4, 0, 0, 0); Windrose.setPixelColor(5, 0, 0, 0); Windrose.setPixelColor(6, 0, 0, 0); Windrose.setPixelColor(7, 0, 0, 0); Windrose.setPixelColor(8, 0, 0, 0); Windrose.setPixelColor(9, 0, 0, 0); Windrose.setPixelColor(10, 0, 0, 0); Windrose.setPixelColor(11, 0, 0, 0); Windrose.setPixelColor(12, 0, 0, 0); Windrose.setPixelColor(13, 0, 0, 0); Windrose.setPixelColor(14, 0, 0, 0); Windrose.setPixelColor(15, 0, 0, 0); Windrose.show(); Serial.println("ONO"); } if (Wind3 >= 78 && Wind3 < 101) { Windrose.setPixelColor(0, 0, 0, 0); Windrose.setPixelColor(1, 0, 0, 0); Windrose.setPixelColor(2, 0, 0, 0); Windrose.setPixelColor(3, 0, 0, 0); Windrose.setPixelColor(4, 255, 0, 0); Windrose.setPixelColor(5, 0, 0, 0); Windrose.setPixelColor(6, 0, 0, 0); Windrose.setPixelColor(7, 0, 0, 0); Windrose.setPixelColor(8, 0, 0, 0); Windrose.setPixelColor(9, 0, 0, 0); Windrose.setPixelColor(10, 0, 0, 0); Windrose.setPixelColor(11, 0, 0, 0); Windrose.setPixelColor(12, 0, 0, 0); Windrose.setPixelColor(13, 0, 0, 0); Windrose.setPixelColor(14, 0, 0, 0); Windrose.setPixelColor(15, 0, 0, 0); Windrose.show(); Serial.println("O"); } if (Wind3 >= 101 && Wind3 < 123) { Windrose.setPixelColor(0, 0, 0, 0); Windrose.setPixelColor(1, 0, 0, 0); Windrose.setPixelColor(2, 0, 0, 0); Windrose.setPixelColor(3, 0, 0, 0); Windrose.setPixelColor(4, 0, 0, 0); Windrose.setPixelColor(5, 255, 0, 0); Windrose.setPixelColor(6, 0, 0, 0); Windrose.setPixelColor(7, 0, 0, 0); Windrose.setPixelColor(8, 0, 0, 0); Windrose.setPixelColor(9, 0, 0, 0); Windrose.setPixelColor(10, 0, 0, 0); Windrose.setPixelColor(11, 0, 0, 0); Windrose.setPixelColor(12, 0, 0, 0); Windrose.setPixelColor(13, 0, 0, 0); Windrose.setPixelColor(14, 0, 0, 0); Windrose.setPixelColor(15, 0, 0, 0); Windrose.show(); Serial.println("OSO"); } if (Wind3 >= 123 && Wind3 < 146) { Windrose.setPixelColor(0, 0, 0, 0); Windrose.setPixelColor(1, 0, 0, 0); Windrose.setPixelColor(2, 0, 0, 0); Windrose.setPixelColor(3, 0, 0, 0); Windrose.setPixelColor(4, 0, 0, 0); Windrose.setPixelColor(5, 0, 0, 0); Windrose.setPixelColor(6, 255, 0, 0); Windrose.setPixelColor(7, 0, 0, 0); Windrose.setPixelColor(8, 0, 0, 0); Windrose.setPixelColor(9, 0, 0, 0); Windrose.setPixelColor(10, 0, 0, 0); Windrose.setPixelColor(11, 0, 0, 0); Windrose.setPixelColor(12, 0, 0, 0); Windrose.setPixelColor(13, 0, 0, 0); Windrose.setPixelColor(14, 0, 0, 0); Windrose.setPixelColor(15, 0, 0, 0); Windrose.show(); Serial.println("SO"); } if (Wind3 >= 146 && Wind3 < 168) { Windrose.setPixelColor(0, 0, 0, 0); Windrose.setPixelColor(1, 0, 0, 0); Windrose.setPixelColor(2, 0, 0, 0); Windrose.setPixelColor(3, 0, 0, 0); Windrose.setPixelColor(4, 0, 0, 0); Windrose.setPixelColor(5, 0, 0, 0); Windrose.setPixelColor(6, 0, 0, 0); Windrose.setPixelColor(7, 255, 0, 0); Windrose.setPixelColor(8, 0, 0, 0); Windrose.setPixelColor(9, 0, 0, 0); Windrose.setPixelColor(10, 0, 0, 0); Windrose.setPixelColor(11, 0, 0, 0); Windrose.setPixelColor(12, 0, 0, 0); Windrose.setPixelColor(13, 0, 0, 0); Windrose.setPixelColor(14, 0, 0, 0); Windrose.setPixelColor(15, 0, 0, 0); Windrose.show(); Serial.println("SSO"); } if (Wind3 >= 168 && Wind3 < 191) { Windrose.setPixelColor(0, 0, 0, 0); Windrose.setPixelColor(1, 0, 0, 0); Windrose.setPixelColor(2, 0, 0, 0); Windrose.setPixelColor(3, 0, 0, 0); Windrose.setPixelColor(4, 0, 0, 0); Windrose.setPixelColor(5, 0, 0, 0); Windrose.setPixelColor(6, 0, 0, 0); Windrose.setPixelColor(7, 0, 0, 0); Windrose.setPixelColor(8, 255, 0, 0); Windrose.setPixelColor(9, 0, 0, 0); Windrose.setPixelColor(10, 0, 0, 0); Windrose.setPixelColor(11, 0, 0, 0); Windrose.setPixelColor(12, 0, 0, 0); Windrose.setPixelColor(13, 0, 0, 0); Windrose.setPixelColor(14, 0, 0, 0); Windrose.setPixelColor(15, 0, 0, 0); Windrose.show(); Serial.println("S"); } if (Wind3 >= 191 && Wind3 < 213) { Windrose.setPixelColor(0, 0, 0, 0); Windrose.setPixelColor(1, 0, 0, 0); Windrose.setPixelColor(2, 0, 0, 0); Windrose.setPixelColor(3, 0, 0, 0); Windrose.setPixelColor(4, 0, 0, 0); Windrose.setPixelColor(5, 0, 0, 0); Windrose.setPixelColor(6, 0, 0, 0); Windrose.setPixelColor(7, 0, 0, 0); Windrose.setPixelColor(8, 0, 0, 0); Windrose.setPixelColor(9, 255, 0, 0); Windrose.setPixelColor(10, 0, 0, 0); Windrose.setPixelColor(11, 0, 0, 0); Windrose.setPixelColor(12, 0, 0, 0); Windrose.setPixelColor(13, 0, 0, 0); Windrose.setPixelColor(14, 0, 0, 0); Windrose.setPixelColor(15, 0, 0, 0); Windrose.show(); Serial.println("SSW"); } if (Wind3 >= 213 && Wind3 < 236) { Windrose.setPixelColor(0, 0, 0, 0); Windrose.setPixelColor(1, 0, 0, 0); Windrose.setPixelColor(2, 0, 0, 0); Windrose.setPixelColor(3, 0, 0, 0); Windrose.setPixelColor(4, 0, 0, 0); Windrose.setPixelColor(5, 0, 0, 0); Windrose.setPixelColor(6, 0, 0, 0); Windrose.setPixelColor(7, 0, 0, 0); Windrose.setPixelColor(8, 0, 0, 0); Windrose.setPixelColor(9, 0, 0, 0); Windrose.setPixelColor(10, 255, 0, 0); Windrose.setPixelColor(11, 0, 0, 0); Windrose.setPixelColor(12, 0, 0, 0); Windrose.setPixelColor(13, 0, 0, 0); Windrose.setPixelColor(14, 0, 0, 0); Windrose.setPixelColor(15, 0, 0, 0); Windrose.show(); Serial.println("SW"); } if (Wind3 >= 236 && Wind3 < 258) { Windrose.setPixelColor(0, 0, 0, 0); Windrose.setPixelColor(1, 0, 0, 0); Windrose.setPixelColor(2, 0, 0, 0); Windrose.setPixelColor(3, 0, 0, 0); Windrose.setPixelColor(4, 0, 0, 0); Windrose.setPixelColor(5, 0, 0, 0); Windrose.setPixelColor(6, 0, 0, 0); Windrose.setPixelColor(7, 0, 0, 0); Windrose.setPixelColor(8, 0, 0, 0); Windrose.setPixelColor(9, 0, 0, 0); Windrose.setPixelColor(10, 0, 0, 0); Windrose.setPixelColor(11, 255, 0, 0); Windrose.setPixelColor(12, 0, 0, 0); Windrose.setPixelColor(13, 0, 0, 0); Windrose.setPixelColor(14, 0, 0, 0); Windrose.setPixelColor(15, 0, 0, 0); Windrose.show(); Serial.println("WSW"); } if (Wind3 >= 258 && Wind3 < 281) { Windrose.setPixelColor(0, 0, 0, 0); Windrose.setPixelColor(1, 0, 0, 0); Windrose.setPixelColor(2, 0, 0, 0); Windrose.setPixelColor(3, 0, 0, 0); Windrose.setPixelColor(4, 0, 0, 0); Windrose.setPixelColor(5, 0, 0, 0); Windrose.setPixelColor(6, 0, 0, 0); Windrose.setPixelColor(7, 0, 0, 0); Windrose.setPixelColor(8, 0, 0, 0); Windrose.setPixelColor(9, 0, 0, 0); Windrose.setPixelColor(10, 0, 0, 0); Windrose.setPixelColor(11, 0, 0, 0); Windrose.setPixelColor(12, 255, 0, 0); Windrose.setPixelColor(13, 0, 0, 0); Windrose.setPixelColor(14, 0, 0, 0); Windrose.setPixelColor(15, 0, 0, 0); Windrose.show(); Serial.println("W"); } if (Wind3 >= 281 && Wind3 < 303) { Windrose.setPixelColor(0, 0, 0, 0); Windrose.setPixelColor(1, 0, 0, 0); Windrose.setPixelColor(2, 0, 0, 0); Windrose.setPixelColor(3, 0, 0, 0); Windrose.setPixelColor(4, 0, 0, 0); Windrose.setPixelColor(5, 0, 0, 0); Windrose.setPixelColor(6, 0, 0, 0); Windrose.setPixelColor(7, 0, 0, 0); Windrose.setPixelColor(8, 0, 0, 0); Windrose.setPixelColor(9, 0, 0, 0); Windrose.setPixelColor(10, 0, 0, 0); Windrose.setPixelColor(11, 0, 0, 0); Windrose.setPixelColor(12, 0, 0, 0); Windrose.setPixelColor(13, 255, 0, 0); Windrose.setPixelColor(14, 0, 0, 0); Windrose.setPixelColor(15, 0, 0, 0); Windrose.show(); Serial.println("WNW"); } if (Wind3 >= 303 && Wind3 < 326) { Windrose.setPixelColor(0, 0, 0, 0); Windrose.setPixelColor(1, 0, 0, 0); Windrose.setPixelColor(2, 0, 0, 0); Windrose.setPixelColor(3, 0, 0, 0); Windrose.setPixelColor(4, 0, 0, 0); Windrose.setPixelColor(5, 0, 0, 0); Windrose.setPixelColor(6, 0, 0, 0); Windrose.setPixelColor(7, 0, 0, 0); Windrose.setPixelColor(8, 0, 0, 0); Windrose.setPixelColor(9, 0, 0, 0); Windrose.setPixelColor(10, 0, 0, 0); Windrose.setPixelColor(11, 0, 0, 0); Windrose.setPixelColor(12, 0, 0, 0); Windrose.setPixelColor(13, 0, 0, 0); Windrose.setPixelColor(14, 255, 0, 0); Windrose.setPixelColor(15, 0, 0, 0); Windrose.show(); Serial.println("NW"); } if (Wind3 >= 326 && Wind3 < 348) { Windrose.setPixelColor(0, 0, 0, 0); Windrose.setPixelColor(1, 0, 0, 0); Windrose.setPixelColor(2, 0, 0, 0); Windrose.setPixelColor(3, 0, 0, 0); Windrose.setPixelColor(4, 0, 0, 0); Windrose.setPixelColor(5, 0, 0, 0); Windrose.setPixelColor(6, 0, 0, 0); Windrose.setPixelColor(7, 0, 0, 0); Windrose.setPixelColor(8, 0, 0, 0); Windrose.setPixelColor(9, 0, 0, 0); Windrose.setPixelColor(10, 0, 0, 0); Windrose.setPixelColor(11, 0, 0, 0); Windrose.setPixelColor(12, 0, 0, 0); Windrose.setPixelColor(13, 0, 0, 0); Windrose.setPixelColor(14, 0, 0, 0); Windrose.setPixelColor(15, 255, 0, 0); Windrose.show(); Serial.println("NNW"); } if (Wind3 >= 348) { Windrose.setPixelColor(0, 255, 0, 0); Windrose.setPixelColor(1, 0, 0, 0); Windrose.setPixelColor(2, 0, 0, 0); Windrose.setPixelColor(3, 0, 0, 0); Windrose.setPixelColor(4, 0, 0, 0); Windrose.setPixelColor(5, 0, 0, 0); Windrose.setPixelColor(6, 0, 0, 0); Windrose.setPixelColor(7, 0, 0, 0); Windrose.setPixelColor(8, 0, 0, 0); Windrose.setPixelColor(9, 0, 0, 0); Windrose.setPixelColor(10, 0, 0, 0); Windrose.setPixelColor(11, 0, 0, 0); Windrose.setPixelColor(12, 0, 0, 0); Windrose.setPixelColor(13, 0, 0, 0); Windrose.setPixelColor(14, 0, 0, 0); Windrose.setPixelColor(15, 0, 0, 0); Windrose.show(); Serial.println("N"); } }
Bezugsquellen
Amazon – NeoPixel Ring – 16 LEDs