neep
Well-known member
Hi all, I'm fairly new to Arduino / Teensy but I do have a background in computer science and some electronics, from my studies long ago.
I'm working on a toy with addressable LEDs that I want to have change colors based on output from an accelerometer and a gyroscope. I have these in one MPU 6050 unit now and I'm able to read raw data, like so:
a/g: -1240 -2460 15652 48 -218 -363
a/g: -1200 -2468 15512 48 -257 -359
a/g: -1096 -2568 15600 40 -207 -363
[...]
These are accelerometer x,y,z and then gyroscope x,y,z. I understand what these values mean, but I want to make some nice color shifts with them, so that if you do this or that movement with the toy, you get a corresponding cool / fluid change in colors. I've already done this with just the accelerometer numbers of a different unit (ADXL345) and that seemed fairly straightforward. I didn't like the noisyness of it, but I suppose filters can solve that issue.
What I'm looking for is ideas for algorithms that I can let loose here, to create RGB colors, which can be 8 bits per color as I'm using a WS2801 LED strip. Since I now have 6 values to mix up it's getting a bit much. I'm not that good at math so perhaps anyone can help me out here with some formulas to try.
Thanks!
I'm working on a toy with addressable LEDs that I want to have change colors based on output from an accelerometer and a gyroscope. I have these in one MPU 6050 unit now and I'm able to read raw data, like so:
a/g: -1240 -2460 15652 48 -218 -363
a/g: -1200 -2468 15512 48 -257 -359
a/g: -1096 -2568 15600 40 -207 -363
[...]
These are accelerometer x,y,z and then gyroscope x,y,z. I understand what these values mean, but I want to make some nice color shifts with them, so that if you do this or that movement with the toy, you get a corresponding cool / fluid change in colors. I've already done this with just the accelerometer numbers of a different unit (ADXL345) and that seemed fairly straightforward. I didn't like the noisyness of it, but I suppose filters can solve that issue.
What I'm looking for is ideas for algorithms that I can let loose here, to create RGB colors, which can be 8 bits per color as I'm using a WS2801 LED strip. Since I now have 6 values to mix up it's getting a bit much. I'm not that good at math so perhaps anyone can help me out here with some formulas to try.
Thanks!