*Sommer Ferien Pass 2019 Die Arduino IDE, kann von hier gezogen werden https://www.arduino.cc/ Arduino ist eine Hardware und Software Plattform, die den Einstieg in die Elektronik sowie der Programmierung erleichtert. Dazu gibt es zum einen sehr viele Libray's, die genutzt werden können um Zum Beispiel LCD, LED'S, Tasten und soweiter nutzten zu können. Zum anderen gibt es sehr viele Informationen im Netzt. In Form von Tutorials oder Dokumenationen. Es gibt auch zahlreiche Videos und Bilder. WS2812B, sind RGB LED'S von den (fast) belibig viele aneinander gehangen werden kann. Die LED'S gibt es in verschiedenen Varianten. Zum einen als Streifen, einzeln(als Pixel), als Sticks aber auch in der 5mm oder 8mm Variante. Hier kann, die Libray für die WS2812B LED'S runter geladen werden. https://learn.adafruit.com/adafruit-neopixel-uberguide/arduino-library-use Es gibt verschiedene Libray's. Digispark, sind kleine Mikrokontroller Boards, die auf ein atTiny85 oder aber auch in der Pro Variante auf den mit 6 Pins mehr ausgestatetten atTiny84 basieren. Diese Boards haben, statt 8kb nur noch ca 6 KB Flash, aber das reicht für viele Projekte. Zum Beispiel, einer Ampel Steuerung, sie können sich als USB Tastatur oder Maus ausgeben. Arduino mit DigiSpark zusammen benutzen: Voreinstellungen -> Folgendes zu den Boardmanager-URLs hinzufügen OK Werkzeuge -> Boards -> Boardmanager nach Digispark suchen Digispark AVR Boards auswählen und "Installieren" drücken Wemos D1 mini Unter Voreinstellung, zusätzlich Board, diese URL Eintragen https://github.com/espressif/arduino-esp32/blob/master/package.json Im Unter Boardmanager, dann ESP8266 oder Wemos D1 mini eingeben und das Package welches angezeigt wird, Installieren. Im Board Manager dann Wemos D1&R2 mini Auswählen. Code von Joel // A basic everyday NeoPixel strip test program. // NEOPIXEL BEST PRACTICES for most reliable operation: // - Add 1000 uF CAPACITOR between NeoPixel strip's + and - connections. // - MINIMIZE WIRING LENGTH between microcontroller board and first pixel. // - NeoPixel strip's DATA-IN should pass through a 300-500 OHM RESISTOR. // - AVOID connecting NeoPixels on a LIVE CIRCUIT. If you must, ALWAYS // connect GROUND (-) first, then +, then data. // - When using a 3.3V microcontroller with a 5V-powered NeoPixel strip, // a LOGIC-LEVEL CONVERTER on the data line is STRONGLY RECOMMENDED. // (Skipping these may work OK on your workbench but can fail in the field) #include #ifdef __AVR__ #include // Required for 16 MHz Adafruit Trinket #endif // Which pin on the Arduino is connected to the NeoPixels? // On a Trinket or Gemma we suggest changing this to 1: #define LED_PIN D3 // How many NeoPixels are attached to the Arduino? #define LED_COUNT 8 // Declare our NeoPixel strip object: Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800); // Argument 1 = Number of pixels in NeoPixel strip // Argument 2 = Arduino pin number (most are valid) // Argument 3 = Pixel type flags, add together as needed: // NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs) // NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) // NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products) // NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2) // NEO_RGBW Pixels are wired for RGBW bitstream (NeoPixel RGBW products) // setup() function -- runs once at startup -------------------------------- void setup() { // These lines are specifically to support the Adafruit Trinket 5V 16 MHz. // Any other board, you can remove this part (but no harm leaving it): #if defined(__AVR_ATtiny85__) && (F_CPU == 16000000) clock_prescale_set(clock_div_1); #endif // END of Trinket-specific code. strip.begin(); // INITIALIZE NeoPixel strip object (REQUIRED) strip.show(); // Turn OFF all pixels ASAP strip.setBrightness(451000); // Set BRIGHTNESS to about 1/5 (max = 255) } // loop() function -- runs repeatedly as long as board is on --------------- void loop() { // Fill along the length of the strip in various colors... colorWipe(strip.Color(149, 115, 1), 50); // Red delay(2500); // Pause for a moment colorWipe(strip.Color( 0, 255, 0), 50); // Green delay(2500); // Pause for a moment colorWipe(strip.Color( 0, 0, 255), 50); // Blue // Do a theater marquee effect in various colors... theaterChase(strip.Color(149, 115, 1), 100); // White, half brightness delay(1000); // Pause for a moment theaterChase(strip.Color(149, 255, 255),100); // Red, half brightness delay(1000); // Pause for a moment theaterChase(strip.Color(149, 199, 255), 100); // Blue, half brightness delay(1000); // Pause for a moment theaterChase(strip.Color(149, 167, 100), 100); // Green, half brightness delay(1000); // Pause for a moment theaterChase(strip.Color(149, 139, 75), 100); // Neo Yellow, half brightness delay(1000); // Pause for a moment theaterChase(strip.Color(149, 50, 50), 100); // Purple, half brightness delay(1000); // Pause for a moment rainbow(5); // Flowing rainbow cycle along the whole strip //theaterChaseRainbow(75); // Rainbow-enhanced theaterChase variant } // Some functions of our own for creating animated effects ----------------- // Fill strip pixels one after another with a color. Strip is NOT cleared // first; anything there will be covered pixel by pixel. Pass in color // (as a single 'packed' 32-bit value, which you can get by calling // strip.Color(red, green, blue) as shown in the loop() function above), // and a delay time (in milliseconds) between pixels. void colorWipe(uint32_t color, int wait) { for(int i=0; i RGB strip.setPixelColor(c, color); // Set pixel 'c' to value 'color' } strip.show(); // Update strip with new contents delay(wait); // Pause for a moment firstPixelHue += 65536 / 90; // One cycle of color wheel over 90 frames } } } Code von ____ ==================== #include #ifdef __AVR__ #include #endif #define LED_PIN D3 #define LED_COUNT 8 Adafruit_NeoPixel pixels(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800); void setup() { #if defined(__AVR_ATtiny85__) && (F_CPU == 16000000) clock_prescale_set(clock_div_1); #endif rainbow(10); pixels.begin(); } void loop() { ALL_LED(pixels.Color(random(255),random(255),random(255))); delay(30); ALL_LED(0); delay(30); } void ALL_LED(uint32_t color) { for (int i=0; i < 8; i++) { pixels.setPixelColor(i, color); } pixels.show(); } Code von Ron ====================