For a 180 degree RC servo.. extreme 90 degrees is 1mS pulse width.. In the other direction -90 degrees is 2mS, wit 1.5mS in the center....
Oh!! yeah sorry..... If you make the delay routines yourself (As I have done ) you can pass a variable to the delay function..
If you create a delayUs() that excepts a long then you can add you ADC result to 1000.
So if your pot is tracked to one side the ADC will be zero (1000) .... If your pot is mid-way (512) the servo will go center ( 1512 ) and if the pot was at max you'll get (2024).
Just pass this
DelayUs(ADC_result + 1000);
Oh!! yeah sorry..... If you make the delay routines yourself (As I have done ) you can pass a variable to the delay function..
If you create a delayUs() that excepts a long then you can add you ADC result to 1000.
So if your pot is tracked to one side the ADC will be zero (1000) .... If your pot is mid-way (512) the servo will go center ( 1512 ) and if the pot was at max you'll get (2024).
Just pass this
DelayUs(ADC_result + 1000);
Last edited: