I have been working on this project for a while now and its come down to this… everytime i try to compile…debug or write my program to my Basic ATOM 28-Pin i counting to get this… “…\rover program.bas(line 21) : [TOKEN :] : IF without ENDIF”
but however i do have and if… heres the program
main
INA = 0
low p0
low p1
high p2
outb = 1
left con p4
right con p5
loop
if left > right then
high p0
pause 2000
low p0
if left < right then
high p1
pause 2000
low p1
else
low p2
endif
goto main
now i’m not sure if i’m using ENDIF properly, but i’d really love some help with the program…
You have two ifs and only one endif. Not sure exactly what you want, but my guess is you want something like:
main
INA = 0
low p0
low p1
high p2
outb = 1
left con p4
right con p5
loop
if left > right then
high p0
pause 2000
low p0
elseif left < right
high p1
pause 2000
low p1
else
low p2
endif
goto main
It doesnt seem to want to work… i think there might be a problem with the definition of the variables… do i hav to define wat left and right equal…or do i have to say sumthing about the analog value?..cus left and right are sensors…sorry…and p0 to p2 are LEDs
Thanks for all your Help!
I was able to get the LEDs to light up when they were supposed to.
BUT now that I’m adding a pair of motors, to drive tracks of a tank, I cannot get it to work.
I am using: Mini-ABB, Sabertooth 2x5 Motor Controller, 2 DC Brush Motors, and a Basic ATOM 28-Pin.
I’m prowering the ABB with 4 AA batteries, and the Motors and Sabertooth with a 7.2V, 1700mAh Ni-Cd High-Capacity Turbo Racing Batter Pack.
The problems I am having are:
the Sabertooth’s blue LED is radily flashing, I believe it means no signal. Which i assume can be fixed once I get the ABB working.
I’m not sure if the program is write. when i debug it, there are no errors. but wen i run it on the ABB it doesn not work
This is the Program:
outa = 1 ; defining pins P0 to P3 as out put
; p0 con motor1 ; left motor ;set motor varibles
; p1 con motor2 ; right motor
left var word ; defining varibles
right var word
high left
high right
main:
gosub a2d_check
left = left10
right = right10
if left > right then ; compares left and right sensor then tries to match equation
low p1
pause 100
high p1
elseif left < right ; if the first equation is not complete then do this…
low p0
pause 100
high p0
else ; if no match is found the go with…
pause 100
endif ; end the restart
goto main
a2d_check:
adin ax1, 2, AD_RON, left ; tells sensors to read every oscillator/32
adin ax2, 2, AD_RON, right
return
Please note I had it set up for PWM but that did not work either…
Pulsout, [value], (p1)
flashing light means no signal from your RC receiver (or in this case your ABB). Seems to me that your MC is not properly connected to the ABB which is why your sabertooth is not responding. If you could post some pictures of your setup we may be able to confirm this.
I don’t program much, and don’t see anything wrong with the code. Not sure on that. Someone want to confirm the code bit?
No joe, i’ve been using hte 5x2 all along, just b/c right now the prototype is for indoor.
The pictures are here tho. http://s255.photobucket.com/albums/hh143/anatomyofthetounge/?action=view¤t=r5.jpg src=“http://i255.photobucket.com/albums/hh143/anatomyofthetounge/r5.jpg” border=“0” alt=“Photobucket”>
that is the ABB, the wires are Black, Red, Green (Ground)
<a%20href=“http://s255.photobucket.com/albums/hh143/anatomyofthetounge/?action=view¤t=r3.jpg”%20target="_blank"><img%20src=“http://i255.photobucket.com/albums/hh143/anatomyofthetounge/r3.jpg”%20border=“0”%20alt=“Photobucket”>
thats a picture of the whole set up.
<a%20href=“http://s255.photobucket.com/albums/hh143/anatomyofthetounge/?action=view¤t=R2.jpg”%20target="_blank"><img%20src=“http://i255.photobucket.com/albums/hh143/anatomyofthetounge/R2.jpg”%20border=“0”%20alt=“Photobucket”>
and thats the Sabertooth.
Can anyone help me?
I think the wirering is right, i just think that the Basic ATOM is fryed or sumthing else. maybe the code.
I don’t kno i’ve tried evrything
this dosen’t look correct at all. Have you looked at the totorials I sent you? Another problem might be that your homemade connectors are’nt holding properly. And your ATOM isn’t in the socket Correctly as I already explained to you before. You are at risk of damaging the pins
You need to remove the micro, make sure the pins are straight and all align with the socket holes. You may want to lubricate the pins with a little WD-40 to ease the insertation. Then carefully insert the micro making sure that the sides are equally inserted as they are inserted. Things won’t work with poor connections. Otherwise you will need to do basic trouble shooting on your electronics to see what is/isn’t working.
I can’t quite tell from your picture, but it sure looks like you may be in packet serial mode. What are your DIP switch settings? One of the best things we ever did was the DIP switch wizard. dimensionengineering.com/datashe … /start.htm
Also, you’re free to wire thing however you like, but it’d sure be easier if you were using something resembling standard wiring color conventions. Using green for ground, black for 5v and red for signal is likely to confuse other people, even if you can keep it straight. A pretty standard convention is:
Black: ground or 0v
Red: Positive voltage, 5v is you have more than one positive voltage
Yellow: Often the “higher” positive voltage. For example, 12V.
Other colors: Signal
I have the 1 and 6 DIP switches off and the rest on…
But what i don’t get is why it’s not picking up a signal, like i have the programing like how it says… high p1… in the manual.
if i’ve got it wrong how should it be done?
if i had it in packet mode would that be easier to program?