I've built a webcam to Pi4 to arduino uno to WS28912b LEDS
the sketch on the arduino UNO seems very standard, i can paste the code later if you want to see it
i have got the void setup to flash 'my' sequence of lights so i know when it has 'started'
hyperian 2.0.12 reconises the webcam and the led layout, shows a nice live preview,
it also sees the adalight led contoller as usb0 of the arduino UMO baud 500000, same baud as the code
BUTU i am unsure if it ever gets to the arduino
dashboard says status = on, and when i switch LED off then on, i get my light sequence, so it runs the void setup ok
but unsure if it gets to the arduino
i have though there is only the green data wire from the arduino - do i need to connect a ground on the arduiino to... the ground on the light strip too?
i DO have a hyperian boot effect activated, (effect/led test/150000) but that doesnt show anywhere
any help appreciated
Porridge2215
Void setup is:
#include "FastLED.h"
#define NUM_LEDS 260 //Type in the number of LED's that you will use
#define DATA_PIN 6 //Type in the PWM IO Pin of the Arduino the data pin is connected to
#define COLOR_ORDER GRB
#define SerialRate 500000 //Baudrate: higher = faster refresh rate
#define zdelay 500
CRGB leds[NUM_LEDS];
uint8_t prefix[] = {'A', 'd', 'a'}, hi, lo, chk, i; //Magic Word
void setup() {
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
LEDS.showColor(CRGB(255, 0, 0)); //red
delay(zdelay);
LEDS.showColor(CRGB(0, 255, 0)); //green
delay(zdelay);
Serial.begin(SerialRate);
Serial.print("Ada\n"); // Send Magic Word string to host
}
Alles anzeigen
and main loop is straight after
void loop() {
for(i = 0; i < sizeof prefix; ++i) {
waitLoop: while (!Serial.available()) ;;
if(prefix[i] == Serial.read()) continue;
i = 0;
goto waitLoop;
}
while (!Serial.available()) ;;
hi=Serial.read();
while (!Serial.available()) ;;
lo=Serial.read();
while (!Serial.available()) ;;
chk=Serial.read();
if (chk != (hi ^ lo ^ 0x55))
{
i=0;
goto waitLoop;
}
memset(leds, 0, NUM_LEDS * sizeof(struct CRGB));
for (uint8_t i = 0; i < NUM_LEDS; i++) {
byte r, g, b;
while(!Serial.available());
r = Serial.read();
while(!Serial.available());
g = Serial.read();
while(!Serial.available());
b = Serial.read();
leds[i].r = r;
leds[i].g = g;
leds[i].b = b;
}
FastLED.show(); //Update with new values
}
Alles anzeigen