tim010 tim010 / Mbed 2 deprecated Grupa7-ProjekatRadar

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
tim010
Date:
Thu May 29 18:22:30 2014 +0000
Commit message:
Muris Nuhod?ii?; Edis Kuni?

Changed in this revision

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 8cc3dba86d01 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu May 29 18:22:30 2014 +0000
@@ -0,0 +1,46 @@
+#include "mbed.h"
+//#include "sMotor.h"
+AnalogIn IR(dp4);
+ 
+Serial pc(USBTX, USBRX);/*
+sMotor motor(dp13,dp11,dp10,dp9); 
+ 
+//int brzina = 1200 ; 
+int brojkoraka = 360 ; 
+bool p=true;
+ */int distanca[]={      10   ,  15 , 20   ,25   , 30   ,   35  , 40  ,    45   ,   50   , 55    ,  60  ,  65 ,  70   ,  75  , 80  ,    85   ,   90};
+ float naponi[]={      0.89, 0.87, 0.81,  0.71 , 0.62 , 0.54,  0.47,  0.43,    0.39 ,  0.34,   0.32,   0.29,   0.28  , 0.25, 0.24,  0.23,            0.21 };
+
+int provjeri(float n){
+    if(n<0.21)return -1;
+    if(n>0.89)return -1;
+    
+    if(n<=0.89 && n>0.87) return 10;
+    if(n<=0.87 && n>0.81) return 15;
+    if(n<=0.81 && n>0.71) return 20;
+    if(n<=0.71 && n>0.62) return 25;
+    if(n<=0.62 && n>0.54) return 30;
+    if(n<=0.54 && n>0.47) return 35;
+    if(n<=0.47 && n>0.43) return 40;
+    if(n<=0.43 && n>0.39) return 45;
+    if(n<=0.39 && n>0.34) return 50;
+    if(n<=0.34 && n>0.32) return 55;
+    if(n<=0.32 && n>0.29) return 60;
+    if(n<=0.29 && n>0.28) return 65;
+    if(n<=0.28 && n>0.25) return 70;
+    if(n<=0.25 && n>0.24) return 75;
+    if(n<=0.24 && n>0.23) return 80;
+    if(n<=0.23 && n>0.21) return 85;
+    }
+int main() {
+    float a;
+    while(1)
+    {a = IR;
+        int b=provjeri(a);
+        
+        pc.printf("%d\n", b);
+        wait(1);
+    }
+    
+    
+}
\ No newline at end of file
diff -r 000000000000 -r 8cc3dba86d01 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu May 29 18:22:30 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/0b3ab51c8877
\ No newline at end of file