Michael 2727
Senior Member
Something I noticed when using the Directives
#rem and
#endrem
See the code example below, the explanation is half way down.
This caught me out when trying several versions of a similar code.
Also #REM works but #ENDREM in capitals does not seem to work.
And I'm still using Prog-Editor ver 5.0.0.7
#rem and
#endrem
See the code example below, the explanation is half way down.
This caught me out when trying several versions of a similar code.
Also #REM works but #ENDREM in capitals does not seem to work.
And I'm still using Prog-Editor ver 5.0.0.7
Code:
#rem
'Code is REV-ED HEX WALKER code as an example.
'*** Program constants
' Delay to slow down servo motion (30ms default)
symbol servo_delay = 30
'*** Initialisation
init:
' set servos to known position
servo 1,120
servo 2,120
servo 4,120
pause servo_delay
'*** Move forward
move_forward:
for b1 = 90 to 230
servo 1,b1
pause servo_delay
next b1
for b1 = 90 to 230
servo 4,b1
servo 2,b1
pause servo_delay
next b1
for b1 = 150 to 230 step -1
servo 1,b1
pause servo_delay
next b1
for b1 = 150 to 230 step -1
servo 4,b1
servo 2,b1
pause servo_delay
next b1
goto move_forward
'
'
'#endrem '<<<<<<<<<<*** CODE = 73 BYTES AS IS ***.
'<<<<<<<<<< BUT IF THIS #enderm IS COMMENTED
'<<<<<<<<<< OUT e.g.('#endrem) THE CODE BELOW
'<<<<<<<<<< APPEARS TO BE READY FOR DOWNLOADING.
'<<<<<<<<<< BUT CHECKING THE SYNTAX REVEALS
'<<<<<<<<<< ONLY 3 BYTES USED.
'<<<<<<<<<< I think I downloaded 3 bytes a few times
'<<<<<<<<<< and wondered why nothing was working ???
'
'
'SECOND VRESION OF THE CODE BELOW
'
'#rem
'*** Program constants
' Delay to slow down servo motion (30ms default)
symbol servo_delay = 30
'*** Initialisation
init:
' set servos to known position
servo 1,120
servo 2,120
servo 4,120
pause servo_delay
'*** Move forward
move_forward:
for b1 = 90 to 230
servo 1,b1
pause servo_delay
next b1
for b1 = 90 to 230
servo 4,b1
servo 2,b1
pause servo_delay
next b1
for b1 = 150 to 230 step -1
servo 1,b1
pause servo_delay
next b1
for b1 = 150 to 230 step -1
servo 4,b1
servo 2,b1
pause servo_delay
next b1
goto move_forward
'
'
#endrem