For my first proper arduino project I wanted something that would start simple and get a little more difficult. I have some experience with electronics and a fair grasp of the language, so I figured I'd first control an RGB strip with it, then add bluetooth connectivity.
So far I'm struggling with merely controlling an rgb strip.
I've got an UNO, set up like this, but replace the pi with an UNO and the 12v dc adapter with a 9v battery and 2 AA1.5v cells in series to get 12v (This is only temporary.) Red is connected to pin 3, green to pin 5, and blue to pin 6.
If I output rgb 255,255,255 (white) I get what is visually the same as 255,0,0 (pure red)
If I output 0,255,255 I get the same result as 0,255,0 (pure green)
If I output 0,0,255 I get the correct pure blue, 0,0,255.
I've figured out through trial and error that to get what looks like white i can input (255/8,255/4,255), and to get secondary colours i can divide the red value by 4 and the green value by two, but it also seems to work with red/8 and green/4.
I'm sure there's something I'm missing here, or should be accounting for but for whatever reasons I'm missing it entirely.
If it helps, here is one of the codes I was using to control it:
#define REDPIN 3
#define GREENPIN 5
#define BLUEPIN 6
#define FADESPEED 10 // make this higher to slow down
const double redMultiplier = 0.12;
const double greenMultiplier = 0.5;
const double blueMultiplier = 1;
double brightnessMultiplier = 1;
int r = 255;
int g = 0;
int b = 255;
int rVal = 0;
int gVal = 0;
int bVal = 0;
// the setup function runs once when you press reset or power the board
void setup() {
pinMode(REDPIN, OUTPUT);
pinMode(GREENPIN, OUTPUT);
pinMode(BLUEPIN, OUTPUT);
}
// the loop function runs over and over again forever
void loop() {
rVal = r*redMultiplier*brightnessMultiplier;
gVal = g*greenMultiplier*brightnessMultiplier;
bVal = b*blueMultiplier*brightnessMultiplier;
analogWrite(REDPIN,rVal);
analogWrite(GREENPIN,gVal);
analogWrite(BLUEPIN,bVal);
}
And also the links to some of the components I'm using:
https://www.amazon.co.uk/gp/product/B00VY3ZLMO/ref=oh_aui_detailpage_o02_s00?ie=UTF8&psc=1
https://www.amazon.co.uk/gp/product/B01MPWHTF6/ref=oh_aui_detailpage_o03_s00?ie=UTF8&psc=1
https://www.amazon.co.uk/gp/product/B071VXRQYR/ref=oh_aui_detailpage_o03_s00?ie=UTF8&psc=1
Thanks in advance.