use servo motor with "for"

Dependencies:   mbed

main.cpp

Committer:
Ryuga
Date:
2019-04-06
Revision:
0:ac013d743554

File content as of revision 0:ac013d743554:

#include "mbed.h"

PwmOut servo(D10);

int main() {
    servo.period(0.020);
    while(1) {
        for(float offset = 0.0f; offset < 0.001f; offset += 0.0001f){
            servo.pulsewidth(0.001f + offset);
            wait(0.25);
        }
    }
}