Hello people,
i have "create" ( copy and paste) the following program.
1 <<code>>
#include "mbed.h"
2
3 AnalogIn position(p20);
4 PwmOut servo(p21);
5
6 int main() {
7 servo.period(0.020); servo requires a 20ms period
8 while (1) {
9 servo.pulsewidth(0.001 + 0.001 * position); servo position determined by a pulsewidth between 1-2ms
10 }
11 }
<<code>>
you see here on the youtube movie this example.
http://www.youtube.com/watch?v=Kyq61sRF5Og&feature=g-upl&context=G207b7c2AUAAAAAAAAAA
if I move the Jostik to the right, goes of the Servo to the right.
if I leave the Joystik off goes of the Servo again in the middle.
If I move the Joystik to the left, goes of the Servo to the left.
and after him let go again in the middle.
how can I realise this??
I had thought,I say, with 3 V places servo on 0.0 (on the left)
With 2 V places the Servo on 0.5 (middles)
With 1 V places servo on 1.0 (on the right)
Is this thought wrong?
Hello people,
i have "create" ( copy and paste) the following program.
1
<<code>>
#include "mbed.h"2
3 AnalogIn position(p20);
4 PwmOut servo(p21);
5
6 int main() {
7 servo.period(0.020); servo requires a 20ms period
8 while (1) {
9 servo.pulsewidth(0.001 + 0.001 * position); servo position determined by a pulsewidth between 1-2ms
10 }
11 }
<<code>>
you see here on the youtube movie this example.
http://www.youtube.com/watch?v=Kyq61sRF5Og&feature=g-upl&context=G207b7c2AUAAAAAAAAAA
if I move the Jostik to the right, goes of the Servo to the right.
if I leave the Joystik off goes of the Servo again in the middle.
If I move the Joystik to the left, goes of the Servo to the left.
and after him let go again in the middle.
how can I realise this??
I had thought,I say, with 3 V places servo on 0.0 (on the left)
With 2 V places the Servo on 0.5 (middles)
With 1 V places servo on 1.0 (on the right)
Is this thought wrong?