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

Discussion specific to projects ideas and support.
Post Reply
johnsmithbear
Posts: 5
Joined: 08 Dec 2011, 13:47

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

Post 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.
johnsmithbear
Posts: 5
Joined: 08 Dec 2011, 13:47

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

Post by johnsmithbear »

where is my attachment??
h-g-t
Posts: 552
Joined: 07 Jan 2011, 08:59
Location: Albania

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

Post by h-g-t »

Did you zip it?
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
johnsmithbear
Posts: 5
Joined: 08 Dec 2011, 13:47

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

Post by johnsmithbear »

Zipped it.

Does it work now?
Attachments
arena.zip
Zipped?
(590.14 KiB) Downloaded 418 times
johnsmithbear
Posts: 5
Joined: 08 Dec 2011, 13:47

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

Post by johnsmithbear »

Any help is urgently required if possible?
inxt-generation
Posts: 290
Joined: 03 Oct 2011, 00:06
Location: Gallifrey
Contact:

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

Post by inxt-generation »

Have you tested to see if all the different colors have enough contrast? Or are you using a color sensor?
A.K.A. NeXT-Generation.
"A kingdom of heaven for RobotC now has recursion!"
johnsmithbear
Posts: 5
Joined: 08 Dec 2011, 13:47

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

Post 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?
inxt-generation
Posts: 290
Joined: 03 Oct 2011, 00:06
Location: Gallifrey
Contact:

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

Post 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.
Attachments
arena.zip
Helped?
(586.73 KiB) Downloaded 489 times
A.K.A. NeXT-Generation.
"A kingdom of heaven for RobotC now has recursion!"
hassenplug
Posts: 346
Joined: 27 Sep 2010, 03:05
Contact:

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

Post 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
---> Link to lots of MINDSTORMS stuff under my picture --->
yogibeariscool
Posts: 1
Joined: 13 Dec 2011, 15:03

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

Post 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
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 0 guests