1

when I try to load the following program to sphere through orbBasic loader in Mac OS X SDK it takes awhile for it to load and then it don't execute (without any message)

10 A=50
20 P=4
30 LEDC rnd 8
40 for X=0 to P-1
50 L=X*360/P
60 if L>45 and L<136 then goto 69
61 if L>225 and L<306 then goto 69
62 if L>0 and L<46 then goto 67 
63 if L>135 and L<226 then goto 67
64 if L>305 and L<360 then goto 67
67 LEDC 2
68 goto 70
69 LEDC 1
70 goroll L,80,1
80 delay 30*A
90 goroll L,0,0
100 delay 300
110 next X
120 A=A*3/4
130 if A<10 then end
140 goto 30

if I remove lines 60...69 it works seems some problem with multiple if statements

iddi
  • 31
  • 4
  • It seems that problem persist if I load program via orbBasicLoader from Sphero Mac OS SDK, and not the orbBasic app on iPhone. – iddi Feb 20 '14 at 07:36

5 Answers5

0

Your line numbering looks a little odd - sequence should be 10, 20, 30, 40, 50 60, 70. If I were you I'd change 61 to 70, 62 to 80 and so on.

0

Usually a full fail in OrbBASIC without any error is something happened that the ball cannot necessarily describe. This could be like a line number parsing issue, an unsupported operation, or a bad value being thrown around.

Sometimes, the OrbBASIC interpreter can get messed up on line numbers. I know it has for me before. Try making all of your line numbers in denominations of 10 (10, 20, 30, ... 100, 110) and see if that helps.

One other thing that I see in there, is the division operator. It should work, but it's a little finicky sometimes. The only reason that I bring it up, is the result is used in those problem lines, and if the result is bad, the whole program will fall on its face there.

Hunter Lang
  • 101
  • 4
0

I really doubt it is the line numbering. I have made many orbBASIC programs with much weirder line numbers. In fact, you don't even need numbers on lines which you're not referencing.

I don't think this is causing it, but are you aware that line 50 should make L equal exactly 0 (0*360/4) on the first iteration?

If you remove one or two of the if statements, does it still not run?

ColdSnickersBar
  • 297
  • 1
  • 5
  • it is definitely not line numbering. It doesn't run even with one if statement (one if statement without 'and' works, however). It seems there is some problem when code is loading to sphero - since it hangs for 30-50 seconds before loaded successfully message. – iddi Feb 20 '14 at 02:47
0

I would add

35 tron

and watch the execution progression to see what is going on. Offhand, I don't see any problems with your program though.

Someone else posted here that there is a problem downloading larger programs with the OSX SDK so maybe the end of your program just isnt making it to the ball and your goto 30 is never being executed.

Dan

0

The problem is that Sphero Mac OS X SDK can't load larger programs (that occupy 2 or more blocks of orbBasic memory) correctly. No problem with program.

iddi
  • 31
  • 4