Overview | Info/Download | Documentation | Sample Projects 
Making a GoGo board | Board Variations | Links | FAQ
 

GoGo board library for IMAGINE 2.0
 

Command Reference

by Arnan (Roger) Sipitakiat
arnans@media.mit.edu

Please visit http://www.gogoboard.org for the latest version of this document.


[ I- Setup Commands | II - Sensor Commands | III - Output (Motor) Commands ]
 

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

 

I - Setup Commands

comPort
Sets and initializes the GoGo on a particular COM port. If you don't call this procedure, the default, COM1, is used.

Examples

g'comPort 2

will use COM2 to communicate with the GoGo board.
 

II - Sensor Commands

sensor1
sensor2
sensor3
sensor4
sensor5
sensor6
sensor7
sensor8
Read the sensor value. Value ranges between 0-1023.
  • 1023 is returned when there's no sensor attached to the port (highest resistance).
  • 0 is returned when the sensor is short circuited (no resistance).

 

Examples

show g'sensor1 

will show sensor1's value

if g'sensor1 < 500 [ fd 100]

will move the current turtle 100 steps if sensor1's value is less than 500.

waituntil [g'sensor3 > 100]

will pause the program until sensor3 is higher than 100.

 

 

III - Output (motor) Commands

tta
ttb
ttc
ttd
tte
ttf
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

g'TalkToPort [a b c]

will set port a, b, and c as the active ports.

g'TalkToPort [a d c b]

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

g'tta
g'on
wait 10
g'off 

will turn on port A for 1 second. This is the equivalent of:

g'tta
g'onfor 10
   
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

g'TalkToMotor [a b c d e f]
g'setpower 4

will lower the power of all output ports by half of the full power.

Back to Top

 Last updated: Oct 10, 2003