Hadžić Muharem Josip Kvesić

Dependencies:   N5110 mbed

Files at this revision

API Documentation at this revision

Comitter:
tim010
Date:
Thu Apr 24 16:12:04 2014 +0000
Commit message:
PAI-LV7-Grupa6-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
diff -r 000000000000 -r d490ddc21b56 N5110.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/N5110.lib	Thu Apr 24 16:12:04 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/eencae/code/N5110/#adb79338d40f
diff -r 000000000000 -r d490ddc21b56 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Apr 24 16:12:04 2014 +0000
@@ -0,0 +1,101 @@
+#include "mbed.h"
+#include "N5110.h"
+
+//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
+DigitalOut enable(dp14);
+
+//Analogni ulazi sa dzojstika
+AnalogIn    VRx(dp11);
+AnalogIn    VRy(dp10);
+//Taster sa dzojstika
+DigitalIn   SW(dp9);
+
+void krug(int a,int b) {
+    if(a<3 || a>80 || b<3 || b>44) return;
+    lcd.clear();
+    lcd.refresh();
+    lcd.setXYAddress(0,0);
+    
+    lcd.setPixel(a,b); //nije potrebno
+    
+    lcd.setPixel(a-3,b);
+    lcd.setPixel(a-3,b+1);
+    lcd.setPixel(a-3,b-1);
+    lcd.setPixel(a+3,b-1);
+    lcd.setPixel(a+3,b);
+    lcd.setPixel(a+3,b+1);
+    lcd.setPixel(a-2,b+2);                                                
+      lcd.setPixel(a-2,b-2);    
+       lcd.setPixel(a+2,b+2);    
+        lcd.setPixel(a+2,b-2);    
+        lcd.setPixel(a-1,b+3);    
+        lcd.setPixel(a,b+3);   
+        lcd.setPixel(a+1,b+3);   
+        lcd.setPixel(a-1,b-3);   
+        lcd.setPixel(a,b-3); 
+        lcd.setPixel(a+1,b-3);     
+          
+    
+        lcd.refresh();
+        
+        
+}
+             
+                                        
+
+
+int main() {
+    enable=1;
+    //Aktivacija pull-up otpornika
+    SW.mode(PullUp);
+    int x=42, y=24;
+     lcd.init();
+    
+     krug(x,y);    
+
+    while(1) {
+      if (VRx<1.0/3.0) 
+     {
+         x=x-1;
+    
+     krug(x,y); 
+    }
+     else if (VRx<2.0/3.0) 
+    {
+    krug(x,y); 
+    }
+    else 
+    {x=x+1;
+    krug(x,y); }
+    wait(0.05);
+    
+    if (VRy<1.0/3.0) 
+     {
+      y=y-1;
+      krug(x,y); 
+ 
+    }
+     else if (VRy<2.0/3.0) 
+    {
+    krug(x,y); 
+  
+    }  
+    else    
+    {
+     y=y+1;
+     krug(x,y); 
+    }
+       wait(0.05); 
+    }
+    
+    if(SW==1) wait(5);
+    
+    
+     
+     
+    
+}
diff -r 000000000000 -r d490ddc21b56 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Apr 24 16:12:04 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/6473597d706e
\ No newline at end of file