#define lue 15
#define pinR 13
#define pinG 12
#define pinB 14
int val;
void setup() {
Serial.begin(115200);
pinMode(lue, INPUT);
pinMode(pinR, OUTPUT);
pinMode(pinG, OUTPUT);
pinMode(pinB, OUTPUT);
}
void loop() {
val = analogRead(lue);
Serial.println(val);
delay(100);
if (val < 1000) {
digitalWrite(pinR, LOW);
digitalWrite(pinG, LOW);
digitalWrite(pinB, LOW);
}
if (val >= 1000 && val < 2000) {
digitalWrite(pinR, HIGH);
digitalWrite(pinG, LOW);
digitalWrite(pinB, LOW);
}
if (val >= 2000 && val < 3000) {
digitalWrite(pinR, LOW);
digitalWrite(pinG, HIGH);
digitalWrite(pinB, LOW);
}
if (val >= 3000) {
digitalWrite(pinR, LOW);
digitalWrite(pinG, LOW);
digitalWrite(pinB, HIGH);
}
}