Example code 12
Fork of STMNucleoF401RE_ExampleCode_12_ServoMotor by
Circuito
Diff: main.cpp
- Revision:
- 3:b1a16fe3265f
- Parent:
- 2:e1a0d442f750
- Child:
- 4:bb8f5479e46c
diff -r e1a0d442f750 -r b1a16fe3265f main.cpp --- a/main.cpp Mon Nov 02 14:10:49 2015 +0000 +++ b/main.cpp Mon Feb 29 15:04:49 2016 +0000 @@ -39,6 +39,8 @@ printf("measure = %.2f mV\r\n", meas); //printf("pwm set to %.2f %%\r\n", mypwm.read() * 100); dutycycle = meas*2/1000; + // Set PWM period + mypwm.period_ms(20+dutycycle); mypwm.pulsewidth(dutycycle); } } @@ -47,8 +49,7 @@ int main() { // Set direction motordir = 1; - // Set PWM period - mypwm.period_ms(20); + // Start Thread Thread runmotor_thread(runmotor_threadfunc);