psieg / Lightpack

Lightpack and Prismatik open repository
GNU General Public License v3.0
1.57k stars 188 forks source link

Prismatik not working #330

Open phantom2438 opened 4 years ago

phantom2438 commented 4 years ago

Hello, I am trying to create ambient light for my pc monitor. I am using the arduino nano along with WS2812 led's. I have uploaded the this code to the arduino. /*

// Baudrate, higher rate allows faster refresh rate and more LEDs (defined in /etc/boblight.conf)

define serialRate 1500000

// Adalight sends a "Magic Word" (defined in /etc/boblight.conf) before sending the pixel data uint8_t prefix[] = {'A', 'd', 'a'}, hi, lo, chk, i;

// Initialise LED-array CRGB leds[NUM_LEDS];

void setup() { // Use NEOPIXEL to keep true colors FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);

// Initial RGB flash LEDS.showColor(CRGB(255, 0, 0)); delay(500); LEDS.showColor(CRGB(0, 255, 0)); delay(500); LEDS.showColor(CRGB(0, 0, 255)); delay(500); LEDS.showColor(CRGB(0, 0, 0));

Serial.begin(serialRate); // Send "Magic Word" string to host Serial.print("Ada\n"); }

void loop() { // Wait for first byte of Magic Word for(i = 0; i < sizeof prefix; ++i) { waitLoop: while (!Serial.available()) ;; // Check next byte in Magic Word if(prefix[i] == Serial.read()) continue; // otherwise, start over i = 0; goto waitLoop; }

// Hi, Lo, Checksum
while (!Serial.available()) ;; hi=Serial.read(); while (!Serial.available()) ;; lo=Serial.read(); while (!Serial.available()) ;; chk=Serial.read();

// If checksum does not match go back to wait if (chk != (hi ^ lo ^ 0x55)) { i=0; goto waitLoop; }

memset(leds, 0, NUM_LEDS * sizeof(struct CRGB)); // Read the transmission data and set LED values for (uint16_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; }

// Shows new values FastLED.show(); } Once the code is uploaded to the arduino all the led's flash red blue green and stop. When I go through the process of setting up Prismatik the led's do nothing. Can someone help me with this? Also I have tried using bambilight and it works but the lights are not the right color. With bambilight at one point the color on screen is blue but lights were lighting up green then at another time what was supposed to be blue would be white and another time blue would be green and green would be blue.

zomfg commented 4 years ago

are you sure your Nano can handle 1500000 baud? I'd try 115200 first (set in sketch and Prsimatik) also make sure nothing else is reading that serial port while Prismatik is running (Arduino IDE or bambilight)

phantom2438 commented 4 years ago

I'll try that thanks for help.

Kas152 commented 4 years ago

@zomfg this is indeed also specified in prismatik, but at a baudrate of 115200 there is a significant delay in the grabbing. I had to set it to 500000 to make it work properly. I do have 232 leds though..