The GoGo Extension comes preinstalled when you download and install NetLogo. To use the extension in your model, add this line to the top of your Code tab:
extensions [ gogo ]
If your model already uses other extensions, then it already has an extensions line in it, so just add gogo to the list.
After loading the extension, you can see whether one or more HID-based gogos are on and attached to the computer by typing the following into the command center:
gogo:howmany-gogos
Compared to previous versions of the GoGo extension, this version offers:
gogo:talk-to-output-ports
gogo:set-output-port-power
gogo:output-port-on
gogo:output-port-off
gogo:output-port-clockwise
gogo:output-port-counterclockwise
gogo:set-servo
Reports the number of USB HID devices visible to the computer and having the correct vendor and product ID to be a GoGo board. A board will only be detected if it is both connected and powered on. Using this primitive is one way to determine quickly whether a GoGo board has the HID firmware loaded. (A USB-Serial version of the board will not be detected.).
Establishes a list of output ports that will be controlled with subsequent output-port commands. See below…
power-level
is a number between 0 and 100, reflecting the percentage of maximum power.
Sets the amount of power that will be fed to the output ports indicated in talk-to-output-ports
.
This will not affect the on-off state of the output ports.
So, for example, if a motor is already connected to an output port and running, changing its power will change its speed.
If the motor is not running, changing the power level will not turn it on; instead, it will affect the speed at which the motor starts when it is turned on with output-port-on
.
Turns on the output ports which have been indicated with talk-to-output-ports. If none have been set with talk-to-output-ports, no ports will be turned on.
Turns off the output ports which have been indicated with talk-to-output-ports. If none have been set with talk-to-output-ports, no ports will be turned off.
Sets the polarity of the output port(s) that have been specified with talk-to-output-ports, so that a motor attached to one of these ports would turn clockwise.
Sets the polarity of the output port(s) that have been specified with talk-to-output-ports
, so that a motor attached to one of these ports would turn counterclockwise.
Sets the Pulse-Width Modulation (PWM) proportion of the output port(s) that have been specified with talk-to-output-ports. Note that the servo connectors are the male pins next to the standard motor connectors. Different servos respond to different PWM ranges, but all servos read PWM proportions and set the position of their main gear accordingly.
Turns the user-LED on or off, depending on the argument. gogo:led 1 turns the LED on; gogo:led 0 turns it off.
Reports a list containing the current readings of all eight sensors ports of the GoGo.
Reports the value of sensor number which-sensor, where which-sensor is a number between 0-7.
Reports all data available from the board, in a raw-list form useful for debugging.
Sends a list of bytes to the GoGo board. Useful for debugging or for testing any new or future functionality that is added to the GoGo board with new firmware updates.