REM Serial port test REM Performs a few simple motor operations in response to single characters being sent to the serial port REM One way communciation only, no confirmation, bad commands ignored. REM Set units s.t. 1 equals 1 revolution. UNITS = 51200 REM Set Motor parameters to some low values CURRENTRUN = 150 CURRENTBOOST = 200 CURRENTIDLE = 100 BOOST = AUTO SPEEDMAX = 1 REM Using default serial port settings for now REM Turn motor on ENERGISE = ON REM Main program loop, exited by KEY WHILE NOT KEY CharIn = INKEY : REM Receive a character from the serial port, if one is waiting. IF NOT (CharIn = -1) THEN : REM Unless a valid char has been received CharIn will be -1 IF CharIn = ASC("z") THEN MOVE = 1 : REM If received Z, move 1 rev forwards IF CharIn = ASC("x") THEN MOVE = -1 : REM If receive X, move 1 rev backwards REM If received any other character, ignore it. ENDIF WEND REM Shut down ENERGISE = OFF END REM Called if program aborts DEFHALT ENERGISE = OFF END ENDHALT