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

GoGo board library for Microworlds Logo
Multi-threaded version 1.0

Command Reference

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

Please visit http://learning.media.mit.edu/projects/gogo for the latest version of this document.


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

I - 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).

 

switch1
switch2
switch3
switch4
switch5
switch6
switch7
switch8
Returns the ON/OFF status of the sensor. This command is simply a macro that returns
  • ON (1) if the sensor value is less than 512
  • OFF (0) if the value is more than or equal to 512.

Examples

show sensor1 

will show sensor1's value

if switch1 [ fd 100]

will move the current turtle 100 steps if switch1 is ON.

waituntil [not switch3]

will pause the program until switch3 is OFF.

   

sensorMax1
sensorMax2
sensorMax3
sensorMax4
sensorMax5
sensorMax6
sensorMax7
sensorMax8

Returns the maximum sensor reading the board has detected since the last sensorMax operation.

The GoGo board automatically stores the highest sensor value it detects on each sensor port. It will send and reset this value of sensor port N every time a sensorMaxN command is used, where N ranges between 1 to 8.

This function is very useful especially when the sensor is activated for a very short time (such as a push button used in a game). In this case, detecting the change by polling the sensor from Microworlds is often not quick enough. This is where sensorMax becomes very handy.

sensorMin1
sensorMin2
sensorMin3
sensorMin4
sensorMin5
sensorMin6
sensorMin7
sensorMin8

Same idea as sensorMax but returns the minimum sensor value the board has detected since the previous sensorMin operation.
   

doLinear

Switches the sensor readings to "linear mode."

In linear mode, sensor readings will be re-mapped to make it increase/decrease at a constant rate according to the sensor resistance. The mapped value can grow beyond the 1023 limit of the normal mode.

  • 0 is still 0
  • 1024 is mapped to 523776.

A useful example of this mode is when you use a potentiometer (variable resister) to measure an angle (say .. you are making a steering wheel and you attach the potentiometer on its axel). In the normal mode, the sensor readings would change at an increasing or decreasing rate, making it hard to use. In the linear mode, the sensor readings would change at a constant rate.

Note: Sensor ports with no sensor attached would return 523,776 instead of 1024.

doNormal Switches the sensor readings to "normal mode." (Default)

In normal mode. Sensor readings will always stay in the 0-1023 range.

Examples

show sensor1 
251
show senosr2
806

doLinear

show sensor1
166
show sensor2
1892

This example shows how sensor readings are mapped differently when switched to the linear mode.

 

 

II - 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

TalkToPort [a b c]

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

TalkToPort [a f c b]

will set port a, b, c, and f 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

tta
on
wait 10
off 

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

tta
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

TalkToMotor [a b c d e f]
setpower 4

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

Back to Top

 Last updated: 2/21/2003 6:13:38 PM