hi , can you help me in programming botball because i dont know alot about C language
i need the creater move when its see the light , i tried this code but it doesnt work , can you told me what is the wrong?
// Created on Sun Feb 26 2012
#include
int main()
{
wait_for_light(0); // light sensor in analog port 0
printf("I have seen the light!\n");
printf("Drive Straight\n"); // announce the program
sleep(1.0); // wait 1 second
while (create_connect()); // Open the connection between CBC and Create
// As long as the create has not driven 1m
while (get_create_distance(0.1) < 1000)
{
create_drive_direct(250,250); // Drive forward at 250mm/sec
}
create_stop(); // Stop the Create
create_disconnect(); // Disconnect the Create
printf("All Done\n"); // Tell user program has finished
return 0;
}
Hi, welcome to the Botball Community!
"It doesn't work" doesn't help in diagnosing your problem; please tell us (a) what behavior you are expecting, and (b) what behavior you are observing.
Also, please don't ask for help on the Botballer's Chat and leave less than 2 minutes later. Had you stayed in the chat longer, someone might have answered.
Thanks.
-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS
A couple of things. First, having a '#include' with nothing after it will give you a compile error. Removing the '#include' will fix that. Second, you shouldn't put 'create_connect' in a while loop. That line should just be 'create_connect();' Try those and see what happens.
Translation:
Remove the '#include'
change 'while (create_connect());' to 'create_connect();'
-Marty Rand
{
Senior programmer at Norman Advanced Robotics
Former senior programmer at Whittier Middle School
Youth Advisory Council
All around nerd
}
I think the intention of the while loop was to retry a connection if it fails for some reason. create_connect() returns 0 on success, so that should work as intended. Seems a bit overkill to me, but maybe a useful trick if your connection is screwy.
-Jeremy Rand
Senior Programmer, Team SNARC (2012-2013), Norman Advanced (2010-2011), Norman HS (2008-2009), Norman North (2005-2007), Whittier MS (2003-2004)
2012-2013 VP of Tech, 2011 President, Botball YAC (2009-2013)
Mentor, Alcott and Whittier MS
Light sensors have been very common nowadays. I appreciate the hard work of the students who follow the exact programming methods in order to work the light sensors. If you have any guidance, you can definitely share the details over here. cable internet speed
I have bookmarked your website, the articles are route superior to anything other comparative web journals.. a debt of gratitude is in order for an awesome site! Green tech
In this blog many useful topics we have written for understanding programming light sensor details. So, all botball superiorpapers prepared for the community development and bot ball assignment finished programs.