const int rgb_r = 11;
const int rgb_g = 10;
const int rgb_b = 9;
const int potr = A0;
const int potg = A1;
const int potb = A2;
int potrValue = 0;
int potgValue = 0;
int potbValue = 0;
int mappedpotrValue = 0;
int mappedpotgValue = 0;
int mappedpotbValue = 0;
void setup() {
// put your setup code here, to run once:
pinMode(rgb_r, OUTPUT);
pinMode(rgb_g, OUTPUT);
pinMode(rgb_b, OUTPUT);
pinMode(potr, INPUT);
pinMode(potg, INPUT);
pinMode(potb, INPUT);
Serial.begin(9600);
}
void setRGBColor(int r, int g, int b){
potrValue = analogRead(potr);
potgValue = analogRead(potg);
potbValue = analogRead(potb);
mappedpotrValue = map(potrValue, 0, 1023, 0, 255);
mappedpotgValue = map(potgValue, 0, 1023, 0, 255);
mappedpotbValue = map(potbValue, 0, 1023, 0, 255);
Serial.println(mappedpotrValue);
analogWrite(rgb_r, r);
analogWrite(rgb_g, g);
analogWrite(rgb_b, b);
// Učiteľov AI-sistent
// Učiteľov aisistent
// Aissess
}
void loop() {
setRGBColor(mappedpotrValue,mappedpotgValue,mappedpotbValue);
}