![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
For Hamza
Dependencies: StepperMotorUni StepperMotorUni_Hello mbed
Fork of StepperMotorUni_Hello by
main.cpp@1:80c512ccd0f2, 2015-04-22 (annotated)
- Committer:
- okano
- Date:
- Wed Apr 22 03:26:01 2015 +0000
- Revision:
- 1:80c512ccd0f2
- Parent:
- 0:ae2206213141
- Child:
- 2:21d312d28d45
to include latest library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
okano | 0:ae2206213141 | 1 | /** "Hello" program for StepperMotorUni class library |
okano | 0:ae2206213141 | 2 | * |
okano | 0:ae2206213141 | 3 | * very simple sample of "StepperMotorUni" operation |
okano | 0:ae2206213141 | 4 | * |
okano | 0:ae2206213141 | 5 | * version 1.0 |
okano | 0:ae2206213141 | 6 | * copyright: 2014 Tedd OKANO |
okano | 0:ae2206213141 | 7 | * released under the Apache 2 license License |
okano | 0:ae2206213141 | 8 | */ |
okano | 0:ae2206213141 | 9 | |
okano | 0:ae2206213141 | 10 | #include "mbed.h" |
okano | 0:ae2206213141 | 11 | #include "StepperMotorUni.h" |
okano | 0:ae2206213141 | 12 | |
okano | 0:ae2206213141 | 13 | StepperMotorUni motor( p26, p25, p24, p23 ); |
okano | 0:ae2206213141 | 14 | |
okano | 0:ae2206213141 | 15 | int main() |
okano | 0:ae2206213141 | 16 | { |
okano | 1:80c512ccd0f2 | 17 | motor.set_operation_phase_mode( StepperMotorUni::HALFSTEP ); |
okano | 1:80c512ccd0f2 | 18 | motor.set_pps( 200 ); |
okano | 0:ae2206213141 | 19 | |
okano | 0:ae2206213141 | 20 | while ( 1 ) { |
okano | 1:80c512ccd0f2 | 21 | motor.move_steps( 48 ); |
okano | 0:ae2206213141 | 22 | wait( 1 ); |
okano | 0:ae2206213141 | 23 | |
okano | 1:80c512ccd0f2 | 24 | motor.move_steps( -48 ); |
okano | 0:ae2206213141 | 25 | wait( 1 ); |
okano | 0:ae2206213141 | 26 | } |
okano | 0:ae2206213141 | 27 | } |