Author Topic: $50 robot sharp ir new code help plz  (Read 3172 times)

0 Members and 1 Guest are viewing this topic.

Offline ArmouralisTopic starter

  • Jr. Member
  • **
  • Posts: 13
  • Helpful? 0
$50 robot sharp ir new code help plz
« 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!!!

« Last Edit: January 08, 2009, 07:20:12 PM by Armouralis »

Offline ArmouralisTopic starter

  • Jr. Member
  • **
  • Posts: 13
  • Helpful? 0
Re: $50 robot sharp ir new code help plz
« Reply #1 on: January 08, 2009, 07:24:30 PM »
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

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: $50 robot sharp ir new code help plz
« Reply #2 on: January 09, 2009, 10:01:48 PM »
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

Offline ArmouralisTopic starter

  • Jr. Member
  • **
  • Posts: 13
  • Helpful? 0
Re: $50 robot sharp ir new code help plz
« Reply #3 on: January 10, 2009, 11:45:09 AM »
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?

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: $50 robot sharp ir new code help plz
« Reply #4 on: January 15, 2009, 09:44:02 PM »
"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();

 


Get Your Ad Here