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 2:48abf540cb20, committed 2020-01-13
- Comitter:
- Berndii__
- Date:
- Mon Jan 13 05:58:27 2020 +0000
- Parent:
- 1:51299916db3e
- Commit message:
- Labor_PTE_Kreuzschaltung mit 4 Schalter Digitalisiert
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Dec 02 18:26:11 2019 +0000
+++ b/main.cpp Mon Jan 13 05:58:27 2020 +0000
@@ -1,72 +1,32 @@
#include "mbed.h"
-#define Button1 p12
-#define Button3 p14
-#define Button2 p15
+#define Button1 D9
+#define Button2 D10
+#define Button3 D11
+#define Button4 D12
-
-BusOut myleds(LED4, LED3, LED2, LED1);
+DigitalOut LED(D2);
-DigitalIn up(Button1);
-DigitalIn down(Button2);
-DigitalIn center(Button3);
+DigitalIn A(Button1);
+DigitalIn B(Button2);
+DigitalIn C(Button3);
+DigitalIn D(Button4);
+
+
int main()
{
while(1) {
-
-
-
- if(up.read()==1) {
- if(myleds<=14) {
- wait_ms(50);
- myleds=myleds<<1;
- myleds=1|myleds;
-
- }
-
- if(myleds>=14) {
-
- wait_ms(50);
- myleds=myleds<<1;
- myleds=myleds|0;
-
- }
-
-
-
-
-
+
+ if ((A==1&&B==1&&C==0&&D==1)||(A==0&&B==1&&C==1&&D==1)||(A==1&&B==1&&C==1&&D==0)||(A==0&&B==1&&C==0&&D==0)||( A==1&&B==0&&C==0&&D==0)||(A==0&&B==0&&C==1&&D==0)||(A==1&&B==0&&C==1&&D==1)||(A==0&&B==0&&C==0&&D==1))
+ {
+ LED=1;
+ }
+ else
+ {
+ LED=0;
}
- if(center.read()==1) {
- wait_ms(100);
- for(int i=0; i<4; i++) {
- wait_ms(100);
- myleds=myleds<<1;
- myleds=myleds|0;
- }
- }
-
-
- if(down.read()==1) {
- if(myleds<=15) {
- wait_ms(50);
- myleds=myleds>>1;
- myleds=0|myleds;
- }
-
- if(myleds>=15) {
-
- wait_ms(50);
- myleds=myleds>>1;
- myleds=myleds|0;
-
- }
-
-
-
- }
-}
-}
\ No newline at end of file
+
+}}
\ No newline at end of file