Have trouble programming Basic Atom 28

I’m using the Bot Board II in combination with the Basic Atom 28. I trying to run the following Bot Board II test code from the lynxmotion website. Here is the code:

[code]nn var byte

ledA var bit
ledB var bit
ledC var bit

butA var bit
butB var bit
butC var bit

prev_butA var bit
prev_butB var bit
prev_butC var bit
temp var word

BUTTON_DOWN con 0
BUTTON_UP con 1

ledA = 0
ledB = 0
ledC = 0
butA = 0
butB = 0
butC = 0

nn = 0

'Wiggle LEDs
main:

adin ax0,2,ad_ron,temp
serout S_OUT,i57600,[dec6 temp\6," ",13]

if (butA = BUTTON_DOWN) AND (prev_butA = BUTTON_UP) then
	nn = nn + 1
	sound P9,[5\2500]
	low P9
endif
if (butB = BUTTON_DOWN) AND (prev_butB = BUTTON_UP) then
	nn = nn - 1
	sound P9,[10\1000]
	low P9
endif
if (butC = BUTTON_DOWN) AND (prev_butC = BUTTON_UP) then
	nn = 0
	sound P9,[10\4000]
	low P9
endif

ledA = nn.BIT0
ledB = nn.BIT1
ledC = nn.BIT2

if ( nn.BIT0 = 1 ) then
	high p0
	high p8
	high p4
else
	low p0
	low p8
	low p4
endif
if ( nn.BIT1 = 1 ) then
	high p1
	high p5
else
	low p1
	low p5
endif
if ( nn.BIT2 = 1 ) then
	high p2
	high p10
	high p6
else
	low p2
	low p10
	low p6
endif
if ( nn.BIT3 = 1 ) then
	high p3
	high p7
	high p11
else
	low p3
	low p7
	low p11
endif


pause 50

prev_butA = butA
prev_butB = butB
prev_butC = butC
gosub button_led_control

goto main

'Subroutine to read the buttons and control the LEDs. Button states are put in
'variables butA, butB, and butC. LED states are read from variables ledA, ledB,
'and ledC.
button_led_control:
'Make P4-P6 inputs to read buttons. This turns the LEDs off briefly
input p12
input p13
input p14
butA = IN12
butB = IN13
butC = IN14

'Output LOW to each LED that should be on
if ledA = 1 then
	low p12
endif
if ledB = 1 then
	low p13
endif
if ledC = 1 then
	low p14
endif

return[/code]

I’m using a Prolific USB to Serial cable. When I click program, the green light on the Bot Board II does not turn off like it should. The COM port is currently set to 3.

Does anyone know what the problem could be? Is it the usb to serial cable? The Bot Board II and Basic Atom 28 seem to be working fine. I’m using BasicMicro ATOM IDE 5.3.1.0.

Thanks in advance.

Your first problem is that the code you downloaded won’t compile on my or your computer. This is the line of code that wouldn’t work.

adin ax0,2,ad_ron,temp

Use this line instead.

adin 2,temp

I’m not quite sure how it effects the code since I’m a noob in computer code myself, but it at least seems to make the lights and buttons function as they should.

If the bot board still doesn’t function after this I will need more info on what is happening.

You are confusing this with the SSC-32’s green led. The green power led on the Bot Board II will not go out unless the battery goes dead.

We have tutorials for the Atom Pro, but not the Atom.

lynxmotion.com/ViewPage.aspx … egoryID=19

Have you used the USB successfully before?

Not so fast. He’s using the Atom 28, not the Atom Pro 28. I believe that is the correct command. He has another problem.

It seems that the program was being sent to the Bot Board II. I wrote a simple program to turn a servo 45 degrees left and 45 degrees right in and it worked.

The only strange thing now is that the power LED is off (even with power connected), and the B and C (green and yellow) leds above the pushbuttons are on.

I thought the power led was supposed to stay on as long as power was connected? I checked the 9 volt battery and the voltage reading was 7.5 volts.

Could this be the reason that the power led is off?

Wait… what? You first say you can’t get the LED to go out, (it’s not supposed to), then you say it’s going out when it’s not supposed to… :open_mouth:

Check with a volt meter for 5vdc on the I/O power distribution pins. If there is 5vdc there then the power LED is defective. Are you sure? This would be pretty strange.

I jumped to quickly, sorry.

My only guess is that the buttons might be stuck. My Bot Board 2 buttons were a bit sticky until they had been used some.

I’ve posted pictures of my Bot Board and wiring in the PS2 Controller Problems thread:

viewtopic.php?f=22&t=6089

Yeah this is very strange. I want to be happy that I got a program to work, but the power led being off and the B and C pushbutton leds being always on kind of bothers me :neutral_face: .

The problem with the power led only happened after putting the jumpers to enable the led push buttons onto the botboard as shown in the Bot Board II user guide.

This may be a dumb question, but which pins do you mean when you say power distribution pins (are they the ones marked 5V and VS)?

I will measure the voltage on these pins tomorrow and post the results in this thread.

Thanks for the quick responses by the way :smiley: .

I checked the voltages on the pins and they were 4.97 volts. I guess the power LED has gone bad…

Has anyone ever seen this happen before?

What program did you put on the chip? I need to see it to determine if the B and C LED’s are supposed to be turned on. Are you sure you understand where the power LED is? I just want to make sure you are not confusing it with the A LED. The power LED is by the VL terminals.

The first program I put on the chip was the Bot Board II test program which I got from this link:

lynxmotion.com/images/files/bb2tst01.bas

Then put some simple code to test the functionality of my servos onto the chip I did not save the exact code but it was something like this:

[code]xservopos var word

start: pulsout 0, 1500
pause 3000
pulsout 0 , 1000
pause 3000
pulsout 0,1500
pause 3000
goto start[/code]

After I ran this code, which seemed to work properly, the green power led which is the one by the VL input went off and has stayed off ever since.

The power LED is even off in the pictures I posted in my PS2 controller thread, and those pictures show the bot board after running the PS2 test code which can be found here:

lynxmotion.com/images/html/build034.htm

I am able to run programs, which is good. I’m just not sure what is going on with the power LED.

Ok, so everything is working correctly except the power LED?

Yes, I have successfully programmed the basic atom thanks for your help :smiley:

If the power LED is a problem please send me the board and we will either repair or replace it. Let me know what you want to do and I will provide the info.