Project 2
/
ES200_lab2-2
DC Motor
Fork of ES200_lab2 by
Diff: main.cpp
- Revision:
- 0:0ca8b8fe09f6
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Oct 01 18:53:40 2018 +0000 @@ -0,0 +1,27 @@ +#include "mbed.h" +#include "Motor.h" + +Motor m(p26,p29,p30); +int main() +{ + float f; + for(f=.2; f<1; f+=.2) { + m.speed(f); + printf("speed is %f \n\r", f); + getchar(); + m.speed(-f); + printf("speed is - %f \n\r", f); + if(f==.8) { + break; + } + getchar(); + } + while(1) { + getchar(); + m.speed(1); + printf("speed is 1 \n\r"); + getchar(); + m.speed(-1); + printf("speed is -1 \n\r"); + } +}