Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
int LEDRpin = 3;
int LEDGpin = 5;
int LEDBpin = 6;
int SVRpin = A1;
void turn(int r, int g, int b) {
analogWrite(LEDRpin, r);
analogWrite(LEDGpin, g);
analogWrite(LEDBpin, b);
void setup() {
pinMode(LEDRpin, OUTPUT);
pinMode(LEDGpin, OUTPUT);
pinMode(LEDBpin, OUTPUT);
turn(0, 0, 0);
void loop() {
int r = analogRead(SVRpin);
int v = map(r, 0, 1023, 0, 255);
turn(v, v, v);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.