// set pin numbers
const int sensorPin = 34; // the number of the pushbutton pin
const int ledRed = 14;
const int ledGreen = 26;
const int ledBlue = 25;
const float x = 0.0008122077282;
// variable for storing the pushbutton status
float sensorValue = 0;
void setup() {
Serial.begin(115200);
pinMode(sensorPin, INPUT);
pinMode(ledRed, OUTPUT);
pinMode(ledGreen, OUTPUT);
pinMode(ledBlue, OUTPUT);
// initialize the LED pin as an output
// pinMode(ledpin, OUTPUT);
}
void loop() {
// read the state of the pushbutton value
sensorValue = analogRead(sensorPin);
sensorValue *= x;
delay(500);
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH
// Serial.print(sensorValue);
// Serial.println(" Volts");
if (sensorValue <= 1.10) {
digitalWrite(ledRed, HIGH);
digitalWrite(ledGreen, LOW);
digitalWrite(ledBlue, LOW);
Serial.println("Low");
} else if ((sensorValue <= 2.10) && (sensorValue > 1.10)) {
digitalWrite(ledRed, LOW);
digitalWrite(ledGreen, LOW);
digitalWrite(ledBlue, HIGH);
Serial.println("Moderate");
} else {
digitalWrite(ledRed, LOW);
digitalWrite(ledGreen, HIGH);
digitalWrite(ledBlue, LOW);
Serial.println("Bright");
}
}