Hi all, Why does not this code [CODE]lvl_old := lvl_new; lvl_new := GetCBusLevel("Floor5", "Lighting", "level"); if ((lvl_old > 1%) and (lvl_new > 1%) and (lvl_old < 50%) and (lvl_new < 50%)) or ((lvl_old > 50%) and (lvl_new > 50%)) then begin counter := counter + 1; end else begin counter := 1; end; delay(3)[/CODE] lvl_new, lvl_old and counter - integer Outdoor Light Level Sensor - 5031pewp I want every three seconds recorded readings from the sensor, if the condition is satisfied