Praktikum1_AMSL

Dependencies:   C12832_lcd mbed

Fork of app-board-Joystick-with-LCD by Kim Sehee

Files at this revision

API Documentation at this revision

Comitter:
slueke
Date:
Wed Mar 07 18:53:18 2018 +0000
Parent:
0:3cb0e69f1806
Commit message:
Praktikum1_AMSL

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 3cb0e69f1806 -r 2353745db031 main.cpp
--- a/main.cpp	Tue Oct 08 11:13:01 2013 +0000
+++ b/main.cpp	Wed Mar 07 18:53:18 2018 +0000
@@ -10,8 +10,19 @@
 BusIn Right(p16);
 BusOut Reset(p14);
 
+DigitalOut myled(LED1);
+DigitalOut myled2(LED2);
+DigitalOut myled3(LED3);
+DigitalOut myled4(LED4);
+
+int x = 0;
+float y =0.0;
+
 // Custom Function 
 void initialize();
+void LCD_Anzeige();
+void LED_Blinky();
+
 
 // Main 
 int main()
@@ -19,23 +30,62 @@
     initialize(); 
     while(1) 
     {
-        lcd.locate(0,15);   // Set Location print a text    
-        // Operations by Joystic
-        if (Up)
-            lcd.printf("UP");
-        if (Down)
-            lcd.printf("Down");        
-        if (Left)
-            lcd.printf("Left");           
-        if (Right)
-            lcd.printf("Right");           
-        if (Reset)
-            initialize();                                                     
+         LCD_Anzeige();
+         LED_Blinky();  
+         x++;
+         y=sqrt(float(x));
+         lcd.printf("%d,%f",x,y);
+         wait(1.0);                                                     
     }
 }
 void initialize()
 {
     lcd.cls();
     lcd.locate(0,0);
-    lcd.printf("Joystic and LCD Controller!");     
-}
\ No newline at end of file
+    lcd.printf("Hallo Bielefeld!");     
+}
+
+void LED_Blinky(){
+        myled = 1;    
+        wait(0.2);
+        myled = 0;
+        wait(0.2);
+        
+        myled2 = 1;    
+        wait(0.2);
+        myled2 = 0;
+        wait(0.2);
+        
+        myled3 = 1;    
+        wait(0.2);
+        myled3 = 0;
+        wait(0.2);
+        
+        myled4 = 1;    
+        wait(0.2);
+        myled4 = 0;
+        wait(0.2);
+        }
+        
+void LCD_Anzeige(){
+     lcd.cls();
+     lcd.locate(0,0);
+     lcd.printf("Hallo Bielefeld!");   
+     lcd.locate(0,15);   // Set Location print a text    
+        // Operations by Joystic
+        if (Up)
+           
+            lcd.printf("UP");
+        if (Down)
+            
+            lcd.printf("Down");        
+        if (Left)
+            
+            lcd.printf("Left");           
+        if (Right)
+            
+            lcd.printf("Right");           
+        if (Reset)
+            initialize();     
+    
+    }
\ No newline at end of file