Anyone willing to give me a hand with this code please feel free to jump right in.
I have spent any hours trying to get this to work. I sure have gotten closer but the bot seems to get stuck n reverse for whatever reason. He will stay in reverse untill i bring my hand close to the sensor and then move it away very quickly.
He then continues forward. Sometimes it seems like he wants to turn toward the object he sees
Picaxe 28x1 with sharp GP2D12
I have made many changes to Fritsl's code, Some changes I understood and others I did not.
A 10uF (10 microfarad) capacitor between Power and Ground, and attached directly to the sensor would be best. Be careful that polarity is correct (Ground to ground, power to power).
The 2nd graph shows use with The 2nd graph shows use with a 0.1uf capacitor, and shows a significantly reduced voltage spike from the sensor, and is much better than no capacitor.
Question… If you can’t figure out how to write your own code, how in the world do you think you can figure out and modify someone else’s code? I’m not sayin’… I’m just sayin’.
You can call it lysdexia, call it scatterbrain, call it difficult student, call it what you will.
The same way I got through part one I guess. I did write my own code for part one but would never have been able too without the original code.
I have a problem reading. I have read through the manuals and they are all the paper matter that I read. Its still all a fog to me. I will get there in time hey, but no harm in trying to get some hand outs from fellow LMRtians. <–(you know I didn’t mean it that way:)
Truth is I have started on my own code but am not getting far with it yet so I decided I have to get Fritsl’s code working with the IR sensor.
At the end in the “BIGGER PICTURE” I will be using an SRF05 but I wont go there till I know what I am working with now.
Anyone contributing will be part of the "BIGGER PICTURE" What is the “BIGGER PICTURE” you ask?
Stick around to find out
Thanks for commenting Chris, I have read through most of your posts, comments and projects and have gotten much inspiration from your work. Thank you
It would appear to me that you have 3 vaiables - head, range and puls all set to the same actual variable space (b1). You are then comparing them so obviously the comparison sees equallity. Try setting them to seperate variables, for example -
head b1, range b2, puls b3.
It seems a common problem with limited resources to overuse things like this. Another issue with the PICAXE is that the word variables are created by using two byte variables so you shouldn’t use b1 and w1 together for example.
Oh come on ctc, some of the Oh come on ctc, some of the best ways to learn is by understanding what other people have done…as you gain your own skills you usually end up with an Oh Wow moment.
Oooh, good point about the Words and Bytes overlapping.
w0 consists of b0 and b1
w1 consists of b2 and b3, I think.
Puls is a subroutine which populates the range variable from the ADC. Depending on the PICAXE chip, I think the ADC resolution is 10bits? So this needs to be a Word.
Try this, to avoid the overlaps:
symbol head = b0 'Which way the servo & sensor is currently looking symbol Remember = b1 ’ Temorary variable just used in routines and loops symbol range = w1 '16 bit word variable for range
I’m just saying that I tried and tried and tried and tried to modify this very code and failed and failed and failed. I stabbed away at it randomly and managed to do and undo (without knowing what I was doing and undoing). Then I started writing my own code… and it took forever! I started with a simple code for the motors (F,B,R,L) then one for the sonar etc. --each one being just a few lines long. In doing this slow, step-by-step study of each “sub-system” I eventually got to a point where I could interperate code enough to know what was going on in someone else’s code and ONLY THEN be able to modify it.
Now, reading other people’s code, changing it and learning is great, period. But think about this: "I don’t understand code, but I used someone else’s code, changed “something” or many “somethings” now it doesn’t work --what did I do?"
I simply feel that this is one of those questions where we could sit here for months throwing out answers, “it could be this, it could be this, it could be this, it could be this.” I also think this falls into the catagory of “I know nothing of step 1, 2 or 3 and I am asking about step 47”
I mean no disrespect, I just think this problem/ question might be a bit broad.
Chris The Carpenter Is Right! I agree with Chris The Carpenter. Using your own Super Brain will get you to the top. I too have tampered with Frits’ code and can tell you that it is Dangerous and can cause serious bodily injury! So leave it alone and write your own…