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.
Stepper.cpp@1:52716241d0c4, 2012-04-21 (annotated)
- Committer:
- stvnrhodes
- Date:
- Sat Apr 21 07:12:29 2012 +0000
- Revision:
- 1:52716241d0c4
- Parent:
- 0:6e7505d77f6a
For Adam
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| stvnrhodes | 1:52716241d0c4 | 1 | #include "Stepper.h" |
| stvnrhodes | 1:52716241d0c4 | 2 | |
| stvnrhodes | 1:52716241d0c4 | 3 | Stepper::Stepper(PinName step, PinName dir, PinName en) : _step(step), _dir(dir), _en(en) { |
| stvnrhodes | 1:52716241d0c4 | 4 | _step = 0, _dir = 0, _en = 1; |
| stvnrhodes | 1:52716241d0c4 | 5 | } |
| stvnrhodes | 1:52716241d0c4 | 6 | |
| stvnrhodes | 1:52716241d0c4 | 7 | void Stepper::stepOn(bool direction) { |
| stvnrhodes | 1:52716241d0c4 | 8 | _dir = direction; |
| stvnrhodes | 1:52716241d0c4 | 9 | _step = 1; |
| stvnrhodes | 1:52716241d0c4 | 10 | } |
| stvnrhodes | 1:52716241d0c4 | 11 | |
| stvnrhodes | 1:52716241d0c4 | 12 | void Stepper::stepOff(void) { |
| stvnrhodes | 1:52716241d0c4 | 13 | _step = 0; |
| stvnrhodes | 1:52716241d0c4 | 14 | } |
| stvnrhodes | 1:52716241d0c4 | 15 | |
| stvnrhodes | 1:52716241d0c4 | 16 | void Stepper::enable(bool en) { |
| stvnrhodes | 1:52716241d0c4 | 17 | _en = !en; |
| stvnrhodes | 0:6e7505d77f6a | 18 | } |