define wiring in separate file
authordaniel watson <ozzloy@gmail.com>
Mon, 11 Dec 2017 08:42:03 +0000 (00:42 -0800)
committerdaniel watson <ozzloy@gmail.com>
Mon, 11 Dec 2017 08:45:48 +0000 (00:45 -0800)
Change-Id: I892c815c707b2032ab576b9aa953d283624daa3e

build-stages/g_follow/bot_map.h [new file with mode: 0644]
build-stages/g_follow/bot_with_leds_map.h [new file with mode: 0644]
build-stages/g_follow/g_follow.ino
build-stages/h_stay_on_table/bot_map.h [new file with mode: 0644]
build-stages/h_stay_on_table/bot_with_leds_map.h [new file with mode: 0644]
build-stages/h_stay_on_table/h_stay_on_table.ino

diff --git a/build-stages/g_follow/bot_map.h b/build-stages/g_follow/bot_map.h
new file mode 100644 (file)
index 0000000..9ba5307
--- /dev/null
@@ -0,0 +1,57 @@
+// license info at bottom of file
+// tl;dr AGPLv3+
+
+/*
+  define which pins are connected to which components
+*/
+
+//////////////////////
+// right motor
+//////////////////////
+// blue wire
+int right_motor_forward_pin = 3;
+// orange wire
+int right_motor_backward_pin = 4;
+// white wire
+int right_motor_speed_pin = 5;
+
+//////////////////////
+// right sonar sensor
+//////////////////////
+// yellow wire
+int right_echo_pin = 6;
+// blue wire
+int right_trigger_pin = 7;
+
+//////////////////////
+// left motor
+//////////////////////
+// blue wire
+int left_motor_forward_pin = 8;
+// orange wire
+int left_motor_backward_pin = 9;
+// white wire
+int left_motor_speed_pin = 10;
+
+//////////////////////
+// left sonar sensor
+//////////////////////
+// yellow wire
+int left_echo_pin = 11;
+// blue wire
+int left_trigger_pin = 12;
+
+/*
+ This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU Affero General Public License as
+    published by the Free Software Foundation, either version 3 of the
+    License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Affero General Public License for more details.
+
+    You should have received a copy of the GNU Affero General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
diff --git a/build-stages/g_follow/bot_with_leds_map.h b/build-stages/g_follow/bot_with_leds_map.h
new file mode 100644 (file)
index 0000000..0f5efee
--- /dev/null
@@ -0,0 +1,69 @@
+// license info at bottom of file
+// tl;dr AGPLv3+
+
+/*
+  define which pins are connected to which components
+*/
+
+//////////////////////
+// right LED
+//////////////////////
+// white wire
+int right_led_pin = 3;
+
+//////////////////////
+// right motor
+//////////////////////
+// blue wire
+int right_motor_forward_pin = 2;
+// orange wire
+int right_motor_backward_pin = 4;
+// white wire
+int right_motor_speed_pin = 5;
+
+//////////////////////
+// right sonar sensor
+//////////////////////
+// yellow wire
+int right_echo_pin = 6;
+// blue wire
+int right_trigger_pin = 7;
+
+//////////////////////
+// left motor
+//////////////////////
+// blue wire
+int left_motor_forward_pin = 8;
+// orange wire
+int left_motor_backward_pin = 13;
+// white wire
+int left_motor_speed_pin = 10;
+
+//////////////////////
+// left sonar sensor
+//////////////////////
+// yellow wire
+int left_echo_pin = 11;
+// blue wire
+int left_trigger_pin = 12;
+
+//////////////////////
+// left LED
+//////////////////////
+// blue wire
+int left_led_pin = 9;
+
+/*
+ This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU Affero General Public License as
+    published by the Free Software Foundation, either version 3 of the
+    License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Affero General Public License for more details.
+
+    You should have received a copy of the GNU Affero General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
index 02f6d96e688e0d5bff610228d1d9e490e5b1af42..b9cc4af943a01f5a3c06505fc3cab86198551c30 100644 (file)
@@ -1,48 +1,7 @@
-/*
- This program is free software: you can redistribute it and/or modify
-    it under the terms of the GNU Affero General Public License as
-    published by the Free Software Foundation, either version 3 of the
-    License, or (at your option) any later version.
+// license info at bottom of file
+// tl;dr AGPLv3+
 
 
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Affero General Public License for more details.
-
-    You should have received a copy of the GNU Affero General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-// right side LED, white wire
-int right_led_pin = 3;
-
-// define which pins are connected to which components
-// blue wire
-int right_motor_forward_pin = 2;
-// 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 = 13;
-// white wire
-int left_motor_speed_pin = 10;
-
-// yellow wire
-int left_echo_pin = 11;
-// blue wire
-int left_trigger_pin = 12;
-
-// left side LED, blue wire
-int left_led_pin = 9;
+#include "bot_map.h"
 
 void on(int pin){
   digitalWrite(pin, HIGH);}
 
 void on(int pin){
   digitalWrite(pin, HIGH);}
@@ -135,16 +94,16 @@ void loop() {
   unsigned int actual_left_ping_time = ping(left_trigger_pin, left_echo_pin);
   unsigned int actual_right_ping_time = ping(right_trigger_pin, right_echo_pin);
 
   unsigned int actual_left_ping_time = ping(left_trigger_pin, left_echo_pin);
   unsigned 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);
+  /* 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); */
 
 
-  analogWrite(left_led_pin, left_led_value);
-  analogWrite(right_led_pin, right_led_value);
+  /* Serial.print("left led value = "); */
+  /* Serial.print(left_led_value); */
+  /* Serial.print(", right led value = "); */
+  /* Serial.print(right_led_value); */
 
   left_speed = actual_left_ping_time - desired_left_ping_time;
   right_speed = actual_right_ping_time - desired_right_ping_time;
 
   left_speed = actual_left_ping_time - desired_left_ping_time;
   right_speed = actual_right_ping_time - desired_right_ping_time;
