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

main.cpp

Committer:
myren
Date:
2017-05-17
Revision:
5:3c663dd80a47
Parent:
4:e97e3c1442d2

File content as of revision 5:3c663dd80a47:

// 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 (p29);

DigitalIn Btn1 (p28);

int PressCounter =0;
string LCD_Text;;
bool KnapAktiv;

void CheckBtn_thread(void const *args) 
{
    while (true) //tråd der scanner knapper
    {
  
        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(100);
          
        }
        else
        {
          Thread::wait(100);
          lcd_txt.locate(0,3);
          lcd_txt.printf("                    ");
         } 
         
          
    }

 }

int main() 
{
    Thread thread(CheckBtn_thread);
    lcd_txt.cls();
    lcd_txt.locate(0,0);
    lcd_txt.printf("****TestProgram*****");
    //LCD_Text ="****TestProgram****";
    //lcd_txt.printf("%s",LCD_Text);

while (true)
{
    
}
    
}