Eduvance Remolab
/
Switch_Status_on_LCD_kl25z
This program shows the on/off status of the switches in the LCD screen
Revision 0:3e0cc153ba82, committed 2016-02-05
- Comitter:
- EduRemo
- Date:
- Fri Feb 05 07:39:06 2016 +0000
- Commit message:
- FRCRCE Switch Status on LED
Changed in this revision
diff -r 000000000000 -r 3e0cc153ba82 TextLCD.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TextLCD.lib Fri Feb 05 07:39:06 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/simon/code/TextLCD/#308d188a2d3a
diff -r 000000000000 -r 3e0cc153ba82 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Feb 05 07:39:06 2016 +0000 @@ -0,0 +1,46 @@ +#include "mbed.h" +#include "TextLCD.h" + +TextLCD lcd(PTC9, PTC8, PTA5, PTA4, PTA12, PTD4, TextLCD::LCD16x2); // rs, e, d4-d7 but could use + +DigitalIn sw1(PTD1); // Switch selected as input +DigitalIn sw2(PTD3); +DigitalIn sw3(PTD2); +DigitalIn sw4(PTD0); + + +int main() { + lcd.cls(); // clear LCD screen + lcd.printf(" Switch and LCD "); + lcd.locate(0,1); // locate (column,row) + lcd.printf("A= ,B= ,C= ,D= "); + while (1){ + if (sw1 == 1) + {lcd.locate(2,1); + lcd.printf("1"); + } + else {lcd.locate(2,1); + lcd.printf("0");} + if (sw2 == 1) + {lcd.locate(6,1); + lcd.printf("1"); + } + else {lcd.locate(6,1); + lcd.printf("0");} + + + if (sw3 == 1) + {lcd.locate(10,1); + lcd.printf("1"); + } + else {lcd.locate(10,1); + lcd.printf("0");} + + if (sw4 == 1) + {lcd.locate(14,1); + lcd.printf("1"); + } + else {lcd.locate(14,1); + lcd.printf("0");} +} +} \ No newline at end of file
diff -r 000000000000 -r 3e0cc153ba82 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Feb 05 07:39:06 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/9296ab0bfc11 \ No newline at end of file