Hello friends. My task is as follows. Lamps are connected in such away that there is communication between them and a keyboard. The ulimate objectibve of the system is to switch on all the lights during night and switch it off during day. A keyboard interface is also used and should be operated in such a way that pressing a specified key should ultimately turn on the required number of lights. I am using an LDr as a sensor in this circuit. and 8051 as an operating microcontroller. I have assigned port 0 to the lamps to be connected. P1.0 is given to sensor and pins from P1.1 to P1.7 are given to a keyboard. now how can i use this keyboard to turn on the required number of lights would you suggest me the algorithm for this please!