The aim of my project is to collect all the green circles around the cardboard field(92cm*122cm), and without leave the filed. I was tried to using if else() to assist me to reach the aim, but the code I coded was totally doesn't work... the program will just finsih immediately...I need some help....><

I want to using light sesor to dectecting the green points and to avoiding the robot leave the field. out side the caredboard is the black carpet, so I set the threshold between black and whit(cardboard), and white(cardboard) and green. And the method Iwant to using is spining out from the center of the field(cardboard), than if detecting the green point the robot will have a beep sound, after the robot spinning to the black carpet, it will turn around and back to the field and move forward and keep finding the green points, and while the action for 20mins. Above is my draft code, but totally doesn't work... i hope some one can give me some sugguest and help me to finish my project~><please~

You might want to add sensor calibration for each threshold in case the lighting changes. You could probably get more help if you added more info about the field.

BTW, next time use the "Code" tags for a program to preserve the spacing.

_________________A.K.A. inxt-generationSelf-proclaimed genius, and future world dominator.My Brickshelf Folder"Don't they teach recreational mathematics anymore?" - The Tenth DoctorBow down to Nikola Tesla, King of the Geek Gods.

Mon Nov 28, 2011 9:36 pm

Coder A

Moderator

Joined: Thu Jan 03, 2013 5:10 pmPosts: 198Location: The plateau north of the Ohio River Valley, also known as Cave Country.

Re: Can anyone give me some help on my project? please~

Also, the program is set to only run for 2000 milleseconds. You should change this to minutes by uxing the nclockminutes variable. Next, you should change the '==' inside the while to '<', or the code will exit the while immediately anyway. Finally, you can still not declare a body to a control structure and it will just make the very next command block its body. If, else, while, for, and so on are not statements, so your first block under the first if was the loop's block.

I hope this helps!

-Coder A

_________________I'm not a robot! I'm british! ~ quote from an asparagusI am not a robot! I am a unicorn! ~ quote from a robot

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum