Objekterkennung mit Adafruit – OpenMV Cam H7 + Buzzer
Schneller Einstieg in Machine Vision: Mit der OpenMV Cam H7 erkennst du farbige Objekte und gibst Feedback über einen Buzzer. Inklusive Aufbau, Schwellen-Kalibrierung und MicroPython-Code.
Baue einen leuchtenden LED-Kranz für Weihnachten: Ein NeoPixel-Ring zeigt festliche Effekte (Kerzenflackern, Regenbogen, Sternschnuppe), und per Knopfdruck wechselst du die Animation. Perfekt für Fenster, Türdeko oder Tischmitte.
Kategorie | Bauteil | SKU | Hinweis |
---|---|---|---|
Controller | Adafruit Feather RP2040 | 4884 | Arduino-kompatibel; ideal für LED-Animationen |
LED-Ring | NeoPixel Ring 24 × RGB LEDs | 1586 | Alternativ 16er-Ring 1463 (kompakter) |
Bedienung | Taster (6 mm) 20er-Pack | 367 | Ein Taster genügt, Rest als Ersatz |
Strom | 5 V 2 A Netzteil (UL) | 276 | Für helle Farbmischungen ausreichend Reserven |
Prototyping | Half-Sized Breadboard (400 Punkte) | 64 | Lötfreier Aufbau |
Verdrahtung | Premium Jumper Male/Male 40× | 758 | Für Feather ↔ Ring ↔ Taster |
// GoMaker × Adafruit — Weihnachts-NeoPixel-Kranz
// Hardware: Feather RP2040 (SKU: 4884), NeoPixel Ring 24 (SKU: 1586), Taster (SKU: 367)
// Datenpin: D6 | Button: D9 (nach GND, interner Pullup aktiv)
// Bibliothek: Adafruit_NeoPixel
#include <Adafruit_NeoPixel.h>
#define PIN_PIXELS 6
#define PIN_BUTTON 9
#define NUM_PIXELS 24
#define BRIGHTNESS 80 // 0..255 (bei USB ggf. 30..60 wählen)
Adafruit_NeoPixel strip(NUM_PIXELS, PIN_PIXELS, NEO_GRB + NEO_KHZ800);
volatile uint8_t mode = 0; // 0=Kerzenflackern, 1=Regenbogen, 2=Sternschnuppe, 3=Rot-Grün
unsigned long lastDebounce = 0;
const unsigned long debounceMs = 150;
void IRAM_ATTR onButton() {
unsigned long now = millis();
if (now - lastDebounce > debounceMs) {
mode = (mode + 1) % 4;
lastDebounce = now;
}
}
void setup() {
pinMode(PIN_BUTTON, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(PIN_BUTTON), onButton, FALLING);
strip.begin();
strip.setBrightness(BRIGHTNESS);
strip.show(); // alle aus
}
uint32_t color(uint8_t r, uint8_t g, uint8_t b) { return strip.Color(r,g,b); }
void candles(unsigned long t) {
// warmes Flackern pro Pixel
for (uint16_t i=0;iRGB Approx (Wheel)
uint8_t pos = hue >> 8;
uint32_t c;
if(pos < 85) c = color(pos*3, 255 - pos*3, 0);
else if(pos < 170){ pos -= 85; c = color(255 - pos*3, 0, pos*3); }
else { pos -= 170; c = color(0, pos*3, 255 - pos*3); }
strip.setPixelColor(i, c);
}
strip.show();
delay(15);
}
void comet(unsigned long t) {
// Sternschnuppe einmal rundum
static int head = 0;
head = (head + 1) % NUM_PIXELS;
// Nachleuchten
for (uint16_t i=0;i> 16), g = (uint8_t)(c >> 8), b = (uint8_t)c;
r = r * 200 / 255; g = g * 200 / 255; b = b * 200 / 255; // Fade
strip.setPixelColor(i, color(r,g,b));
}
// heller Kopf
strip.setPixelColor(head, color(255, 255, 180));
strip.show();
delay(25);
}
void redGreen(unsigned long t) {
// klassisch Rot/Grün im Wechsel
for (uint16_t i=0;i
BRIGHTNESS
anpassen. Für USB-Betrieb kleinere Werte (z. B. 40) wählen.0 Kommentare