Team 'Murica
/
DCMotor_Test
Reference file for DC Motor testing.
main.cpp@0:3aa70ac75ca3, 2014-10-02 (annotated)
- Committer:
- christianjaunich
- Date:
- Thu Oct 02 14:35:51 2014 +0000
- Revision:
- 0:3aa70ac75ca3
Reference File for testing
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
christianjaunich | 0:3aa70ac75ca3 | 1 | #include "mbed.h" |
christianjaunich | 0:3aa70ac75ca3 | 2 | #include "Motor.h" |
christianjaunich | 0:3aa70ac75ca3 | 3 | |
christianjaunich | 0:3aa70ac75ca3 | 4 | Motor motor1(p26,p29,p30); |
christianjaunich | 0:3aa70ac75ca3 | 5 | |
christianjaunich | 0:3aa70ac75ca3 | 6 | int main() |
christianjaunich | 0:3aa70ac75ca3 | 7 | { |
christianjaunich | 0:3aa70ac75ca3 | 8 | float motorspeed; |
christianjaunich | 0:3aa70ac75ca3 | 9 | for (motorspeed=-1.0;motorspeed<=1.0;motorspeed+=.2) |
christianjaunich | 0:3aa70ac75ca3 | 10 | { |
christianjaunich | 0:3aa70ac75ca3 | 11 | motor1.speed(motorspeed); |
christianjaunich | 0:3aa70ac75ca3 | 12 | printf("Motor speed is %.2f\n",motorspeed); |
christianjaunich | 0:3aa70ac75ca3 | 13 | getchar(); |
christianjaunich | 0:3aa70ac75ca3 | 14 | } |
christianjaunich | 0:3aa70ac75ca3 | 15 | motor1.speed(0.0); |
christianjaunich | 0:3aa70ac75ca3 | 16 | } |