Print rgb values from potentiometers to serial monitor?

I want to make a circiut with 3 pcs potentiometers connected to an RGB led for mixing colors and prints the rgb values to serial when i click on a button.

The circuit is simple, but how can i do that in code? Can someone give me an example that could work to give me an headstart?

Can you show us the schematic?

analogWrite (pwmPin, analogRead (potPin) /4);

Then replicate twice more.

  RedVal = analogRead (RedPotPin) /4;
  analogWrite (RedLEDPin,RedVal );
...

  if (digitalRead(ButtonPin) == LOW)
  {
    Serial.print(RedVal);
    Serial.print(", ")
    Serial.print(GreenVal);
    Serial.print(", ")
    Serial.print(BlueVal);
    Serial.println()
  }
}
1 Like

Thank you very mutch for the headstart. I will try to make something out of that code :slight_smile:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.