Society of Robots - Robot Forum
Software => Software => Topic started by: Armouralis on January 07, 2009, 08:35:53 PM
-
hey all,
i just finished the $50 robot :), and now i upgraded the sharp ir sensor that admin nicely explain to us.
i would like to now upgrade my robot and change the code with the sharp ir range finder
i have very little experiance with programming in C, and i hardly know the syntax, so i asking help from you guys!
whats the syntax of the code to "hardcode in a particular value for the distance" in the sharp ir range finder
thx all in advance!!!
-
my previous post might not have been very clear:
idealy i want to have a robot with two sensors, one on the left, one on the right.
the pseudo code that i plan is this:
if left sensor indicates that it is > 3 inches from object (wall) then left wheel(s) go forward
if right sensor indicates that it is > 3 inches from object then right wheel go forward
else if left sensor indicates that it is < 3 inches from object then left wheel go backwards
else if right sensor indicates that it is < 3 inches from object then right wheel go bakcwards
else
left wheel dont move
right wheel dont move
admin posted the ir code for the $50 robot and would like to know :
how to modify (what to change) in the code for the robot to do as i described
i just started to learn to program in school in the MS-DOS based language "Turing," so i can kind of undersand the code, but i do not know the syntax
thx for your help in advance
-
You are pretty much asking us to write the code for you . . .
Look at my $50 Robot code and try to make sense of it - its all heavily commented. Do your best to write your code and post it here if you aren't sure about it. We are here to direct you and fix your bugs, but "only you can build your own robot" :P
-
thx admin, i will try my best and get on that
but what is the code to "hard code" a distance for the sharp ir range finder?
like you use the auto callibration method, i want to have the callibration right in the code, not have to put my hand in front of it every time. How could i do that?
-
"Hard code" just means that you preprogram a specific value that you tested to be good, such as:
int IR_threshold = 48;
An autocalibration would be like:
wait_for_hand(delay);
IR_threshold=read_IR_sensor();