Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: StepperMotorUni mbed
Dependents: StepperMotorUni_Hello
main.cpp@2:32e0b120ddb7, 2017-09-13 (annotated)
- Committer:
- okano
- Date:
- Wed Sep 13 04:03:01 2017 +0000
- Revision:
- 2:32e0b120ddb7
- Parent:
- 1:80c512ccd0f2
updated to include latest version library (v1.1.3)
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 | } |