![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
contoh program untuk driver a4988
Dependencies: StepperMotor mbed
main.cpp@0:48cdac0bbf8b, 2018-10-06 (annotated)
- Committer:
- hisyamfs
- Date:
- Sat Oct 06 11:31:23 2018 +0000
- Revision:
- 0:48cdac0bbf8b
ngetes library steppermotor dengan driver a4998
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hisyamfs | 0:48cdac0bbf8b | 1 | #include "mbed.h" |
hisyamfs | 0:48cdac0bbf8b | 2 | #include "Stepper.h" |
hisyamfs | 0:48cdac0bbf8b | 3 | |
hisyamfs | 0:48cdac0bbf8b | 4 | #define WAIT_TIME 0.02 |
hisyamfs | 0:48cdac0bbf8b | 5 | |
hisyamfs | 0:48cdac0bbf8b | 6 | // stepper(PinName _en, PinName ms1, PinName ms2, PinName ms3, PinName _stepPin, PinName dir); |
hisyamfs | 0:48cdac0bbf8b | 7 | stepper s(D9, D4, D5, D6, D7, D8); |
hisyamfs | 0:48cdac0bbf8b | 8 | |
hisyamfs | 0:48cdac0bbf8b | 9 | int main() |
hisyamfs | 0:48cdac0bbf8b | 10 | { |
hisyamfs | 0:48cdac0bbf8b | 11 | s.enable(); |
hisyamfs | 0:48cdac0bbf8b | 12 | while (1) |
hisyamfs | 0:48cdac0bbf8b | 13 | { |
hisyamfs | 0:48cdac0bbf8b | 14 | s.step(1, 1, 1/WAIT_TIME); |
hisyamfs | 0:48cdac0bbf8b | 15 | // wait(0.02); |
hisyamfs | 0:48cdac0bbf8b | 16 | } |
hisyamfs | 0:48cdac0bbf8b | 17 | } |