define wiring in separate file
[challenge-bot] / build-stages / h_stay_on_table / h_stay_on_table.ino
index e2838f5536af086fecbe2dea168cc0b68983c4e2..fcdfa34315ab83cd214dbfb4434b7958c36a7f14 100644 (file)
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
     along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-// define which pins are connected to which components
-// blue wire
-int right_motor_forward_pin = 3;
-// orange wire
-int right_motor_backward_pin = 4;
-// white wire
-int right_motor_speed_pin = 5;
-
-// yellow wire
-int right_echo_pin = 6;
-// blue wire
-int right_trigger_pin = 7;
-
-// blue wire
-int left_motor_forward_pin = 8;
-// orange wire
-int left_motor_backward_pin = 9;
-// white wire
-int left_motor_speed_pin = 10;
-
-// yellow wire
-int left_echo_pin = 11;
-// blue wire
-int left_trigger_pin = 12;
+#include "bot_map.h"
 
 void on(int pin){
   digitalWrite(pin, HIGH);}
 
 void on(int pin){
   digitalWrite(pin, HIGH);}
@@ -138,7 +115,7 @@ void loop(){
   // larger values mean larger distance.  default is 800
   int right_max_ping_time_over_table = 800;
   int left_max_ping_time_over_table = 800;
   // larger values mean larger distance.  default is 800
   int right_max_ping_time_over_table = 800;
   int left_max_ping_time_over_table = 800;
-  int backup_time = 2000;
+  int backup_time = 1000;
   // the exact amount of time for turning around might need
   // twerking for your robot.  the default value is 3200
   int turn_around_time = 3200;
   // the exact amount of time for turning around might need
   // twerking for your robot.  the default value is 3200
   int turn_around_time = 3200;
@@ -146,6 +123,17 @@ void loop(){
   int actual_left_ping_time = ping(left_trigger_pin, left_echo_pin);
   int actual_right_ping_time = ping(right_trigger_pin, right_echo_pin);
 
   int actual_left_ping_time = ping(left_trigger_pin, left_echo_pin);
   int actual_right_ping_time = ping(right_trigger_pin, right_echo_pin);
 
+  /* int left_led_value = (int)(actual_left_ping_time / 16.0); */
+  /* int right_led_value = (int)(actual_right_ping_time / 16.0); */
+
+  /* Serial.print("left led value = "); */
+  /* Serial.print(left_led_value); */
+  /* Serial.print(", right led value = "); */
+  /* Serial.print(right_led_value); */
+
+  /* analogWrite(left_led_pin, left_led_value); */
+  /* analogWrite(right_led_pin, right_led_value); */
+
   Serial.print("left ping = ");
   Serial.print(actual_left_ping_time);
   Serial.print("\tright_ping = ");
   Serial.print("left ping = ");
   Serial.print(actual_left_ping_time);
   Serial.print("\tright_ping = ");