Haris Šemić Faris Džafić

Dependencies:   N5110 mbed

Files at this revision

API Documentation at this revision

Comitter:
tim004
Date:
Thu May 08 16:11:23 2014 +0000
Commit message:
LAB8-Grupa6-tim004-Zadatak3

Changed in this revision

N5110.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 2dc46d27285c N5110.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/N5110.lib	Thu May 08 16:11:23 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/eencae/code/N5110/#adb79338d40f
diff -r 000000000000 -r 2dc46d27285c main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu May 08 16:11:23 2014 +0000
@@ -0,0 +1,55 @@
+#include "mbed.h"
+
+# include "N5110.h"
+
+
+N5110 lcd (dp4 ,dp24 ,dp23 ,dp25 ,dp2 ,dp6 , dp18 );
+
+Serial pc(USBTX,USBRX);
+
+int X(0), Y(0);
+
+void brisiSve() {
+    lcd.clear();
+    lcd.refresh();
+    lcd.setXYAddress(0,0);
+}
+
+void enter(){
+    if(Y==5) Y=0;
+    else Y++;
+    X=0;
+    lcd.setXYAddress(X,Y);
+}
+
+void backSpace() {
+    if(X==0 && Y==0) return;
+    if(X==0) {
+        Y-=1;
+        X=84;
+    }
+    X-=6;
+    lcd.setXYAddress(X,Y);
+    lcd.printChar(' ');
+    lcd.setXYAddress(X,Y);
+}
+
+void ispis(char c) {
+    lcd.printChar(c);
+    X+=6;
+    if(X==84) {
+        X=0;
+        if(Y==6) Y=0;
+    }
+}
+int main() {
+    lcd.init();
+    lcd.setXYAddress(X,Y);
+    while(1) {
+        char c = pc.getc();
+        if(c == '1') backSpace();
+        else if(c== '2') enter();
+        else if(c == '3') brisiSve(); 
+        else ispis(c);
+    }
+}
diff -r 000000000000 -r 2dc46d27285c mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu May 08 16:11:23 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776
\ No newline at end of file