![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Pokretanje DC motora pomoću LPC1768 mikrokoupravljača i L293D drivera koji u sebi sadrži 2 H-mosta i predviđen je da može pokretati 2 DC motora istovremeno.
Dependencies: mbed
MotorDC.h@1:0e8e1330a84a, 2020-05-31 (annotated)
- Committer:
- lorel
- Date:
- Sun May 31 16:32:50 2020 +0000
- Revision:
- 1:0e8e1330a84a
PUBLISH;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lorel | 1:0e8e1330a84a | 1 | |
lorel | 1:0e8e1330a84a | 2 | #ifndef MBED_MOTOR_H |
lorel | 1:0e8e1330a84a | 3 | #define MBED_MOTOR_H |
lorel | 1:0e8e1330a84a | 4 | #include "mbed.h" |
lorel | 1:0e8e1330a84a | 5 | |
lorel | 1:0e8e1330a84a | 6 | |
lorel | 1:0e8e1330a84a | 7 | class MotorDC { //definiranje klase "MotorDC" |
lorel | 1:0e8e1330a84a | 8 | public: |
lorel | 1:0e8e1330a84a | 9 | |
lorel | 1:0e8e1330a84a | 10 | MotorDC(PinName PWM, PinName smjer1, PinName smjer2); //definiranje PWM pina, smjer1 i smjer2 definiraju smjer vrtnje motora/ |
lorel | 1:0e8e1330a84a | 11 | |
lorel | 1:0e8e1330a84a | 12 | void speed(float speed); // određujemo brzinu motora prema PWM-u s vrijednost od 0-1 za jedan smjer i od -1 - 0 za drugi smjer/ |
lorel | 1:0e8e1330a84a | 13 | |
lorel | 1:0e8e1330a84a | 14 | protected: |
lorel | 1:0e8e1330a84a | 15 | PwmOut _PWM; |
lorel | 1:0e8e1330a84a | 16 | DigitalOut _smjer1; |
lorel | 1:0e8e1330a84a | 17 | DigitalOut _smjer2; |
lorel | 1:0e8e1330a84a | 18 | |
lorel | 1:0e8e1330a84a | 19 | }; |
lorel | 1:0e8e1330a84a | 20 | |
lorel | 1:0e8e1330a84a | 21 | #endif |