Testing of reflection sensor query

Dependencies:   Test_motor mbed

Files at this revision

API Documentation at this revision

Comitter:
bayagich
Date:
Tue May 20 14:24:40 2014 +0000
Parent:
0:fb7117213e54
Commit message:
Test for reflection sensor query ;

Changed in this revision

m3pi_ng.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show diff for this revision Revisions of this file
test_motor.cpp Show annotated file Show diff for this revision Revisions of this file
test_reflection.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/m3pi_ng.lib	Tue May 20 13:12:44 2014 +0000
+++ b/m3pi_ng.lib	Tue May 20 14:24:40 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/ngoldin/code/m3pi_ng/#da9ef3d5c3fe
+http://mbed.org/teams/der-Roboter/code/Test_motor/#da9ef3d5c3fe
--- a/main.cpp	Tue May 20 13:12:44 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-#include "mbed.h"
-#include "m3pi_ng.h"
-
-DigitalOut myled(LED1);
-
-m3pi george;
-
-int main() {
-    
-    //MOTOR TEST 
-
-    //left motor test 
-    for(int i = 0; i < 1000; ++i){
-        george.left_motor(0.3);
-    }
-    george.stop(); 
-    wait(3);  
-    
-    for(int i = 0; i < 1000; ++i){
-        george.left_motor(-0.3);
-    }
-    george.stop();  
-    wait(3); 
-    
-    
-    //right motor test 
-    for(int i = 0; i < 1000; ++i){
-        george.right_motor(0.3);
-    } 
-    george.stop(); 
-    wait(3); 
-    
-    for(int i = 0; i < 1000; ++i){
-        george.right_motor(-0.3);
-    } 
-    george.stop(); 
-    wait(3); 
-    //testing limits 
-    
-    //left motor test 
-     
-    for(int i = 0; i < 1000; ++i){
-        george.left_motor(1);
-    }
-    george.stop(); 
-    wait(3); 
-    
-    for(int i = 0; i < 1000; ++i){
-        george.left_motor(-1);
-    } 
-    george.stop(); 
-    wait(3); 
-    
-    //right motor test 
-    for(int i = 0; i < 1000; ++i){
-        george.right_motor(1);
-    } 
-    george.stop(); 
-    wait(3); 
-    
-    for(int i = 0; i < 1000; ++i){
-        george.right_motor(-1);
-    }
-    george.stop(); 
-    wait(3); 
-    
-    for(int i = 0; i < 1000; ++i){
-        george.right_motor(0);
-    }
-    george.stop(); 
-    wait(3); 
-}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test_motor.cpp	Tue May 20 14:24:40 2014 +0000
@@ -0,0 +1,74 @@
+/*
+#include "mbed.h"
+#include "m3pi_ng.h"
+
+DigitalOut myled(LED1);
+
+m3pi george;
+
+int main() {
+    
+    //MOTOR TEST 
+
+    //left motor test 
+    for(int i = 0; i < 1000; ++i){
+        george.left_motor(0.3);
+    }
+    george.stop(); 
+    wait(3);  
+    
+    for(int i = 0; i < 1000; ++i){
+        george.left_motor(-0.3);
+    }
+    george.stop();  
+    wait(3); 
+    
+    
+    //right motor test 
+    for(int i = 0; i < 1000; ++i){
+        george.right_motor(0.3);
+    } 
+    george.stop(); 
+    wait(3); 
+    
+    for(int i = 0; i < 1000; ++i){
+        george.right_motor(-0.3);
+    } 
+    george.stop(); 
+    wait(3); 
+    //testing limits 
+    
+    //left motor test 
+     
+    for(int i = 0; i < 1000; ++i){
+        george.left_motor(1);
+    }
+    george.stop(); 
+    wait(3); 
+    
+    for(int i = 0; i < 1000; ++i){
+        george.left_motor(-1);
+    } 
+    george.stop(); 
+    wait(3); 
+    
+    //right motor test 
+    for(int i = 0; i < 1000; ++i){
+        george.right_motor(1);
+    } 
+    george.stop(); 
+    wait(3); 
+    
+    for(int i = 0; i < 1000; ++i){
+        george.right_motor(-1);
+    }
+    george.stop(); 
+    wait(3); 
+    
+    for(int i = 0; i < 1000; ++i){
+        george.right_motor(0);
+    }
+    george.stop(); 
+    wait(3); 
+}
+*/
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test_reflection.cpp	Tue May 20 14:24:40 2014 +0000
@@ -0,0 +1,26 @@
+#include "mbed.h"
+#include "m3pi_ng.h"
+
+DigitalOut myled(LED1);
+
+m3pi george;
+
+int main() {
+
+    int query[5]; 
+
+    george.sensor_auto_calibrate(); 
+    
+    //put into query array of 5 
+    george.calibrated_sensor(query);
+    
+    //locate to print on first line
+    george.locate(0,0);
+    george.printf("%i %i %i", query[0], query[1], query[2]);
+    
+    //locate to print on second line 
+    george.locate(0,1);
+    george.printf("%i %i", query[3], query[4]);
+    
+}
+    
\ No newline at end of file