PropBasic coding and compiling issue
bsnut
Posts: 521
I have some issues that PropBasic is not compiling simple code such as this
and it gives me this error "INVALID NUMBER OF PARAMETERS You have too few or too many parameters given.
I don't understand why I am getting this error and can someone tell me why this happening.
Below is my code.
if Switch1 = 1 AND Switch = 1 then Count_up
and it gives me this error "INVALID NUMBER OF PARAMETERS You have too few or too many parameters given.
I don't understand why I am getting this error and can someone tell me why this happening.
Below is my code.
DEVICE P8X32A, XTAL1, PLL16X XIN 5_000_000 ' ---------------------------------------------------------------------- ' Constants ' ---------------------------------------------------------------------- ' ---------------------------------------------------------------------- ' I/O Pins ' ---------------------------------------------------------------------- Light PIN 16 OUTPUT Switch pin 12 input Switch1 pin 13 input Switch2 pin 14 input ' ---------------------------------------------------------------------- ' Shared (hub) Variables (Byte, Word, Long) ' ---------------------------------------------------------------------- ' ---------------------------------------------------------------------- ' Shared (hub) Data (DATA, WDATA, LDATA, FILE) ' ---------------------------------------------------------------------- ' ---------------------------------------------------------------------- ' TASK Definitions ' ---------------------------------------------------------------------- ' ---------------------------------------------------------------------- ' Cog Variables (Long only) ' ---------------------------------------------------------------------- northcount var long ' ---------------------------------------------------------------------- ' SUB/FUNC Definitions ' ---------------------------------------------------------------------- ' ====================================================================== PROGRAM Start ' ====================================================================== Start: if Switch = 1 then Toggle_onoff if Switch1 = 1 AND Switch = 1 then Count_up if Switch2 = 1 then Reset_Count GOTO Start Toggle_onoff: if northcount > 4 then Start TOGGLE Light PAUSE 1000 GOTO Start Count_up: inc northcount GOTO Start Reset_Count: dec northcount GOTO Start END
Comments
As I can see, the jump to "Toggle_onoff" will always result in sending back to "Start", so you will never get the chance to evaluate Switch1 (either in your original code or in my version).
Bean
I am so used to the Basic Stamp why of coding and I was trying to see if it was doable(would compile), that's why I posted the code. I normally do small test code to check things like this and hope I didn't confuse anyone
Thanks for the help and you all answered my one big question that I had. More questions may come done the pike as I am learning a different way to coded my programs.