Kenan Mahmutović Edis Kunić

Dependencies:   N5110 mbed

Files at this revision

API Documentation at this revision

Comitter:
tim010
Date:
Thu Apr 24 18:35:43 2014 +0000
Commit message:
LV_7_GRUPA7_TIM010

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/N5110.lib	Thu Apr 24 18:35:43 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/eencae/code/N5110/#adb79338d40f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Apr 24 18:35:43 2014 +0000
@@ -0,0 +1,95 @@
+#include "mbed.h"
+#include "N5110.h"
+#include <string>
+AnalogIn VRx(dp11);
+AnalogIn VRy(dp10);
+DigitalIn SW(dp9);
+DigitalOut enable(dp14);
+//Deklaracija LCD objekta
+//N5110 lcd(VCC,SCE,RST,D/C,MOSI,SCLK,LED)
+N5110 lcd(dp4,dp24,dp23,dp25,dp2,dp6,dp18);
+ 
+//Digitalni izlaz za deaktivaciju LED buffera
+
+void funkcijakrug(int x, int y){
+    lcd.clear();
+    lcd.setPixel(x,y);
+    int a=-1;
+    for(int i=0;i<3;i++){
+        lcd.setPixel(x-3,y+a);
+        a++;
+    }
+    lcd.setPixel(x-2,y-2);
+    lcd.setPixel(x-2,y+2);
+    lcd.setPixel(x-1,y-3);
+    lcd.setPixel(x-1,y+3);
+    lcd.setPixel(x,y-3);
+    lcd.setPixel(x,y+3);
+    lcd.setPixel(x+1,y-3);
+    lcd.setPixel(x+1,y+3);
+    lcd.setPixel(x+2,y-2);
+    lcd.setPixel(x+2,y+2);
+    a=-1;
+    for(int i=0;i<3;i++){
+        lcd.setPixel(x+3,y+a);
+        a++;
+    }
+    lcd.refresh();
+}
+int main(){
+int x=42, y=24;
+enable=1;
+lcd.init();
+lcd.setXYAddress(0,0);
+funkcijakrug(x,y);
+while(1){
+    int prva=int(VRx);
+    int druga=(VRx-prva)*10;
+    char c,b;
+    switch (prva){
+        case 0: c='0'; break;
+        case 1: c='1'; break;
+        case 2: c='2'; break;
+        case 3: c='3'; break;
+    }    
+    switch (druga){
+        case 0: b='0'; break;
+        case 1: b='1'; break;
+        case 2: b='2'; break;
+        case 3: b='3'; break;
+        case 4: b='4'; break;
+        case 5: b='5'; break;
+        case 6: b='6'; break;
+        case 7: b='7'; break;
+        case 8: b='8'; break;
+        case 9: b='9'; break;
+    }
+    lcd.printChar(c);
+    lcd.printChar(',');
+    lcd.printChar(b);
+    lcd.setXYAddress(0,0);
+       
+    lcd.printString(c+","+b,0,0);   
+        if (VRx<1.0/3.0){
+            if(x>3)x=x-1;
+            funkcijakrug(x,y);
+        }else if (VRx<2.0/3.0) {
+            funkcijakrug(x,y);
+        }else {
+            if(x<80) x=x+1;
+            funkcijakrug(x,y);
+        }
+        if (VRy<1.0/3.0) {
+            if(y>3)y=y-1;
+            funkcijakrug(x,y);
+        }
+        else if (VRy<2.0/3.0){ funkcijakrug(x,y);}
+        else {
+            if(y<44) y=y+1;
+            funkcijakrug(x,y);
+        }
+        if (SW==1) wait(5);
+        wait(0.05);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Apr 24 18:35:43 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/6473597d706e
\ No newline at end of file