We are working with the BASIC Atom Pro 28-pin. I will look up some sample codes for the SRF-04, but there is a slight problem. We are tasked to create some sample code first, then we pass it off to the electrical team. Thats where google comes into play, do a little searching find some sample code, learn what it does and how it works. Thanks for the ideas. Thats all i really needed.
Hello, this is the new account for the PVHS group, we had been using one member’s account before and felt bad when we made posts in his name (we kinda had to at the time).
We are working on a sonar unit for our rover. We probably will not be the ones to finish this particular part, but we are responsible for the basic groundwork, such as making said sonar work with our 28-pin Basic Atom and Bot Board.
The sample code we found that is giving us problems for the moment is as follows.
[code]wDist var word
convfac var word
main
convfac = 74
gosub sr_sonar
debug DEC wDist, cr
pause 200
gotomain
The problem is in line 7, and no matter what I tried personally the error stayed there and merely changed faces. Usually the error is Unexpected Token type (DEC) or “Expected “.
I would link to the exact site where you can see the sonar unit but I can’t with this account yet, once it allows me to I will if I need to.
Hi, I’m part of the new year for this project. I have the orginal topic starter for this project sitting next to me.
He said he could never get it to work. Saying that reading he got were weird, and never read accurately (Get diffrent reading for the same distance of an object.)
I’m relitively new to the program and enginnering itself and I’m wondering if you guys could give me some pointers and helpful tips so I can get it working at least.
And by “it” I mean the sonar.
If you need anymore information, just ask and I’ll try to give it to you.
Well it might be a good place to start by actually connecting everything and downloading the program. Then you can tell us exactly what errors you are getting.
We would also need to know which version of the IDE are you using?
An image of the wiring would help.
This is not a complicated project. Sad to see it drag on for so long.
Here it is. It took me a couple hours to get it sorted out. This is for the IDE ver 8.0.1.7. It will work with the Mini-ABB and the Bot Board.
I hope I get a good grade!
[code]wdist var word
low p10 ;pin to initiate the sensor
low P11 ;pin to measure the return pulse
main:
pause 10
pulsout p10, 20
pulsin 11, 0, toolong, 40000, wdist
wdist = wdist / 148 ;convert for inches
serout s_out, i9600, "Distance: ", sdec wdist, 13, 10] ;display result in terminal
goto main
toolong: ; if the program gets here the sensor is not functioning, or wired wrong
serout s_out, i9600, “Timeout, sensor is not working”, 13]
goto main[/code]
From reading above I have no idea who you are talking to… I wrote a program specifically for you. I have tested it and it works flawlessly. Why don’t you tell me what problems you are having with it. To make this SUPER easy I will paste it here so you don’t have to scroll up two posts.
[code]wdist var word
low p10 ;pin to initiate the sensor
low P11 ;pin to measure the return pulse
main:
pause 10
pulsout p10, 20
pulsin 11, 0, toolong, 40000, wdist
wdist = wdist / 148 ;convert for inches
serout s_out, i9600, "Distance: ", sdec wdist, 13, 10] ;display result in terminal
goto main
toolong: ; if the program gets here the sensor is not functioning, or wired wrong
serout s_out, i9600, “Timeout, sensor is not working”, 13]
goto main[/code]
You do realize that a 28015 is a PING, not an SRF-04! Right?
People can only help you with an equivalent accuracy as the information they are provided by you. It’s no wonder that the code I wrote for you doesn’t work. You asked for code examples for a sensor you don’t have.
We would love to help you fine tune your code. Go ahead and post what you have and we will try to help point you in the right direction… 8)
A photograph or two of what you have wired up wouldn’t hurt one bit at all either… as a matter of fact it probably would have saved a whole lot of time for a lot of people by now since had you posted one oh say 4 months ago then someone might have realized there were only 3 wires going to the sensor and not 4!
No robot dude, I didn’t realize that at all o.o. That’s is actually very helpful to know that. Thanks =D.
I know, I’m being very…difficult., it’s just that I’m new to engineering and my teacher wants us to program something he never taught us how to program. Thanks for putting up with me =D.
There are these things called cell phones… and I hear some of the newer ones have cameras… and the other day I heard a news story about the high percentage of kids in grade / high school who have these cell phone things these days… hmmm.
It’s understandable that you’re new and sort of out on a limb, so to speak, with your project. We’re all more than willing to help you out, but you’ve got to meet us in the middle.
Provide us with all of the information you have, in a clear, concise manner. Post pictures of your wiring and the electronics you’re using, diagrams and schematics, whatever you have or can do. Tell us what your project is, the goal and what you hope to accomplish along the way. Show us what you’ve done so far, provide us with code that you’ve written so far.
Like I said, we’re willing to help you out, but we’re not going to do the project for you. The more information you provide, the more we will be able to help!
Correct me if I’m wrong, but according to your pictures, it looks like you have the GND, 5V, and SIG of the PING going to the Bot Board’s IO pins…
If that’s true, then no wonder it’s not working, the PING has no power! Unless you’re setting the IO pins to HIGH/LOW in your code, which would work… unless it draws more than 25mA. Connect the 5V to 5V and the GND to GND header pins and that should help…
The header pins on the Bot Board are set up like this:
______
| ATOM | I P G
| Pro | / W N
| Chip | O R D
| |
| | o o o <-header pins
| | o o o
| | o o o
| | o o o
| |
PWR is dependent on the voltage jumper located above(towards the chip) each IO bus, be sure it’s on 5V.
It also seems that you have wires going into both VS and the VL inputs, and you have the VS=VL jumper installed… where are these wires going to/coming from?
Heh, even a blind squirel finds a nut every now and then. 8)
Color to signal assignment at the ping)) is BLK = GND, RED = +5V, and GRN = SIG… is that correct?
It also very much looks on the bap+abb end like all three of the clips are connected to port pins rather than the red to +5, blk to gnd, and grn to an i/o pin, is that also correct?
if it is correct, the question is then why isn’t it connected red to VL, blk to gnd, and grn to an i/o pin? this configuration is simpler, requires no code to setup power and gnd, and eliminates some other potential problem areas. pick an i/o port, say P4, connect the VS/VL jumper for it in the VL position, and wire the sensor to it. The ping)) is literally designed so you can use a servo extender cable to direct wire it to the 3-pin output header style of an abb. I’ll find some code I know works at home tonight from my rov project which uses all the same parts you have.
I thought maybe they used I/O pins to set up power ground and signal, but alas, looking at their code, there is no way on this earth it’s really working. Here is the code from their other post, sigh…
CmConver CON 2260
cmDistance VAR Word
time VAR Word
MAIN
cmDistance = 5000
DEBUG [dec time]
cmDistance = CmConver ** time
DEBUG [dec cmDistance]
PULSOUT 15, 1
PULSIN 15, 1, time
PULSOUT 12, 1
PULSIN 12, 1, time
PULSOUT 8, 1
PULSIN 8, 1, time
PAUSE 1000
return