Kiselica Aldin Muslija Adnan

Dependencies:   N5110 mbed

Files at this revision

API Documentation at this revision

Comitter:
tim008
Date:
Mon May 12 07:34:00 2014 +0000
Commit message:
LV8_PAI_Grupa1_Tim008

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 589b9e2fe4e3 N5110.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/N5110.lib	Mon May 12 07:34:00 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/eencae/code/N5110/#adb79338d40f
diff -r 000000000000 -r 589b9e2fe4e3 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon May 12 07:34:00 2014 +0000
@@ -0,0 +1,78 @@
+#include "mbed.h"
+#include "N5110.h"
+Serial pc(USBTX, USBRX);
+
+N5110 lcd(dp4,dp24,dp23,dp25,dp2,dp6,dp18);
+DigitalOut enable(dp14);
+Ticker ticker;
+
+char red1[15]={0};
+char red2[15]={0};
+char red3[15]={0};
+char red4[15]={0};
+char red5[15]={0};
+char red6[1]={0};
+
+int counter=0;
+
+char* getRed(int count)
+{
+    if(count>=0&&count<14)
+        return red1;
+    else if(count>=14&&count<28)
+        return red2;
+    else if(count>=28&&count<42)
+        return red3;
+    else if(count>=42&&count<56)
+        return red4;
+    else if(count>=56&&count<70)
+        return red5;
+    else if(count>=70&&count<84)
+        return red6;
+    else
+        return 0;
+}
+
+void ispisiRedove()
+{
+    lcd.printString(red1,0,0);
+    lcd.printString(red2,0,1);
+    lcd.printString(red3,0,2);
+    lcd.printString(red4,0,3);
+    lcd.printString(red5,0,4);
+    lcd.printString(red6,0,5);
+} 
+int main()
+{
+    enable=1;
+    lcd.init();
+    lcd.setXYAddress(0,0);
+    while(1){
+        if(counter==84)
+            continue;
+        char* red=getRed(counter);
+        if(pc.readable())
+        {
+            char temp=pc.getc();
+            //lcd.printChar(temp);hk
+            if(temp==127&&counter!=0)
+            {   counter--;
+                red[counter]=0;
+                lcd.clear();
+            }
+            else if(counter%14!=0)
+                red[counter++]=temp;
+            else if(counter%14==0)
+            {
+                red=getRed(counter);
+                red[counter++]=temp;
+            }
+        }
+        ispisiRedove();
+        if(counter>84)
+        {
+            counter-=84;
+        }
+    }
+}
+ 
diff -r 000000000000 -r 589b9e2fe4e3 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon May 12 07:34:00 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/6473597d706e
\ No newline at end of file