@@ -160,3 +119,18 @@ void loop() {
   Serial.println();
 
   go(left_speed, right_speed); }
   Serial.println();
 
   go(left_speed, right_speed); }
+
+/*
+ This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU Affero General Public License as
+    published by the Free Software Foundation, either version 3 of the
+    License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Affero General Public License for more details.
+
+    You should have received a copy of the GNU Affero General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
diff --git a/build-stages/h_stay_on_table/bot_map.h b/build-stages/h_stay_on_table/bot_map.h
new file mode 100644 (file)
index 0000000..9ba5307
--- /dev/null
@@ -0,0 +1,57 @@
+// license info at bottom of file
+// tl;dr AGPLv3+
+
+/*
+  define which pins are connected to which components
+*/
+
+//////////////////////
+// right motor
+//////////////////////
+// blue wire
+int right_motor_forward_pin = 3;
+// orange wire
+int right_motor_backward_pin = 4;
+// white wire
+int right_motor_speed_pin = 5;
+
+//////////////////////
+// right sonar sensor
+//////////////////////
+// yellow wire
+int right_echo_pin = 6;
+// blue wire
+int right_trigger_pin = 7;
+
+//////////////////////
+// left motor
+//////////////////////
+// blue wire
+int left_motor_forward_pin = 8;
+// orange wire
+int left_motor_backward_pin = 9;
+// white wire
+int left_motor_speed_pin = 10;
+
+//////////////////////
+// left sonar sensor
+//////////////////////
+// yellow wire
+int left_echo_pin = 11;
+// blue wire
+int left_trigger_pin = 12;
+
+/*
+ This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU Affero General Public License as
+    published by the Free Software Foundation, either version 3 of the
+    License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Affero General Public License for more details.
+
+    You should have received a copy of the GNU Affero General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
diff --git a/build-stages/h_stay_on_table/bot_with_leds_map.h b/build-stages/h_stay_on_table/bot_with_leds_map.h
new file mode 100644 (file)
index 0000000..ebb554c
--- /dev/null
@@ -0,0 +1,48 @@
+// license info at bottom of file
+// tl;dr AGPLv3+
+
+// right side LED, white wire
+int right_led_pin = 3;
+
+// define which pins are connected to which components
+// blue wire
+int right_motor_forward_pin = 2;
+// 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 = 13;
+// white wire
+int left_motor_speed_pin = 10;
+
+// yellow wire
+int left_echo_pin = 11;
+// blue wire
+int left_trigger_pin = 12;
+
+// left side LED, blue wire
+int left_led_pin = 9;
+
+/*
+ This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU Affero General Public License as
+    published by the Free Software Foundation, either version 3 of the
+    License, or (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU Affero General Public License for more details.
+
+    You should have received a copy of the GNU Affero General Public License
+    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
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 = ");