Page 1 of 1

Help with project (Variables and data logging/light sensors)

Posted: 08 Dec 2011, 13:57
by johnsmithbear
Could someone please have a look at this code and give me any pointers on how to make it work? Its supposed to roam around a white arena and it has a black outline if it hits the outline it is to reverse at a random degree and carry on moving, once it hits a shaded square it will make a noise and stop. For the data logging it is supposed to count up and display how many times it has detected that colour/dodged the edge of the arena. It is also supposed to detect nearby objects and reverse and change direction, for some reason it just isnt working and stops as soon as it hits the edge of the arena without carrying on.

The arena = white
edge of arena = black
shaded squares within arena = green
meant to come to a stand stil on a light blue square.

Any help would be greatly appreciated.

Thanks.

Johnsmithbear.

Re: Help with project (Variables and data logging/light sensors)

Posted: 08 Dec 2011, 14:02
by johnsmithbear
where is my attachment??

Re: Help with project (Variables and data logging/light sensors)

Posted: 08 Dec 2011, 14:10
by h-g-t
Did you zip it?

Re: Help with project (Variables and data logging/light sensors)

Posted: 08 Dec 2011, 14:13
by johnsmithbear
Zipped it.

Does it work now?

Re: Help with project (Variables and data logging/light sensors)

Posted: 12 Dec 2011, 13:06
by johnsmithbear
Any help is urgently required if possible?

Re: Help with project (Variables and data logging/light sensors)

Posted: 12 Dec 2011, 13:35
by inxt-generation
Have you tested to see if all the different colors have enough contrast? Or are you using a color sensor?

Re: Help with project (Variables and data logging/light sensors)

Posted: 12 Dec 2011, 13:52
by johnsmithbear
yes we have, I think the problem lies in the fact that once it has detected the first thing it detects the robot is just stopping instead of carrying on moving if you get what I mean?

Re: Help with project (Variables and data logging/light sensors)

Posted: 13 Dec 2011, 03:44
by inxt-generation
I've looked at your code, and made what improvements I can. I'm not sure what is causing your problem, but I think you should try this.

Re: Help with project (Variables and data logging/light sensors)

Posted: 13 Dec 2011, 14:18
by hassenplug
inxt-generation: when offering alternate code, please try to explain any changes you made. I didn't notice anything different in your code.

johnsmithbear: I assume this is not what you intended: When the light reading is between 37-42, the robot will backup one rotation, turn for ZERO degrees, then continue forward. (it's actually set to turn forever, but not wait any time)

It doesn't exactly sound like that's your only problem. I'd suggest you display your counter values INSIDE the main loop, so you can see if they're changing.

Steve

Re: Help with project (Variables and data logging/light sensors)

Posted: 13 Dec 2011, 15:07
by yogibeariscool
hi there im a friend of johnsmithbear, the aim is to get the robot using the light sensors on the code to negotiate between white (continues moving) light grey (counts 1) dark grey (stops and finishes) and black (stops reverses and rotates)

iv looked at the code that has been changed and i cannot see the difference have you uploaded the correct one? try changing the file name, your help is much appreciated thankyou.

Not only should the robot use the light sensor as above, it should also use the ultrasonic sensor to navigate objects. If it helps i can send you the brief for the task. The deadline for this is wednesday evening, and were currently stumped by what is happening.

Once again thankyou for your help its much appreciated