Software Algorithm:

The code was written in Interactive C. Follow this link to download the code.

The Algorithm is comprised of two concurrent processes that monitor the digital values of the controls on the switch box. One process monitors Toggle A for the blind rotation functions, the other process monitors Toggle B for the up/down functions of the blinds.
When Toggle A sends a digital 1, the processor carries out the automated funtcions associated with rotation of the blinds.

get_light_reading() is called. It returns an integer value which is the average value of the four photoresistor readings. The photoresistors return a value between 0 and 255.
Every second a new value is read from the photoresistors and according to the difference between the new reading and the old reading, the stepper motor is rotated one half step in the appropriate direction. In our algorithm, the motor rotates one half step for each multiple of 5 in the difference between the old reading and the new reading, i.e, a difference of between 10 and 14 corresponds to 2 half steps, a difference of between 25 and 29 corresponds to 5 half steps.
When Toggle A sends a digital 0, the processor watches the values of buttons A1 and A2.
When these buttons are not pressed, a digital 1 is sent to the processor. When either button sends a digital 0, the stepper motor is rotated 1 full step in the direction corresponding to which button is being pressed, the open rotation button or the close rotation button.
When Toggle B sends a digital 1, nothing happens. The 2 associated push-buttons are effectively shut off.
When Toggle B sends a digital 0, the processor watches the values of buttons B1 and B2.
When either of these buttons are pressed, the two brush motors are turned on and remain on until the button is released. The buttons obviously turn the motors in opposite directions depending on which button is pushed. Also, because of the orientation of the two motors, they are sent opposite signals so that they work together to rotate the axle, not against each other.