mbed school
/
mbed_DCMotor_test
DC Motor test
main.cpp@0:c964b537b7ff, 2015-02-05 (annotated)
- Committer:
- mbedschool
- Date:
- Thu Feb 05 12:57:10 2015 +0000
- Revision:
- 0:c964b537b7ff
test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbedschool | 0:c964b537b7ff | 1 | #include "mbed.h" |
mbedschool | 0:c964b537b7ff | 2 | #include "Motor.h" |
mbedschool | 0:c964b537b7ff | 3 | |
mbedschool | 0:c964b537b7ff | 4 | Motor motor1(p26,p29,p30); |
mbedschool | 0:c964b537b7ff | 5 | |
mbedschool | 0:c964b537b7ff | 6 | int main() |
mbedschool | 0:c964b537b7ff | 7 | { |
mbedschool | 0:c964b537b7ff | 8 | float motorspeed; |
mbedschool | 0:c964b537b7ff | 9 | for (motorspeed=-1.0;motorspeed<=1.0;motorspeed+=.2) |
mbedschool | 0:c964b537b7ff | 10 | { |
mbedschool | 0:c964b537b7ff | 11 | motor1.speed(motorspeed); |
mbedschool | 0:c964b537b7ff | 12 | printf("Motor speed is %.2f\n",motorspeed); |
mbedschool | 0:c964b537b7ff | 13 | getchar(); |
mbedschool | 0:c964b537b7ff | 14 | } |
mbedschool | 0:c964b537b7ff | 15 | motor1.speed(0.0); |
mbedschool | 0:c964b537b7ff | 16 | } |