Answer the question
In order to leave comments, you need to log in
How to control a servo from a photoresistor and a potentiometer at the same time? I want it to work from the light, or from the potentiometer?
I do not know how to properly connect the photoresistor and potentiometer to control the servo. I want the drive to be able to turn from being hit by light when it is, or from turning the knob when it is not.
Answer the question
In order to leave comments, you need to log in
This is understandable, I measured ... So I don’t understand how to write the code correctly. If not difficult, can you throw an example?
Without an example, but the essence is this:
We measure the illumination.
If it is above a certain threshold (we choose experimentally), then we convert the illumination value into a servo angle (map() function).
If the illumination value is below this threshold, then read the potentiometer and convert its values into an angle.
There is one problem: at the limit value, a situation may arise when there is a constant switching of the potentiometer-sensor, you need to foresee this.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question