|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
PBasic Select Problem
Greetings,
I have chosen to use the new SELECT construct in PBasic. Here is the code fragment: 'Dead Reckoning Code Select stepnum CASE 0 : gosub go_home CASE 1 : gosub go_home2 CASE 2 : if rc_sw3 = UP & rc_sw4 = UP then gosub go_left else gosub go_right CASE 3 : gosub go_forward CASE 4 : if rc_sw3 = UP & rc_sw4 = UP then gosub go_left else gosub go_right CASE 5 : gosub go_longforward ENDSELECT When I check syntax, it always highlights the stepnum variable and provide the following error: Expected ':' or end-of-line Error: 129-Expected ':' or end-of-line What causes this error ? Searched and couldn't find anything. Am running the 2.0 beta 1 editor. It acts like it doesn't understand the new language features. thanks in advance. |
|
#2
|
|||
|
|||
|
I had that error once when I had forgot to define a variable.
Have you also checked to make sure that you have included the new PBASIC 2.5 definition at the top? Code:
' {$PBASIC 2.5}
|
|
#3
|
|||
|
|||
|
Put that in right below
{$STAMP BS2SX} But It compains about my constant definition: ON con 1 Is ON now a predefined constant ? Tried using the stamp editor help to find this out but its useless. Are the constants ON, OFF, TRUE,FALSE UP,DOWN now predefined ? thanks |
|
#4
|
||||
|
||||
|
Yes, most likely they're reserved. Instead pick a constant that has more meaning, such as ARM_UP, or LIFT_UP, etc.
You'll also get an error in your code because you didn't close your if conditions with an 'endif' |
|
#5
|
|||
|
|||
|
I already fixed the missing ENDIF
problem. thanks for the heads up. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Ok one problem | cantwell03 | Programming | 3 | 13-02-2003 07:28 |
| RoboEmu 1.09 (supports PBASIC 2.5) | rbayer | Programming | 22 | 21-01-2003 17:22 |
| The problem with scouting... | archiver | 2001 | 10 | 23-06-2002 23:49 |
| Major problem with chipphua motors | aka Scott White | Motors | 18 | 19-03-2002 19:44 |
| PBASIC problem | punarhero | Programming | 7 | 16-02-2002 23:13 |