In SX Microcontrollers, SX/B Compiler and SX-Key Tool, brianbr wrote: I wrote some code for my SX48 Robot that looks like [code] GoForward SUB 1 GoBack SUB 1 StopBot SUB 1 GoForward: s1Pos = 75 s2Pos = 200 IF __PARAMCNT = 1 THEN temp1 = __PARAM1 pause temp1*250 ENDIF RETURN [/code] the remaining subs are essentially the same just the numbers to the servos are different the idea being if the routine is called with no paremeter it just starts the Bot moving Forward or backward or stops it while it awaits some senoer input to cause it to decide to do something different. If it gets called with a parameter that number is multiplied by 250 (1/4 second) and the pause command lets it move in that direction for that amount of time before being free to read sensors. If I declare the SUB with 1 parameter I get an "invalid number of parameters errors" for the parameterless call if I declare it [code] GoForward SUB 0 1 [/code] I get the same error against a call to the sub with parameters. The simple workaround is to make semi-duplicate SUBS, but that is wasteful. The documentation is fairly clear on 1 or 2 paremeters, but I just cannot figure out how to appease the compiler for selectin between 0 and 1 parameter. Is this a bug, if not how do I make it work? TNX ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=88882 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)