Research Article

The Design and Comparison of Central and Distributed Light Sensored Smart LED Lighting Systems

Pseudocode 1

Pseudocode of the control algorithm for the central sensor smart lighting system.
#define Default_Room_Reference_Light
Room_Reference_Light=User_Preference
Light=Light_From_ADC_Lightsensor
Presence_Sensor=Presence_From_Timer
if presence =1      //presence is sensed
smart_lightingt=1;     // start the saving system
else
smart_lighting=0;
end if
while smart_lighting=1 do
Measure_Light
error=Room_Reference_Light-Measure_Light1
if error>hysteresis then     //adjust lighting level
PWM=PWM-I;
else
PWM=PWM+I;
end if
end while