Simple Hello World! for the TextLCD library
Dependencies: TextLCD mbed-rtos mbed
Fork of TextLCD_HelloWorld by
Revision 3:39825a5cf7cf, committed 2015-01-22
- Comitter:
- myren
- Date:
- Thu Jan 22 15:47:19 2015 +0000
- Parent:
- 2:ad0b044d0a10
- Commit message:
- SuperTues test program
Changed in this revision
--- a/TextLCD.lib Sat Dec 04 11:31:07 2010 +0000 +++ b/TextLCD.lib Thu Jan 22 15:47:19 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/simon/code/TextLCD/#e4cb7ddee0d3 +http://mbed.org/users/simon/code/TextLCD/#308d188a2d3a
--- a/main.cpp Sat Dec 04 11:31:07 2010 +0000 +++ b/main.cpp Thu Jan 22 15:47:19 2015 +0000 @@ -1,10 +1,67 @@ // Hello World! for the TextLCD #include "mbed.h" -#include "TextLCD.h" +#include "TextLCD.h"//LCD bibliotek +#include "rtos.h"//threading bibliotek -TextLCD lcd(p15, p16, p17, p18, p19, p20); // rs, e, d4-d7 +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); + + + -int main() { - lcd.printf("Hello World!\n"); +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); + } + } +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-rtos.lib Thu Jan 22 15:47:19 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed-rtos/#444020d511f5
--- a/mbed.bld Sat Dec 04 11:31:07 2010 +0000 +++ b/mbed.bld Thu Jan 22 15:47:19 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e +http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5 \ No newline at end of file