Society of Robots - Robot Forum
Electronics => Electronics => Topic started by: JSH21 on August 22, 2008, 02:06:02 PM
-
OK, i am making a wall avoiding robot being driven by 2 continuous rotation servo motors, with a Sharp GP2D12 IR sensor and was wondering if anyone had a code for doing such task. It is using an Arduino Diecimila board, and i have checked several posts and sites for a code but most of them use ultrasonic sensors or are driven by motors instead of servos. So any help would be appreciated
and also, is this the correct way to connect the sensors and servo's to the board?
http://www.societyofrobots.com/robotforum/index.php?action=dlattach;topic=3653.0;attach=1420;image
-
http://www.societyofrobots.com/member_tutorials/node/45
-
This tutorial uses motors to move the robot, but my robot is using continuous rotation servos
-
and an ultrasonic sensor not IR
-
Ok, to use the servo motors with Arduino, you have to download and install the Servo.h library from here: http://www.arduino.cc/playground/uploads/ComponentLib/servo.zip (http://www.arduino.cc/playground/uploads/ComponentLib/servo.zip) and read about using it here: http://www.arduino.cc/playground/ComponentLib/Servo (http://www.arduino.cc/playground/ComponentLib/Servo)
You can read about using a GP2D12 sensor here: http://www.arduino.cc/playground/Main/ReadGp2d12Range (http://www.arduino.cc/playground/Main/ReadGp2d12Range)
Good luck!
Edit: Yes, the image shows the correct way to connect the servos and the sensor to Arduino board. There is a page that shows the way to connect different things to Arduino here: http://wiring.org.co/learning/tutorials/diagrams.html (http://wiring.org.co/learning/tutorials/diagrams.html)
-
Thank you very much!:) that helped A LOT
but just one more question, how do you get the servo library from the file from the first link?
Is it actually a software that controls servo's or is it somehting you have to add on and to where?
and do i still write all my codes into the "blink" software that i used to test the flashing LED?
or is there another program i use?
-
Quote from the second link:
You can find the code in http://www.arduino.cc/playground/uploads/ComponentLib/servo.zip. Unpack that into your lib/targets/libraries folder to add the library.
Everything you need is explained there. Take some time to read through and use the links on the left to see other code samples, even if they are not related to what you need to do. It will help you understand how things are working in the Arduino software.
-
I cant seem to find the location where you are suipposed to unpack the files
-
This uses the same microcontroller as the Arduino:
http://www.societyofrobots.com/robot_50_robot_sharpIR.shtml