/* Robotika – Course 44, Lesson 2 · BONUS Three zones with if / else if / else — giving names to light levels. One sensor, three possible outcomes. When you have more than two cases, you chain them: if ... else if ... else. The FIRST match wins, so order the tests from the brightest level down. Wiring: just the light sensor (AO -> A0), like Level 1. Cover the sensor with your hand and watch the word change in the monitor. */ const int LIGHT_PIN = A0; const int BRIGHT_LEVEL = 700; // above this = bright daylight const int DIM_LEVEL = 300; // between DIM and BRIGHT = a dim room void setup() { Serial.begin(9600); } void loop() { int light = analogRead(LIGHT_PIN); Serial.print(light); Serial.print(" -> "); if (light > BRIGHT_LEVEL) { Serial.println("BRIGHT"); } else if (light > DIM_LEVEL) { Serial.println("DIM"); } else { Serial.println("DARK"); } delay(300); }