Coreonetech
/
CORE-1000_DCMotor
Reference file for DC Motor testing.
main.cpp@1:da47ec654063, 2017-02-03 (annotated)
- Committer:
- odb
- Date:
- Fri Feb 03 07:51:57 2017 +0000
- Revision:
- 1:da47ec654063
- Parent:
- 0:3aa70ac75ca3
CORE-1000 First
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 | |
odb | 1:da47ec654063 | 4 | //Motor motor1(p26,p29,p30); |
odb | 1:da47ec654063 | 5 | /* |
odb | 1:da47ec654063 | 6 | Motor motor1(PB_1,PB_14,PB_15); |
christianjaunich | 0:3aa70ac75ca3 | 7 | int main() |
christianjaunich | 0:3aa70ac75ca3 | 8 | { |
christianjaunich | 0:3aa70ac75ca3 | 9 | float motorspeed; |
christianjaunich | 0:3aa70ac75ca3 | 10 | for (motorspeed=-1.0;motorspeed<=1.0;motorspeed+=.2) |
christianjaunich | 0:3aa70ac75ca3 | 11 | { |
christianjaunich | 0:3aa70ac75ca3 | 12 | motor1.speed(motorspeed); |
christianjaunich | 0:3aa70ac75ca3 | 13 | printf("Motor speed is %.2f\n",motorspeed); |
christianjaunich | 0:3aa70ac75ca3 | 14 | getchar(); |
christianjaunich | 0:3aa70ac75ca3 | 15 | } |
christianjaunich | 0:3aa70ac75ca3 | 16 | motor1.speed(0.0); |
odb | 1:da47ec654063 | 17 | } |
odb | 1:da47ec654063 | 18 | */ |
odb | 1:da47ec654063 | 19 | |
odb | 1:da47ec654063 | 20 | |
odb | 1:da47ec654063 | 21 | DigitalOut mo_in1(PB_14); |
odb | 1:da47ec654063 | 22 | DigitalOut mo_in2(PB_15); |
odb | 1:da47ec654063 | 23 | DigitalOut mo_en(PB_1); |
odb | 1:da47ec654063 | 24 | |
odb | 1:da47ec654063 | 25 | int main(){ |
odb | 1:da47ec654063 | 26 | |
odb | 1:da47ec654063 | 27 | while(1) |
odb | 1:da47ec654063 | 28 | { |
odb | 1:da47ec654063 | 29 | mo_in1 = 0; |
odb | 1:da47ec654063 | 30 | mo_in2 = 1; |
odb | 1:da47ec654063 | 31 | mo_en = 1; |
odb | 1:da47ec654063 | 32 | } |
odb | 1:da47ec654063 | 33 | |
odb | 1:da47ec654063 | 34 | } |