//pot = potentiometer
const int potR = A0;
const int potG = A1;
const int potB = A2;
//led = light-emitting diode
const int ledR = 6;
const int ledG = 5;
const int ledB = 3;
//val = value
int valR;
int valG;
int valB;
void setup() {
// put your setup code here, to run once:
}
void loop() {
//Aufgabe 3 a)
//R = 254
//G = 125
//B = 1
valR = 254;
valG = 125;
valB = 1;
analogWrite(ledR, valR);
analogWrite(ledG, valG);
analogWrite(ledB, valB);
//set_collor_RGB(analogRead(potR), analogRead(potG), analogRead(potB));
}
void set_collor_RGB(int R_Value, int G_Value, int B_Value) {
// color or colour ('merica, UK)
int valR = map(R_Value, 0, 1023, 0, 255);
int valG = map(G_Value, 0, 1023, 0, 255);
int valB = map(B_Value, 0, 1023, 0, 255);
//PWM Magic:
//analogWrite(255) requests a 100% duty cycle (always on)
//analogWrite(127) is a 50% duty cycle (on half the time) for example.
// from: https://docs.arduino.cc/learn/microcontrollers/analog-output
analogWrite(ledR, valR);
analogWrite(ledG, valG);
analogWrite(ledB, valB);
}