Hello all. I am trying to setup a DIY ambilight on my mediaplayer but i just cannot get it to work. Please help.
I got a diy ambilight working on my computer. I use ambibox in combo with a arduino uno, works like a charm.
Now I want to make to make it work on my mini m8s. I use this instead of the computer with ambibox. The mini m8s is installed with libreelec, 8.2. Hyperion is installed using the tutorial on this forum. Now the problem is that it seems that the mini m8s is not sending any data to the arduino. Once booted the leds light up as in the initial boot sequence and thats about it. NO matter what I do .. it doesnt seem to work.
I use this sketch on the arduino
#include "FastLED.h"
#define NUM_LEDS 56
#define DATA_PIN 6
// Baudrate, higher rate allows faster refresh rate and more LEDs (defined in /etc/boblight.conf)
#define serialRate 115200
// 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 == 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 (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.r = r;
leds.g = g;
leds.b = b;
}
// Shows new values
FastLED.show();
}
In hyperion I use adalight as type and tried all the outputs I have. NOthing works at all. Please advice.
Thanks