Hello everybody I wanted to ask you if you could help me programming a servo.
For my project Im making an evaporative cooler for class.
This machine needs two controllers, one is an automatic (directly controlled by arduino) and the second one is a manual (controlled by a potenciometer). Both selected by a switch.
For the manual I used:
valor = analogRead(potpin);
valor = map(valor, 0, 1023, 0, 180);
The code worked pretty well.
The problem is that for the automatic part I need to use numbers obtained from a equation.
I´ll give you an idea of what I did:
velocidad is a number that is obtained from different comparison between data from temperature sensors; for example, for a temperature of 25°C the number for "velocidad" is 2.3 and so on for the rest of temperatures.
After that I calculate grados using a complex equation.
grados= (8.996*pow(10,-5)velocidadpow(10,3)) + etc...
"grados" is a value that is between 60 to 110.
The value I get is the one I want to send to the servo but using the maping code doesn´t work, I did this:
Do you know if the servo code only reads values from 0 to 1023? is there another way to send integer values to the servo? or does the servo only work with potenciometer values?
Please help me!