ping-pong

nestooo

Files at this revision

API Documentation at this revision

Comitter:
atopcic
Date:
Mon Feb 22 08:23:02 2021 +0000
Commit message:
datoteke

Changed in this revision

PozicijaOdbijaca.cpp Show annotated file Show diff for this revision Revisions of this file
PozicijaOdbijaca.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PozicijaOdbijaca.cpp	Mon Feb 22 08:23:02 2021 +0000
@@ -0,0 +1,23 @@
+// funkcija odbijača - potenciometri:
+
+#include "PozicijaOdbijaca.h"
+
+AnalogIn Pot1(A0);
+AnalogIn Pot2(A1);
+int Igrac1Pozicija,Igrac2Pozicija;
+extern int polje[8][8];
+    void pozicija_odbijaca(void){
+          
+        Igrac1Pozicija=Pot1*5;
+        Igrac2Pozicija=Pot2*5;
+  
+        for(int i = 0; i < 8; i++)
+        {
+      if(i >= Igrac1Pozicija && i < Igrac1Pozicija + 3) polje[7][i] = 1;
+        else polje[7][i] = 0;
+            
+      if(i >= Igrac2Pozicija && i < Igrac2Pozicija + 3) polje[0][i] = 1; 
+          else polje[0][i] = 0;      
+        }
+        }
+    
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PozicijaOdbijaca.h	Mon Feb 22 08:23:02 2021 +0000
@@ -0,0 +1,12 @@
+#ifndef POZICIJAODBIJACA_H
+#define POZICIJAODBIJACA_H
+#include "mbed.h"
+
+
+
+extern AnalogIn Pot1;
+extern AnalogIn Pot2;
+ extern int Igrac1Pozicija,Igrac2Pozicija;
+ 
+ void pozicija_odbijaca(void);
+ #endif 
\ No newline at end of file