X-Git-Url: http://challenge-bot.com/repos/?a=blobdiff_plain;f=build-stages%2Fh_stay_on_table%2Fh_stay_on_table.ino;h=e2838f5536af086fecbe2dea168cc0b68983c4e2;hb=661ac21e0bd2e7a48c7bed6332e948873f4a2b23;hp=07f7d17230591bea8820e73851b23957ac8f1512;hpb=1b159f3b72bdc0587dba8475134ecb517483d81b;p=challenge-bot diff --git a/build-stages/h_stay_on_table/h_stay_on_table.ino b/build-stages/h_stay_on_table/h_stay_on_table.ino index 07f7d17..e2838f5 100644 --- a/build-stages/h_stay_on_table/h_stay_on_table.ino +++ b/build-stages/h_stay_on_table/h_stay_on_table.ino @@ -14,18 +14,28 @@ */ // define which pins are connected to which components -int right_motor_speed_pin = 3; -int right_motor_forward_pin = 4; -int right_motor_backward_pin = 5; - +// 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; -int left_motor_speed_pin = 8; -int left_motor_forward_pin = 9; -int left_motor_backward_pin = 10; +// 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; void on(int pin){ @@ -48,6 +58,7 @@ void set_motor(int speed_pin, else{ // speed is 0 off(forward_pin); off(backward_pin);} + // since speed has been set positive, no need to check if speed < -255. if(speed > 255){ speed = 255;} analogWrite(speed_pin, speed);} @@ -124,13 +135,13 @@ void loop(){ // adjust this number as necessary for your robot. // it represents how far the table is from your sonar sensor. - // larger values mean larger distance. default is 400 - int right_max_ping_time_over_table = 500; - int left_max_ping_time_over_table = 500; + // 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; // the exact amount of time for turning around might need // twerking for your robot. the default value is 3200 - int turn_around_time = 2133; + int turn_around_time = 3200; int actual_left_ping_time = ping(left_trigger_pin, left_echo_pin); int actual_right_ping_time = ping(right_trigger_pin, right_echo_pin);