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:62452b8daf37, committed 2018-11-15
- Comitter:
- martwerl
- Date:
- Thu Nov 15 18:00:33 2018 +0000
- Commit message:
- LED2
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 |
diff -r 000000000000 -r 62452b8daf37 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Nov 15 18:00:33 2018 +0000
@@ -0,0 +1,94 @@
+#include "mbed.h"
+
+//DigitalOut myled(LED1);
+
+// DigitalOut eine Variable für ein Bit
+// BusOut eine Variable für eine ganze Bitgruppe
+
+// Alle 12-Leds des M0-Boards zu einer Bitgruppe zusammenfassen
+
+// LSB MSB
+// 2^0 2^1 2^2 2^11
+BusOut lb(P1_13,P1_12,P1_7,P1_6,P1_4,P1_3,P1_1,P1_0,LED4,LED3,LED2,LED1);
+// D20 D19 D18 D17 D16 D15 D14 D13 D4 D3 D2 D1
+
+//void LedBarTest();
+
+void Runlight1();
+void Runlight2();
+void Runlight3();
+
+
+int main()
+{
+ lb = 0;
+while (1)
+ {
+
+ Runlight3();
+ //LedBarTest();
+ }
+}
+
+void Runlight1()
+{
+ lb = 1;
+ for(int i = 0;i <= 12; i++)
+ {
+ wait_ms(100);
+ lb = lb << 1;//nach links verschieben
+
+ }
+}
+
+void Runlight2()//Lauflicht mit 1en nachschieben
+{
+ lb = 1;
+ for(int i = 0;i <= 12; i++)
+ {
+ wait_ms(100);
+ lb = (lb << 1) | 1;//nach links verschieben und einen einser dazuverodern
+
+ }
+
+ lb = 1;
+ for(int i = 0;i <= 12; i++)
+ {
+ wait_ms(100);
+ lb = (lb << 1);//
+
+ }
+}
+
+
+void Runlight3()//3er Gruppe aufbauen und weiterschieben
+{
+ lb = 1;
+
+ for(int i = 0;i <= 12; i++)
+ {
+ wait_ms(100);
+ lb = (lb << 1) | 1;//nach links verschieben und einen einser dazuverodern
+
+ }
+
+
+}
+
+
+
+
+void LedBarTest()
+{
+ lb = 1; //D20 setzen
+ wait_ms(500);
+ lb = 2; //D19 setzen
+ wait_ms(500);
+ lb = 3; //D19 und D20 setzen
+ wait_ms(500);
+ lb = 4; //D18 setzen
+ wait_ms(500);
+ lb = 15; //D20...D17 setzen
+ wait_ms(500);
+
+}
\ No newline at end of file
diff -r 000000000000 -r 62452b8daf37 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Nov 15 18:00:33 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e7ca05fa8600 \ No newline at end of file