go_away

Author Topic: Ultra Sonic Range Finder "Good Tutorial"  (Read 1885 times)

0 Members and 1 Guest are viewing this topic.

Offline AdvsNoobTopic starter

  • Robot Overlord
  • ****
  • Posts: 156
  • Helpful? 0
  • Younge Inventer
Ultra Sonic Range Finder "Good Tutorial"
« on: April 29, 2009, 09:42:33 PM »
Hay im new in working with this type of sensor.. Is there a good tutorial that will show me how to make something happedn like lets say run another command to search with the servo to turn it left and right...

If you where able to under stand that...

Simple explanation

When i get lets say 4 in's to a wall, It will Goto another script to move a servo left 90 degrees and right 90 degrees

Sorry for bad English!

Offline hazzer123

  • Supreme Robot
  • *****
  • Posts: 460
  • Helpful? 3
Re: Ultra Sonic Range Finder "Good Tutorial"
« Reply #1 on: May 02, 2009, 04:33:27 AM »
If you are already able to get readings from the sensor then the rest is just programming. Something like this would be easy.

Code: [Select]
while(1) {
  if(sensor_reading > 4inches) {
    go_forward();
  } else {
    servo_routine();
  }
}

There are other ways of doing it... Maybe you could set an interrupt on the event of a comparator toggle (if the sensor can give an analogue voltage output). Or you could have a timer interrupting the code for a regular check of the sensor readings. These methods would allow your robot to do other things at the same time (with ease).
Imperial College Robotics Society
www.icrobotics.co.uk

Offline AdvsNoobTopic starter

  • Robot Overlord
  • ****
  • Posts: 156
  • Helpful? 0
  • Younge Inventer
Re: Ultra Sonic Range Finder "Good Tutorial"
« Reply #2 on: May 02, 2009, 06:33:03 PM »
ya we got it set up using less than and equal to, its working nicely but the thing that sucks is he lives 20 mins away but we got far!

Here is the robots page

http://www.societyofrobots.com/member_tutorials/node/224

 


Get Your Ad Here

data_list