X-Git-Url: http://challenge-bot.com/repos/?a=blobdiff_plain;f=build-stages%2Fh_stay_on_table%2Fh_stay_on_table.ino;h=26ecf2c40a6f072dd6a459cad7a92626890105ed;hb=b3ab14a78f73759705c9b7db3300b94b4b206ce6;hp=40631b1a83f1f0a2cb4a1e5c66a861391c0aca14;hpb=34a3efe63ba555a19a9fb1346c3c8a5c50cfa7bc;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 40631b1..26ecf2c 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,9 +14,9 @@ */ // 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; +int right_motor_forward_pin = 3; +int right_motor_backward_pin = 4; +int right_motor_speed_pin = 5; int right_echo_pin = 6; int right_trigger_pin = 7; @@ -48,6 +48,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 +125,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);