N
N
Nikitor2016-02-14 13:52:50
Arduino
Nikitor, 2016-02-14 13:52:50

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

2 answer(s)
N
Nikitor, 2016-02-14
@Nikitor

This is understandable, I measured ... So I don’t understand how to write the code correctly. If not difficult, can you throw an example?

A
Alexander Gusev, 2016-02-14
@Sanchogus

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 question

Ask a Question

731 491 924 answers to any question