This program shows the on/off status of the switches in the LCD screen

Dependencies:   TextLCD mbed

Revision:
0:3e0cc153ba82
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