Skip to main content
. 2015 Jul 6;15(7):16314–16335. doi: 10.3390/s150716314
public static void RestoreLightintensity () {
 ComputeLightintensity((light_intensity_Min + light_intensity_Max) / 2);
}
public static void ComputeLightintensity(int lum) {
 final int minLum = 100;
 final int maxLum = 400;
 final int minLumNight = 30;
 final float divisor = (maxLum - minLum) / 100;
 float light = (maxLum - lum) / divisor;
 SimpleDateFormat ft = new SimpleDateFormat (“HH”);
 Date dNow = new Date ();
 int daytime = Integer.parselnt(ft.format(dNow));
 //compute the correct lamp brightness accordingly to the time
 if (daytime >= 20 ‖ daytime < 6) {
  if (daytime >= 2 & daytime < 6)
   light = 30;
  else if (light < minLumNight)
   light = minLumNight;
 }
 else if (lum <= minLum)
  light = 100;
 else if (lum > maxLum)
  light = 0;
 // Set lamp brightness to light percentage
 Reguest(“http://212.189.207.109:8888/command/?board=boardnamel&command=analog&pin=Pll&val=“; + light);
}