Goro Faruk Predrag Simanić

Dependencies:   N5110 mbed

Files at this revision

API Documentation at this revision

Comitter:
tim007
Date:
Mon May 19 16:01:08 2014 +0000
Commit message:
Projekat_PAI-PP-Grupa3

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	Mon May 19 16:01:08 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	Mon May 19 16:01:08 2014 +0000
@@ -0,0 +1,130 @@
+#include "mbed.h"
+#include "N5110.h"
+ 
+#define MAXWIDTH 84
+#define MAXHEIGHT 48
+ 
+Timer t;
+DigitalOut enable(dp14);
+ int X=0;int Y=0;
+ int x1=90,y1=90,x2,y2;
+AnalogIn VRy2(dp11);
+AnalogIn VRy1(dp10);
+DigitalIn SW1(dp9), SW2(dp13);
+ 
+N5110 lcd (dp4, dp24, dp23, dp25, dp2, dp6, dp18);
+ 
+void palija1(int x, int y)
+{
+    for(int i=x; i<=x+2; i++)
+     for(int j=y; j<=y+2; j++)
+    {
+              
+        lcd.setPixel(i,j);
+        lcd.setPixel(i,j+1);
+        lcd.setPixel(i,j+2);
+        lcd.refresh();
+    }
+}
+ 
+void palija2(int x, int y)
+{
+    for(int i=x; i<=x+2; i++)
+     for(int j=y; j<=y+2; j++)
+    {      
+        lcd.setPixel(i,j);
+        lcd.setPixel(i,j+1);
+        lcd.setPixel(i,j+2);
+        lcd.refresh();
+    }
+}
+
+void Teren()
+{
+    lcd.setXYAddress(0,0);
+     int j =5;
+     for(int i =5;i<= 75;i++) //gornji desno... radi
+     {
+        lcd.setPixel(i,j);
+        lcd.refresh();
+     }   
+     int k=75;
+     for(int i=5;i<=40;i++) //od gore, prema dole ... radi
+     {
+        lcd.setPixel(k,i);
+        lcd.refresh();
+     }
+     j=40;
+     for(int i =75;i>=5;i--) //donja linija .. radi
+     {
+       lcd.setPixel (i,j);
+       lcd.refresh();
+      
+     }
+     
+     k=5;
+     for(int i = 40; i>= 5;i--) // Ne radi...
+     {
+       lcd.setPixel(k,i);
+       lcd.refresh();
+      
+      }
+      //sredina
+     j=40;
+     for(int i=5;i<=40;i++)
+     {
+       lcd.setPixel(j,i);
+       lcd.refresh();
+      
+     }
+    
+}
+void brisi(int x, int y)
+{
+    for(int i=x; i<=x+2; i++)
+     for(int j=y; j<=y+2; j++)
+    {
+        lcd.clearPixel(i,j);
+        lcd.refresh();
+    }
+}
+void Gore(int &x, int &y)
+{
+    if(y>0)
+    {
+        brisi(x,y);
+        y=y-1;
+        //cursor(x,y);
+    }
+}
+ 
+void Dole(int &x, int &y)
+{
+    if(y<45){
+        brisi(x,y);
+        y=y+1;
+        //cursor(x,y);
+    }
+}
+ 
+int main(){
+  lcd.setXYAddress(0,0);
+  enable = 1;
+  SW1.mode(PullUp);
+  SW2.mode(PullUp);
+  t.start();
+  lcd.init();
+  Teren();
+  while(1){
+      if(VRy1 < 1.0/3.0) Gore(X,Y);
+      else if(VRy1 > 2.0/3.0) Dole(X,Y);
+ 
+      if(VRy2 < 1.0/3.0) Gore(X,Y);
+      else if(VRy2 > 2.0/3.0) Dole(X,Y);
+       
+    palija1(X,Y);
+    palija2(X,Y);
+      
+  }
+}
+            
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon May 19 16:01:08 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8a40adfe8776
\ No newline at end of file