Let's Make Robots!

Edwardo V3.0

RobotSketch.txt2.84 KB
Edwardo_Front.JPG1.66 MB
Edwardo_Romeo.JPG1.81 MB

This is the improved version of the Edwardo V2.0 posted by Grimjack1973. We are working in colaboration and had to change the chasis design due to a few flaws. We have finished assembly and moved onto programming however I have hit a problem in the programming area. The aim is to allow the robot to completely non-autonomous roam around while using the pan-tilt servo system to move the Sharp IR sensor located at the front to perform obstacle avoidance. I have provided a text file of the sketch along with as much information as possible in the "additional information" section and shall be happy to provide anymore if needed.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

It looks pretty good actually. A few things though:

First off, I would put the "direction" routines below the main loop and instead start the sketch with the setup loop. Its just sorta the "standard" way of things.

The main issue you have is the fact that while the servos are scanning back and forth (in the for loop), they are only doing that. You are not checking your sensor during these sweeps. Currently, you sweep from L to R, then from R to L then take one single reading, then you go into your IF's and then turn/forward etc. Instead, you shoud do a sensor check inside of the for loop that is moving your servo.

Also, you are using an analog sensor and an analog pin, but you are treating it as if it is digital. Your "are we too close?" statement is doing a digital read of that sensor. This is incorrect. I would do some stand-alone testing of your sensor using an analogRead and the serial monitor and you can get an idea of the numbers coming out of the sensor and how to work with them.

All in all, you are about 80% there.

Thank you I am currently reworking the sketch base off your feed back; However, I had another question. in the code where it states

"void advance(char a,char b)"

is there any way to adjust that for 4 charaters such as:

"void advance(char a,char b,char c,char d)"

I ask because that always errors out for me as does using 2 characters trying to script for 4 motors. Are two characters all thats needed to run 4 motors. as I listed in the additional infomation section we have two dual-motor cases each running 2 DC motors.