Amer Ratkovic Emir Mujacic

Dependencies:   N5110 mbed

Revision:
0:a077c8c0906b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu May 08 14:05:42 2014 +0000
@@ -0,0 +1,59 @@
+#include "mbed.h"
+#include "N5110.h"
+Serial PC (USBTX, USBRX);
+N5110 lcd(dp4,dp24,dp23,dp25,dp2,dp6,dp18);
+DigitalOut enable(dp14);
+Ticker t;
+
+
+int main()
+{
+    enable=1;
+    lcd.init();
+    lcd.setXYAddress(0,0);
+    lcd.refresh(); 
+    int x=0, y=0;
+   // t.attach(&fukcija);
+    while(1){
+        // 1 - enter 2-delete 3 -backspace
+        char a= PC.getc();
+        if(a=='1')
+        {
+            //lcd.printChar('\n');
+            if(y==6) y=0;
+            lcd.setXYAddress(0,y+1);
+        }
+        if(a=='2')
+        {
+            lcd.clear();
+            lcd.setXYAddress(0,0);
+        }
+        if(a=='3')
+        {
+           x--;
+           
+           if(x>=0)
+           {
+            lcd.setXYAddress(x,y);
+            lcd.printChar(' ');
+            lcd.setXYAddress(x,y);
+
+           }
+           else
+           {
+               x=77;y--;
+               lcd.setXYAddress(x,y);
+               lcd.printChar(' ');
+               lcd.setXYAddress(x,y);
+           }
+        }
+        if(a!='1' && a!='2' && a!='3')
+        {
+            lcd.printChar(a);
+            x++;
+            if(x>83){ y++; x=0;}
+        }
+    }
+
+
+}
\ No newline at end of file