Option Explicit ' This is an example of using a BasicX controller to communicate ' with and control an ActivMedia robot such as an AmigoBot or a ' Pioneer. This code illustrates only a few of the available ' commands and functions. ' NOTE: This code uses the ArRobot module. For complete details ' about what commands are available, or how these commands are ' sent, see the arrobot.bas file. ' NOTE: the ArRobotSendCommand(ARCMD_PULSE) command is ' necessary to keep the robot's motors enabled. The PULSE ' command must be sent every second or two or the robot will ' assume there is a problem with the connection and halt. Public Sub Main() ' ArRobot demonstration. ' Initialize ArRobot interface Call ArRobotInit(1) ' Open ArRobot Connection Call ArRobotOpenConnection() ' Enable robot's sonars Call ArRobotSendCommandInt(ARCMD_SONAR, 1) ' Enable robot's motors Call ArRobotSendCommandInt(ARCMD_ENABLE, 1) ' Begin driving forward at 20mm/sec Call ArRobotSendCommandInt(ARCMD_VEL, 20) Call Delay(1.0) Call ArRobotSendCommand(ARCMD_PULSE) Call Delay(1.0) Call ArRobotSendCommand(ARCMD_PULSE) ' Stop driving Call ArRobotSendCommandInt(ARCMD_VEL, 0) ' Begin turn at -10deg/sec Call ArRobotSendCommandInt(ARCMD_RVEL, -10) Call Delay(1.0) Call ArRobotSendCommand(ARCMD_PULSE) Call Delay(1.0) Call ArRobotSendCommand(ARCMD_PULSE) ' Stop turn Call ArRobotSendCommandInt(ARCMD_RVEL, 0) ' Close robot connection Call ArRobotCloseConnection() End Sub