Ein Multicolor LED mit der Adafruit Library zum Leuchten bringen
Version vom 15. August 2023, 17:15 Uhr von FlorianG (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „<pre> #include <Adafruit_NeoPixel.h> // Which pin on the Arduino is connected to the NeoPixels? #define PIN 6 // On Trinket or Gemma, suggest changing this t…“)
#include <Adafruit_NeoPixel.h> // Which pin on the Arduino is connected to the NeoPixels? #define PIN 6 // On Trinket or Gemma, suggest changing this to 1 // How many NeoPixels are attached to the Arduino? #define NUMPIXELS 1 // Popular NeoPixel ring size Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); void setup() { pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED) pixels.clear(); // Set all pixel colors to 'off' } void loop() { pixels.setPixelColor(0, pixels.Color(150, 0, 0)); // red pixels.show(); // Send the updated pixel colors to the hardware. delay(1000); pixels.setPixelColor(0, pixels.Color(0, 150, 0)); // green pixels.show(); // Send the updated pixel colors to the hardware. delay(1000); pixels.setPixelColor(0, pixels.Color(0, 0, 150)); // blue pixels.show(); // Send the updated pixel colors to the hardware. delay(1000); }