Hi,..
I'm trying to run some servos on my yellow mBed.
I won't bore you with my code.. which is just standard servo code,
(but I don't mind sending it if it'll help)
but I can only get a servo to work, when using EXACTLY the same code for each servo on 3 of the PWM pins.
Interestingly, the three pins that are on the CTB32B0 timer work, but none of the others.
From the cookbook.. PWMOut..
CT16B0/MR0 p5 (P0_9)
CT16B0/MR1 p6 (P0_8)
CT16B0/MR2 p34 (P1_15)
CT16B1/MR0 p36 (P0_21)
CT16B1/MR1 p20 (P0_22) and p14 (P1_23)
CT32B0/MR0 p25 (P1_24)
CT32B0/MR1 p26 (P1_25) and USBTX (P0_19)
CT32B0/MR2 p10 (P1_26)
The ones that run for me..
servo1(p25);
servo2(p10);
servo3(p26);
servo4(p34); //nope
servo5(p22); //nope
servo6(p23); //nope
is this known ?
EDIT.
This code for instance, straight from the handbook, but with p34
- appears* to work as the servo sweeps, but then you realise it isn't working, as the servo just gets to it's end stop and sits there buzzing. But, change the pin to pin 10, and it's fine.
#include "mbed.h"
PwmOut servo(p34);
int main() {
servo.period(0.020); // servo requires a 20ms period
while (1) {
for(float offset=0.0; offset<0.001; offset+=0.0001) {
servo.pulsewidth(0.001 + offset); // servo position determined by a pulsewidth between 1-2ms
wait(0.25);
}
}
}
Hi,..
I'm trying to run some servos on my yellow mBed. I won't bore you with my code.. which is just standard servo code, (but I don't mind sending it if it'll help)
but I can only get a servo to work, when using EXACTLY the same code for each servo on 3 of the PWM pins.
Interestingly, the three pins that are on the CTB32B0 timer work, but none of the others.
From the cookbook.. PWMOut..
The ones that run for me..
is this known ?
EDIT.
This code for instance, straight from the handbook, but with p34