CodeShare
Dependencies: Stepper_Motor_X27168 mbed
Fork of ECE_4180_Lab_4 by
main.cpp@0:71dc3ae7e2eb, 2015-10-20 (annotated)
- Committer:
- agarg45
- Date:
- Tue Oct 20 00:41:08 2015 +0000
- Revision:
- 0:71dc3ae7e2eb
Automotive Gauge Stepper Motor Demo Code ver 1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
agarg45 | 0:71dc3ae7e2eb | 1 | #include "mbed.h" |
agarg45 | 0:71dc3ae7e2eb | 2 | #include "StepperMotor_X27168.h" |
agarg45 | 0:71dc3ae7e2eb | 3 | |
agarg45 | 0:71dc3ae7e2eb | 4 | StepperMotor_X27168 smotor(p25, p26, p23, p22); |
agarg45 | 0:71dc3ae7e2eb | 5 | |
agarg45 | 0:71dc3ae7e2eb | 6 | int main() { |
agarg45 | 0:71dc3ae7e2eb | 7 | |
agarg45 | 0:71dc3ae7e2eb | 8 | smotor.step_position(180); |
agarg45 | 0:71dc3ae7e2eb | 9 | wait(0.5); |
agarg45 | 0:71dc3ae7e2eb | 10 | |
agarg45 | 0:71dc3ae7e2eb | 11 | smotor.step_position(100); |
agarg45 | 0:71dc3ae7e2eb | 12 | wait(0.5); |
agarg45 | 0:71dc3ae7e2eb | 13 | |
agarg45 | 0:71dc3ae7e2eb | 14 | smotor.angle_position(270); |
agarg45 | 0:71dc3ae7e2eb | 15 | wait(0.5); |
agarg45 | 0:71dc3ae7e2eb | 16 | |
agarg45 | 0:71dc3ae7e2eb | 17 | smotor.step_position(0); |
agarg45 | 0:71dc3ae7e2eb | 18 | wait(0.5); |
agarg45 | 0:71dc3ae7e2eb | 19 | } |