lab2 part7 just one pwn output to drive dc motor

Dependencies:   mbed

main.cpp

Committer:
mus3
Date:
2022-09-19
Revision:
0:ab02d26640f5

File content as of revision 0:ab02d26640f5:

#include "mbed.h"

PwmOut control(p21);
float volatile speed = 0.0f;
int main() {
    while(1) {
        for (int i = 0; i < 10; i++) {
            speed = (float) i / 10.0;
            control = speed;
            wait(1);
        }
    }
}