Simple Hello World! for the TextLCD library
Dependencies: TextLCD mbed-rtos mbed
Fork of TextLCD_HelloWorld by
main.cpp
- Committer:
- myren
- Date:
- 2015-01-22
- Revision:
- 3:39825a5cf7cf
- Parent:
- 2:ad0b044d0a10
File content as of revision 3:39825a5cf7cf:
// Hello World! for the TextLCD #include "mbed.h" #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); DigitalIn Btn1 (p27); 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); } else { lcd_txt.locate(0,3); lcd_txt.printf(" "); } } } int main() { Thread thread(CheckBtn_thread); lcd_txt.cls(); while (true) { Led1 = !Led1; //starter "tråd" i hovedprogram Thread::wait(500); } }