|
|
10-14-2021, 10:50 AM | #1 |
Starter
Join Date: Nov 2004
Location: asdf
Casino cash: $4217963
|
This is a little difficult given the lack of context to the code. I'm assuming the outputs 3,5 & 6 are in relation to RGB color. If not disregard this message. I don't see how you would add intensity based on the pressure sensor unless it is saying pin 3 determines power. IF that is the case we want to tie that to valuer1 and I would have to have more info on how the colors are determined.
I rewrote the loop for what I think would give you a random changing light every second, but without more information on the board with regard to setting intensity, I can't help you there. void loop() { valeur1 = analogRead(A0); delay(1000); valeur2 = (200 / valeur1); //need context on what these are for valeur3 = (valeur2 * valeur2); //need context on what these are for valeur4 = random(255); // three random values. One for each RGB. If you use only one you will be limited to 255 colors. valeur5 = random(255); valeur6 = random(255); analogWrite(3,valeur4); analogWrite(5,valeur5); analogWrite(6,valeur6); } |
Posts: 509
|
|
|