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:5eaeb331242e, committed 2015-01-27
- Comitter:
- matthiashoefler
- Date:
- Tue Jan 27 12:19:58 2015 +0000
- Commit message:
- bertl drives in a square
Changed in this revision
| main.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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Jan 27 12:19:58 2015 +0000
@@ -0,0 +1,66 @@
+#include "mbed.h"
+// function: "bertl" drives in a square with blinking led's
+// author: Matthias Höfler
+
+
+// declaration
+DigitalOut myled(LED1);
+DigitalOut MotorL_EN(P1_15);
+DigitalOut MotorL_FORWARD(P1_1);
+DigitalOut MotorL_REVERSE(P1_0);
+
+DigitalOut MotorR_EN(P0_21);
+DigitalOut MotorR_FORWARD(P1_3);
+DigitalOut MotorR_REVERSE(P1_4);
+
+float speedy=0.8;
+
+DigitalOut LED_D10(P1_8);
+DigitalOut LED_D11(P1_9);
+DigitalOut LED_D12(P1_10);
+DigitalOut LED_D13(P1_11);
+
+DigitalOut LED_blue(P1_28);
+
+int a;
+
+// main programm
+int main() {
+ MotorR_EN = MotorL_EN = 1;
+ a=0;
+ while (a < 5)
+ {
+ speedy = 0.8; // driving forward
+ LED_blue = 0;
+ MotorR_FORWARD = MotorL_FORWARD = 1;
+ wait (3);
+
+ MotorR_FORWARD = MotorL_FORWARD = 0; // standing
+ LED_blue = 1;
+ wait(1);
+
+ LED_D10 = LED_D11 = LED_D12 = LED_D13 = 1; // blinking
+ wait (0.5);
+ LED_D10 = LED_D11 = LED_D12 = LED_D13 = 0;
+ wait (0.5);
+ LED_D10 = LED_D11 = LED_D12 = LED_D13 = 1;
+ wait (0.5);
+ LED_D10 = LED_D11 = LED_D12 = LED_D13 = 0;
+ wait (0.5);
+ LED_D10 = LED_D11 = LED_D12 = LED_D13 = 1;
+ wait (1);
+
+ speedy = 0.5; // rotating (optimal value 90°)
+ MotorL_FORWARD = 1;
+ wait (0.5);
+ MotorL_FORWARD = 0;
+
+ LED_D10 = LED_D11 = LED_D12 = LED_D13 = 0; // standing
+ wait(0.5);
+
+ }
+ }
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Jan 27 12:19:58 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file