can anyone help me in write the coding in C to control the stepper motor based on the intensity of solar energy received. project use the 4 photoresistor to compare the voltage for every output from the photoresistor circuit. used PIC 16F877A
Without knowing how your circuit is wired, It would be impossible to write your code.
But a little help.. You can use the on board ADC to get the readings from the photosensors and then use the result to vary the PWM to the stepper motor driver
Would it be sufficient just to say "If A+ > A-, run the motor at some reasonable speed"?
That makes the control algorithm very simple. Start with something to run the motor when you press a button connected to an input pin (Port B is best for this, as it has internal pullups) and then develop the control via the analog inputs.