Tarik Demirović Aida Pločo

Dependencies:   N5110 mbed

Revision:
0:dd95051d5d71
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon May 12 07:18:24 2014 +0000
@@ -0,0 +1,62 @@
+#include "mbed.h"
+#include "N5110.h"
+#include <string>
+
+Serial pc(USBTX, USBRX);
+N5110 lcd(dp4,dp24,dp23,dp25,dp2,dp6,dp18);
+
+DigitalOut enable (dp14);
+
+int x = 0;
+int y = 0;
+
+void ocitaj()
+{
+    char buf[50];
+    buf[0] = pc.getc();
+    
+    if(buf[0] == '1')
+    {
+        y++;
+        if(y > 5) y = 0;
+        x = 0;
+    }
+
+    else if(buf[0] == '2')
+    {
+        lcd.clear();
+        x = 0;
+        y = 0;
+    }
+    
+    else if(buf[0] == '3')
+    {
+        x -= 5;
+        if(x < 0 and y > 0){
+            x = 82;
+            y--;
+        }
+        
+        lcd.printString(" ", x, y);
+    }
+    
+    else
+    {
+        lcd.printString(buf, x, y);
+        x += 5;
+        if(x > 83)
+        {
+            x = 0;
+            y++;
+            if( y > 5) y = 0;
+        }
+    }
+}
+
+int main() {
+    enable = 1;
+    lcd.init();
+    lcd.setXYAddress(0, 0);
+    pc.attach(&ocitaj);
+    while(1) {}
+}