![](/media/cache/profiles/JCSB.jpg.50x50_q85.jpg)
PWM with L298 for two DC Motors.
Dependencies: mbed FPointer TextLCD1 keypad
Fork of L298 by
Diff: main.cpp
- Revision:
- 1:c83539e7f8a0
- Parent:
- 0:f3cd2e9ab89b
- Child:
- 2:2e93c305bb62
diff -r f3cd2e9ab89b -r c83539e7f8a0 main.cpp --- a/main.cpp Mon Jun 20 05:18:43 2016 +0000 +++ b/main.cpp Wed Jun 22 21:31:17 2016 +0000 @@ -4,9 +4,15 @@ DigitalOut in2(PTC2); PwmOut ena(PTA2); +DigitalOut in3(PTD1); +DigitalOut in4(PTD2); +PwmOut enb(PTD3); + + int main() { while (true) { + /////******MOTOR 1****//// // Detiene el motor in1 = 0; in2 = 0; @@ -21,5 +27,20 @@ in2 = 1; ena.write(1.00f); wait(0.5f); + + /////******MOTOR 2****//// + in3 = 0; + in4 = 0; + wait(0.5f); + // Gira en sentido 1 con velocidad 50% + in3 = 1; + in4 = 0; + ena.write(0.50f); + wait(0.5f); + // Gira en sentido 2 con velocidad 100% + in3 = 0; + in4 = 1; + ena.write(1.00f); + wait(0.5f); } } \ No newline at end of file