Hi, I am new here and a newbee to robots and programing. I have the basic starter kit and have the square bot built. I have two bumpers on the front and two on the back for full range wall detection.
My version of Easy-C is v1.1
I have read through the book, the help files, searched this forum, watched the 29 minute video here on the line follower robot with the arm, watched other vids, and searched all of google for about 7 hours now total. (= So far no answer to this question.
I found on person asking this here about two bumpers but all the answers to him were just to read books on C and learn the programing language. I would like to know how to do this using only Easy-C as I am just building this for a friend.
So far I have one bumper working…that was easy…just followed the book.
Any help here would be AWESOME! (=
Many thanks in advance,
Jay
Oh, also, is there any way my/his software can be upgraded to easy-c v2 without paying extra? Thanks. (=
Jay welcome to the club. Don’t expect direct “here’s how you do it” answers from the forum. Aside from the technical FAQs most replies will just point the way. It’s frustrating but once you get past the problem you own it.
Now, Grasshopper… think of how the bumper switch works–it’s either on or off right? When it’s not pushed (open) the switch is on ( | ) not off ( O ), in other words think of it as True or False. This is the same for how ever many switches you would hook up. What is the condition, or state, of the switches when they are open as compared when one is pressed? How would you compare them in an equation?
This was one of the first problems I had to figure out. You’ll get it.
Hope this helped. Cheers!
Thank you.
I do understand what you mention in your post…um, but it’s the propper structure of the programing code I can’t get down. I have continued working on it without a break since I posted. I have tried enerything (if, if else, for, while, many different assignments) in many different structures/formats of code. I am just missing the magic somehow.
It still remains that I need to know how to make the program exit a while or if loop and return to the start of the code to “go forward” again. The two “if”'s at the bottom work the same as when I had them as “while loops”. The bot will go forward then when one of the bumpers is hit it will turn correctly…the problem is it never stops turning to go forward again.
All this code is from trial and error so any comments on improovement of the code would also be welcome…
Through um-teenth iterations this is were my code is at now: Attatched
Jasons Auto-1.1.zip (1.35 KB)
I looked at your code on my Mac (I only have the PC to program the Vex) and despite all the extra text characters and junk I can kinda see what your doing.
It looks like you’re using 3 variables: X, bumper1, and bumper2. What does X do? At the beginning of the code you have while X==1 then later you have if statements for X testing if it is less than 0. Where in the code does this value get reassigned? Regardless, you’re writing more code than you need.
You already have the two variables you need: bumper1 and bumper2. As variables they each represent a value either 1 or 0. The variables will be 1 when the bumpers are NOT pressed. You already understand math operator = (equal). What is the math operator for NOT equal?
So in psuedo code maybe…
Start while loop
Go straight
if bumper1 doesn’t equal bumper2
turn
Remember your variables represent a numeric value and you can do math with them to test a condition.
Thank you for the help but I need to clearify. I did the code the way you said and your right, it makes it turn but only one direction whether either bumper is pressed. What I am looking for is a way to make it turn away from the wall according to which direction it needs to. My program (finnaly) made it do this correctly but I could not make it return to “forward” motion. It has to be possible to use more than one sensor/bumper for different commands.
Any help is greatly appretiated;)
Thank for your help so far.
Got it! Now that it’s 7:30 am!
I will post my program latter today. Good night!
TTYL,
Jay
Good news. I knew you’d get it.
Yeah, post the code I’d like to see.
Good morning…er…afternoon…
I have added a “head” servo that looks in the direction of the collision as well and attached a simple plastic lobster for good looks. The bumper works perfectly all the way accross…even if it is impacted directly center!
Next I want to add smarts to it. Something like…forward…hit any bumper 5 times within 10 seconds…back up(sensing rear bumpers)…turn ~90(away according to which front bumper counted to five first)…go forward again…
I’d also like to add some randomly timed stop…look…turn events to add a sense of AI to it.
Is this asking too much of this robot?
Ok, here it is. Any feedback on the bot or my program is welcome. For those who don’t know…the zip file is my program for two “bumper” directional turn sensing from Basic-C
Thank again.
(PS. Wow, I can’t believe how small images have to be to upload them. Save(if needed) and Open with Windows Picture and Fax Viewer and zoom in. Photoshop zooms without antializing so in this case WPaFV is better.)
Lobster Bot-1-top-2.bmp (19.2 KB)
Lobster Bot-1-Bottom.bmp (18.4 KB)
Jasons Auto-1.4.zip (1.55 KB)
hey
i made a program not to long ago for an autonomous/RC mix. the robot would respond to normal RC controls but i had one bumper and two limit switches on the front that would give the robot signals. depending on which switch was hit the robot would do something different.(backup, go forward, or turn left or right)
i have it set for a 4-W drive configuration but you could just change the motor settings to fit your robot. tell me if it works.email: [email protected]
RC_CONTROL_NEW_2-17-08_8pm.zip (3.32 KB)