Simple program for the TextLCD library, with switch and LED

Dependencies:   TextLCD TextLCD_HelloWorld_SuperTue mbed-rtos mbed

Fork of TextLCD_HelloWorld_SuperTue by Tue Myren

Files at this revision

API Documentation at this revision

Comitter:
myren
Date:
Wed May 17 08:07:09 2017 +0000
Parent:
3:39825a5cf7cf
Child:
5:3c663dd80a47
Commit message:
SuperTues Praktikant Program

Changed in this revision

TextLCD_HelloWorld_SuperTue.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD_HelloWorld_SuperTue.lib	Wed May 17 08:07:09 2017 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/myren/code/TextLCD_HelloWorld_SuperTue/#39825a5cf7cf
--- a/main.cpp	Thu Jan 22 15:47:19 2015 +0000
+++ b/main.cpp	Wed May 17 08:07:09 2017 +0000
@@ -1,48 +1,38 @@
 // Hello World! for the TextLCD
 
 #include "mbed.h"
+#include<string> 
 #include "TextLCD.h"//LCD bibliotek
 #include "rtos.h"//threading bibliotek
 
+
 TextLCD lcd_txt(p26, p25, p24, p23, p22, p21,TextLCD::LCD20x4); // rs, e, d4-d7
 DigitalOut Led1 (LED1);
 DigitalOut Led2 (LED2);
-DigitalOut MyLed (p28);
+DigitalOut MyLed (p29);
+
+DigitalIn Btn1 (p28);
 
-DigitalIn Btn1 (p27);
-
-
-
+int PressCounter =0;
+string LCD_Text;;
+bool KnapAktiv;
 
 void CheckBtn_thread(void const *args) 
 {
     while (true) //tråd der scanner knapper
     {
-        Led2 = !Led2;
-        if (MyLed == true)
-          {
-            lcd_txt.locate(0,2);
-            lcd_txt.printf("LED aktiveret!  ");   
-          }
-          else
-          {
-            lcd_txt.locate(0,2);
-            lcd_txt.printf("LED deaktiveret!");   
-          }
-        
-        
-         lcd_txt.locate(0,0);
-         lcd_txt.printf("***** SuperTue *****");
-        
+  
         if (Btn1 == true)//scanner knap
         {
           lcd_txt.locate(0,3);
           lcd_txt.printf("Switch aktiv!");
           MyLed = !MyLed; //tænder og slukker for diode
-          Thread::wait(500);
+          Thread::wait(100);
+          
         }
         else
         {
+          Thread::wait(100);
           lcd_txt.locate(0,3);
           lcd_txt.printf("                    ");
          } 
@@ -56,12 +46,15 @@
 {
     Thread thread(CheckBtn_thread);
     lcd_txt.cls();
+    lcd_txt.locate(0,0);
+    lcd_txt.printf("****Test_Program*****");LCD_Text
+    //LCD_Text ="****TestProgram****";
+    //lcd_txt.printf("%s",LCD_Text);
+
+while (true)
+{
     
-    while (true) 
-    {
-      Led1 = !Led1; //starter "tråd" i hovedprogram
-      Thread::wait(500);
-    }
-
+}
+    
 }