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.
Revision 0:ba7edc8ad790, committed 2016-06-08
- Comitter:
- Julien_Blue
- Date:
- Wed Jun 08 07:11:00 2016 +0000
- Commit message:
- -> Motor Enable ist als PwOut definiert; -> Pulsweite kann beliebig Ver?ndert werden.; -> Bert f?hrt 3sec gerade aus und dann wieder zur?ck
Changed in this revision
| firmware.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r ba7edc8ad790 firmware.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/firmware.cpp Wed Jun 08 07:11:00 2016 +0000
@@ -0,0 +1,50 @@
+/***********************************
+name: Pwm_Tutorial_Bertl16
+author: Julian Koller
+description:
+-> Motor Enable ist als PwOut definiert
+-> Pulsweite kann beliebig Verändert werden.
+-> Bert fährt 3sec gerade aus und dann wieder zurück
+***********************************/
+
+
+#include <mbed.h>
+
+//Definition der Motoren
+DigitalOut Von (P2_13);
+PwmOut MotorL_EN(P1_19);
+DigitalOut MotorL_REVERSE(P2_14);
+DigitalOut MotorL_FORWARD(P2_15);
+
+PwmOut MotorR_EN(P2_19);
+DigitalOut MotorR_REVERSE(P2_21);
+DigitalOut MotorR_FORWARD(P2_20);
+
+int main()
+{
+ Von = 1; //Motorspannung V auf on
+
+ //Pwm = Pulse Width Modulation
+ //Periodendauer wird angegeben wie lange der Motor maximal Strom bekommen soll.
+ //Geringere Werte = geschmeidiger Motorlauf. 10ms = extrem runder lauf. 100ms = runder lauf. 1000ms = es laggt
+ //Periodendauer = 10ms = 100%. Pulsweite = 2ms = 20% von 10ms == 20% Motorleistung :D eZ
+ MotorR_EN.period_ms(10); //Periodendauer = immer 100% egal welcher Wert gesetzt wurde
+ MotorL_EN.period_ms(10); //Periodendauer = immer 100% egal welcher Wert gesetzt wurde
+ MotorL_EN.pulsewidth_ms(2); //Pulsweite (T-on time) in ms die der Motor Strom bekommen soll
+ MotorR_EN.pulsewidth_ms(2); //Pulsweite (T-on time) in ms die der Motor Strom bekommen soll
+ //So einfach is ds. Ende
+
+ do
+ {
+ MotorR_FORWARD = MotorL_FORWARD = 1; //Ganz normal Motor einschalten
+ wait(3); //3sec warten
+ MotorR_FORWARD = MotorL_FORWARD = 0; //Und wieder aus
+ wait(1); //1sec warten
+ MotorR_REVERSE = MotorL_REVERSE = 1; //Wieder Retour
+ wait(3); //3sec warten
+ MotorR_REVERSE = MotorL_REVERSE = 0; //Und wieder aus
+ wait(1); //1sec warten
+ } while(1);
+}
+
+//Ende
\ No newline at end of file
diff -r 000000000000 -r ba7edc8ad790 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Jun 08 07:11:00 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file