Imagine Library Command Reference
by Arnan (Roger) Sipitakiat
arnans@media.mit.edu
|
Command Syntax All the commands in the GoGo library must be called via the "GoGo board object," which is represented with a single character g. For example, if you want to call the On procedure you need to write g'On |
|
comPort |
Sets and initializes the GoGo on a particular COM port. If you don't call this procedure, the default, COM1, is used. | |
|
Examples |
will use COM2 to communicate with the GoGo board. |
Sensor Commands
|
sensor1 |
Read the sensor value. Value ranges between 0-1023.
|
|||
|
Examples |
will show sensor1's value
will move the current turtle 100 steps if sensor1's value is less than 500.
will pause the program until sensor3 is higher than 100. |
Output (motor) Commands
|
tta |
Talk to an output port. This command will set the corresponding port at the active port. It will be the port effected by the action commands below. | ||
|
TalkToPort [Port-list] |
Talk to
multiple output ports. Use this command when you want to control
multiple devices simultaneously.
Port-list consists of a list of port names ranging from 'a' to 'f' |
||
|
Examples |
will set port a, b, and c as the active ports.
will set port a, b, c, and d as the active ports (notice that port order has no effect) |
||
| On | Turns on the power of the active port(s). | ||
| Off | Turns off
the power of the active port(s).
Note: Off is actually a macro that calls Break (see below) and wait for a short time then calls Coast. It does this to save battery power. |
||
| Coast | Turns off the power of the active port(s). When attached to motors, no breaking is applied. Thus, the motor will gradually slow down before stopping completely. | ||
| Break | When used
with motors, Break will immediately stop the motors (see Coast).
Note: the break command draw a lot more energy from the battery than Coast and Break. It continues to consume power even though the motors have stopped. Thus, use it with care. |
||
| OnFor Duration | Turns on the active port for a Duration of time. Duration is in tenth of a second. | ||
|
Examples |
will turn on port A for 1 second. This is the equivalent of:
|
||
| |
|
||
|
Thisway Thatway |
When used
with motors, these two commands controls the direction in which the
motor turns.
Thisway and Tahtway could mean clockwise or counter-colckwise depending on how the motors are plugged into the port. |
||
| Rd | Rd reverses the direction of the motor. | ||
| SetPower Power | Sets the
power level of the active port.
Power ranges between 0-7. The default power level is 7 (full power). |
||
|
Examples |
will lower the power of all output ports by half of the full power. |
