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.
test_motor_main.h@2:d9745be6c253, 2022-08-04 (annotated)
- Committer:
- fionalin
- Date:
- Thu Aug 04 15:14:29 2022 -0400
- Revision:
- 2:d9745be6c253
hehe forgot to commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fionalin | 2:d9745be6c253 | 1 | #include <cstdio> |
fionalin | 2:d9745be6c253 | 2 | #include <mbed.h> |
fionalin | 2:d9745be6c253 | 3 | #include "stepper.h" |
fionalin | 2:d9745be6c253 | 4 | |
fionalin | 2:d9745be6c253 | 5 | const PinName MOTOR_ENABLE = D15; |
fionalin | 2:d9745be6c253 | 6 | const PinName MOTOR_STEP = D9; |
fionalin | 2:d9745be6c253 | 7 | const PinName MOTOR_DIR = D13; |
fionalin | 2:d9745be6c253 | 8 | const PinName MOTOR_MS1 = D12; |
fionalin | 2:d9745be6c253 | 9 | const PinName MOTOR_MS2 = D11; |
fionalin | 2:d9745be6c253 | 10 | const PinName MOTOR_MS3 = D10; |
fionalin | 2:d9745be6c253 | 11 | const PinName SLEEP = D1; |
fionalin | 2:d9745be6c253 | 12 | |
fionalin | 2:d9745be6c253 | 13 | |
fionalin | 2:d9745be6c253 | 14 | |
fionalin | 2:d9745be6c253 | 15 | int main() { |
fionalin | 2:d9745be6c253 | 16 | StepperMotor motor(MOTOR_ENABLE, |
fionalin | 2:d9745be6c253 | 17 | MOTOR_STEP, |
fionalin | 2:d9745be6c253 | 18 | MOTOR_DIR, |
fionalin | 2:d9745be6c253 | 19 | MOTOR_MS1, |
fionalin | 2:d9745be6c253 | 20 | MOTOR_MS2, |
fionalin | 2:d9745be6c253 | 21 | MOTOR_MS3, |
fionalin | 2:d9745be6c253 | 22 | SLEEP); |
fionalin | 2:d9745be6c253 | 23 | |
fionalin | 2:d9745be6c253 | 24 | |
fionalin | 2:d9745be6c253 | 25 | while(1) { |
fionalin | 2:d9745be6c253 | 26 | motor.step_positive(); |
fionalin | 2:d9745be6c253 | 27 | } |
fionalin | 2:d9745be6c253 | 28 | } |