I made a servo tester with the LM555 (link below). It works great. Now, I want to read the position of the servo with the arduino. One idea i have is to read the pulse width from the lm555.. ex 1ms = 90deg, 1.5 = 0 deg...etc
How can I do that???
Controlling the servo on the arduino is not an option.
The servo uses a fixed frequency, with the High time determining where the servo moves to.
So you could measure the High time, the Low time, and determine the commanded position from there.
High + Low should equal 20mS, with High varying from 0.5mS (500uS) to 2.5mS (2500uS)
The servo uses a fixed frequency, with the High time determining where the servo moves to.
So you could measure the High time, the Low time, and determine the commanded position from there.
High + Low should equal 20mS, with High varying from 0.5mS (500uS) to 2.5mS (2500uS)
Than you. Will this code be more efficient because is using interrupts instead:
External Interrupts
volatile int pwm_value = 0;
volatile int prev_time = 0;
void setup() {
Serial.begin(115200);
// when pin D2 goes high, call the rising function
attachInterrupt(0, rising, RISING);
}
And do please read the instructions, then go back and modify your post to mark up the code as such - and any other code you post - so we can examine it comfortably and reliably.