Hey guys hows it going,
I'm currently using my Bean+ to control the colour of my analog led strip (all leds change at the same time).
I have a sketch working that is basically an expansion on the AcceletionLED example that sends Rgb out through individual pins to the strip, so you can use that sketch on your bean to compare results.
I was wondering if anyone could help me with a few changes I want to make:
I want to smooth the colour changes so its less jumpy, the changes are really fast and look stepped. Doesn't look too good when the bean is jolted and it flickers. This happens on the AccelerationLed example too, not just my setup.
Maybe a delay between the acceleration data and the colour out?
I also want to have the LEDs only output different shades of red. So it still shifts with the movement but stays within the a colour range.
I need some guidance on Bean to Bean communication, and whether it's possible to have the acceleration data from one bean be sent to another to control the led colours. (Might make a new thread for this)
Sorry for the list haha, here's the sketch I have currently:
#define REDPIN 5
#define GREENPIN 6
#define BLUEPIN 7
void setup() {
pinMode(REDPIN, OUTPUT);
pinMode(GREENPIN, OUTPUT);
pinMode(BLUEPIN, OUTPUT);
}
void loop() {
//int r, g, b;
// Get the current acceleration with range of ±2g,
// and a conversion of 3.91×10-3 g/unit or 0.03834(m/s^2)/units.
AccelerationReading accel = Bean.getAcceleration();
// Update LED color
uint16_t r = (abs(accel.xAxis)) / 4;
uint16_t g = (abs(accel.yAxis)) / 4;
uint16_t b = (abs(accel.zAxis)) / 4;
analogWrite(REDPIN, r);
analogWrite(BLUEPIN, b);
analogWrite(GREENPIN, g);
Cheers 