Sie sind auf Seite 1von 36

GoGo​ ​Board​ ​5​ ​User​ ​Guide 

Arnan​ ​(Roger)​ ​Sipitakiat

Learning​ ​Inventions​ ​Laboratory   


Faculty​ ​of​ ​Engineering,​ ​Chiang​ ​Mai​ ​University 
Last​ ​update​ ​July​ ​6,​ ​2017 

This​ ​document​ ​guides​ ​you​ ​through​ ​the​ ​setup​ ​process​ ​and​ ​explains​ ​the​ ​basic​ ​principles​ ​and
functionalities​ ​of​ ​the​ ​GoGo​ ​Board.
Table​ ​of​ ​Contents

1.​ ​Overview​ ​of​ ​the​ ​GoGo​ ​Board


1.1​ ​The​ ​GoGo​ ​Widget
1.2​ ​Tinker
2.​ ​Setup​ ​and​ ​Basic​ ​Testing
3.Using​ ​Sensors
3.1​ ​Overview​ ​of​ ​Sensors​ ​Provided​ ​in​ ​the​ ​GoGo​ ​Board​ ​Kit
Buttons​ ​and​ ​Switches
Button​ ​Set
Light​ ​Sensor
Temperature​ ​Sensor
Magnetic​ ​Sensor
Infrared​ ​Sensor
Rain​ ​Sensor
Soil​ ​Humidity​ ​Sensor
Terminal​ ​Connector
4.​ ​Using​ ​Output​ ​Ports
4.1​ ​Motor​ ​Types
DC​ ​and​ ​Servo​ ​Motor​ ​Connectors
Choosing​ ​the​ ​Motor​ ​Mode
4.2​ ​DC​ ​Motors​ ​(Direct​ ​Current​ ​Motors)
Selecting​ ​Active​ ​Ports
DC​ ​Motor​ ​Operations
4.3​ ​Servo​ ​Motors
4.4​ ​Properties​ ​of​ ​the​ ​DC​ ​and​ ​Servo​ ​Motor​ ​Ports
DC​ ​Motor​ ​Ports
Servo​ ​Motors
4.5​ ​Power​ ​Supply​ ​Configurations
Voltage
Current
5.​ ​Using​ ​the​ ​built-in​ ​Screen
Screen​ ​Pages
6.​ ​Using​ ​the​ ​Remote​ ​Control
Tips:
7​ ​-​ ​Programming​ ​with​ ​Logo​ ​and​ ​Tinker
7.1​ ​Writing​ ​and​ ​Testing​ ​Your​ ​First​ ​Program
7.2​ ​Understanding​ ​Procedures

1
7.3​ ​DC​ ​Motor​ ​Control
Motor​ ​Selection
Motor​ ​Actions
Motor​ ​State
7.4​ ​Servo​ ​Motor​ ​Control
Servo​ ​Motor​ ​Heading​ ​Position
7.5​ ​Program​ ​Control
IF
Conditions
IF-ELSE
FOREVER
WAITUNTIL
7.6​ ​Programming​ ​the​ ​Built-in​ ​Screen
7.7​ ​Using​ ​Variables
7.8​ ​Using​ ​the​ ​Remote​ ​Control
8​ ​-​ ​Updating​ ​your​ ​Firmware
Firmware​ ​Version​ ​Configuration

   

2
1.​ ​Overview​ ​of​ ​the​ ​GoGo​ ​Board  

The GoGo Board is a programmable device with sensor inputs and outputs that can control
motors and other types of actuators. It is designed especially for young learners ages 10-18 and
those who are new to electronics. The design principle is to allow learners to spend as much
time as possible on the ideas of their desired creation and less on the technical details of the
low-level electronics involved. Learners can find themselves quickly becoming in contact with
powerful ideas in computational thinking and subject matters such as STEM. This design
separates the GoGo Board from many alternatives such as the Arduino. For example, when
programming an LED, learners can just plug in a LED module and start creating interesting
patterns instead of having to first put together a LED circuit on a breadboard. The same
principle applies to the programming language. The GoGo Board is compatible with many
electronic​ ​sensors​ ​and​ ​actuators​ ​that​ ​are​ ​widely​ ​available.

The GoGo Board consists of eight sensor input ports and four output ports. The board can be
programmed using a Logo-like language or a blocks-based drag-and-drop environment called
Tinker. The on-board display is programmable and can also show sensor values. There are
three kinds of expansion ports available. I2C and UART (serial) are for digital sensors and
extension modules. A 40-pin connector allows the GoGo Board to ride on top of a ​Raspberry Pi
computer​.

3
1.1​ ​The​ ​GoGo​ ​Widget 

 
To​ ​use​ ​the​ ​GoGo​ ​Board,​​ ​the​ ​GoGo​ ​Widget​​ ​is​ ​required.​ ​It​ ​is​ ​a​ ​program​ ​that​ ​connects​ ​the​ ​GoGo
Board​ ​to​ ​a​ ​computer.​ ​It​ ​allows​ ​you​ ​to​ ​perform​ ​the​ ​following​ ​actions:

● Display​ ​sensor​ ​values


● Manually​ ​control​ ​motors
● Configure​ ​add-on​ ​modules​ ​and​ ​perform​ ​testing.
● Update​ ​the​ ​GoGo​ ​Board’s​ ​firmware.
● Program​ ​the​ ​GoGo​ ​Board​ ​using​ ​a​ ​Logo-like​ ​programming​ ​language

   

4
1.2​ ​Tinker 

 
Tinker is a drag-and-drop programming environment for the GoGo Board that runs in a
browser. Tinker is often used by beginners who are not familiar with the GoGo Board’s
language. Tinker translates the visual program into text and sends it to the GoGo Widget.
Therefore,​ ​you​ ​need​ ​to​ ​keep​ ​the​ ​GoGo​ ​Widget​ ​running​ ​in​ ​order​ ​to​ ​use​ ​Tinker.

2.​ ​Software​ ​Setup​ ​and​ ​Basic​ ​Testing 

To start using the GoGo Board, the only program you will need to install is the GoGo Widget.
You need a Chrome web browser as the GoGo Widget is a Chrome Application. The GoGo
Widget can be installed from the Chrome Web Store. Follow the link below to install the GoGo
Widget on your Chrome Browser or search for “GoGo Widget” from the Chrome Web Store’s
main​ ​page.

Click​ ​to​ ​install​ ​the​ ​GoGo​ ​Widget​ ​from​ ​the​ ​Chrome​ ​Web​ ​Store

5
No driver is required for the GoGo Board. Since the GoGo Board works like a mouse and
keyboard​ ​(using​ ​a​ ​protocol​ ​called​ ​HID),​ ​your​ ​computer​ ​recognizes​ ​the​ ​board​ ​immediately.

To check that everything is good with your GoGo Board, first connect the board to your
computer using the micro-USB cable. Turn the board on using the on/off switch. You should
hear a short beep sequence and the built-in screen should display the word “GoGo” for a few
seconds. The GoGo Widget should display a picture of the GoGo Board as well. This indicates
that​ ​everything​ ​is​ ​good.

The​ ​above​ ​screen​ ​displays​ ​a​ ​question​ ​mark,​ ​which​ ​means​ ​no​ ​GoGo​ ​Board​ ​is​ ​connected.

A​ ​GoGo​ ​Board​ ​image​ ​appears​ ​once​ ​a​ ​connection​ ​is​ ​made.​ ​This​ ​usually​ ​happens​ ​just​ ​by
connecting​ ​the​ ​USB​ ​cable​ ​and​ ​turning​ ​the​ ​GoGo​ ​Board​ ​on.

6
The simplest things to do now are to make the GoGo Board beep and to control the on-board
LED. The buttons to perform these basic tasks are located on the right side of the screen as
shown​ ​below.

BEEP​ ​-​ ​Once​ ​pressed,​ ​a​ ​beep​ ​sound​ ​from​ ​the​ ​GoGo​ ​Board​ ​confirms​ ​that
the​ ​board​ ​is​ ​alive​ ​and​ ​well.

LED​ ​ON​ ​-​ ​turns​ ​on​ ​the​ ​built-in​ ​Green​ ​LED​ ​on​ ​the​ ​lower​ ​right.

LED​ ​OFF​ ​-​ ​turns​ ​off​ ​the​ ​LED.

3.Using​ ​Sensors 

Up to 8 analog sensors can be connected to the GoGo Board. The sensor ports are located at
the lower part of the GoGo Board and are labeled 1-8. The GoGo Board also has two digital
sensor​ ​ports​ ​located​ ​at​ ​the​ ​upper​ ​right​ ​corner​ ​and​ ​labeled​ ​I2C-1,​ ​I2C-2.

Analog sensors are simple to use. The GoGo kit comes with a rich set of sensors out of the box.
Since the GoGo Board is compatible with the “​Grove​” system, a much bigger selection of
sensors can be obtained from ​SEEED studio​. Note that not all sensors on the SEEED store are
compatible with the GoGo Board. Please refer to the compatibility chart (link required) before
making​ ​a​ ​purchase.

7
To use a sensor, simply use the supplied sensor cable to connect any sensor to a sensor port.
The GoGo Widget displays sensor values as bar graphs with numbers below them. As an
example, try connecting a light sensor to port number 1. Exposing this sensor to different levels
of brightness will cause the sensor value to change. Try to cover the light sensor using your
hand and then release it. You should see sensor 1’s value change accordingly as illustrated in
the​ ​images​ ​below.

The​ ​value​ ​of​ ​a​ ​light​ ​sensor​ ​will​ ​be​ ​higher​ ​in​ ​the​ ​top​ ​figure​ ​because​ ​it​ ​receives​ ​more​ ​light
than​ ​the​ ​one​ ​below​ ​it.

   

8
3.1​ ​Overview​ ​of​ ​Sensors​ ​Provided​ ​in​ ​the​ ​GoGo​ ​Board​ ​Kit 

Lever​ ​Switches​ ​and​ ​Buttons  

Lever​ ​switches​ ​and​ ​buttons​ ​are​ ​similar.​ ​They​ ​both​ ​produce​ ​a​ ​high​ ​value​ ​readout​ ​when​ ​pressed
and​ ​become​ ​near​ ​zero​ ​when​ ​released.​ ​Lever​ ​switches​ ​(also​ ​called​ ​limit​ ​switches)​ ​are​ ​suitable
for​ ​detecting​ ​objects​ ​such​ ​as​ ​walls,​ ​balls,​ ​and​ ​other​ ​mechanical​ ​parts.​ ​Buttons,​ ​on​ ​the​ ​other
hand,​ ​are​ ​usually​ ​for​ ​humans​ ​to​ ​press.

Button​ ​Set 

Useful​ ​as​ ​a​ ​game​ ​or​ ​motion​ ​controller,​ ​the​ ​button​ ​set​ ​produces​ ​different​ ​readouts​ ​for​ ​each
button.

Light​ ​Sensor 

​ ​The​ ​readout​ ​value​ ​varies​ ​ ​according​ ​to​ ​the​ ​amount​ ​of​ ​light​ ​the​ ​sensor​ ​receives.

   

9
Temperature​ ​Sensor 

The​ ​readout​ ​value​ ​corresponds​ ​to​ ​the​ ​ambient​ ​temperature.​ ​Note​ ​that​ ​the​ ​readout​ ​is​ ​not​ ​in
Celsius​ ​or​ ​Fahrenheit.​ ​The​ ​value​ ​is​ ​reflects​ ​the​ ​resistance​ ​of​ ​the​ ​sensor.​ ​Mappings​ ​between​ ​the
resistance​ ​and​ ​the​ ​standard​ ​units​ ​must​ ​be​ ​done​ ​manually.

Magnetic​ ​Sensor 

Magnetic​ ​sensors​ ​are​ ​sensitive​ ​to​ ​magnetic​ ​fields​ ​such​ ​as​ ​those​ ​produced​ ​by​ ​magnets.

Magnetic​ ​sensors​ ​are​ ​often​ ​used​ ​as​ ​a​ ​non-contact​ ​switch.​ ​For​ ​example,​ ​to​ ​measure​ ​the​ ​speed
of​ ​a​ ​bicycle,​ ​a​ ​magnetic​ ​sensor​ ​can​ ​be​ ​placed​ ​on​ ​the​ ​wheel’s​ ​frame.​ ​A​ ​magnet​ ​is​ ​stuck​ ​on​ ​to​ ​the
wheel.​ ​With​ ​this​ ​setup,​ ​the​ ​magnetic​ ​sensor​ ​will​ ​detect​ ​the​ ​magnet​ ​every​ ​time​ ​it​ ​passes​ ​by.
Measuring​ ​the​ ​time​ ​between​ ​counts​ ​can​ ​be​ ​later​ ​used​ ​to​ ​calculate​ ​the​ ​bicycle’s​ ​speed.

   

10
Infrared​ ​Reflective​ ​Sensor 

This​ ​sensor​ ​is​ ​commonly​ ​used​ ​to​ ​measure​ ​proximity.​ ​It​ ​emits​ ​infrared​ ​light​ ​and​ ​measures​ ​how
much​ ​of​ ​that​ ​light​ ​is​ ​reflected​ ​back.​ ​Therefore,​ ​if​ ​there​ ​is​ ​no​ ​object​ ​to​ ​bounce​ ​back​ ​the​ ​light,​ ​the
sensor​ ​will​ ​give​ ​a​ ​small​ ​measurement.​ ​The​ ​closer​ ​an​ ​object​ ​is​ ​to​ ​the​ ​sensor,​ ​the​ ​higher​ ​the
measurement.​ ​The​ ​effective​ ​range​ ​of​ ​this​ ​sensor​ ​is​ ​less​ ​than​ ​5​ ​centimeters.​ ​Note​ ​that​ ​color​ ​of
the​ ​object​ ​also​ ​determines​ ​how​ ​much​ ​light​ ​is​ ​reflected.​ ​For​ ​example,​ ​black​ ​objects​ ​absorbs​ ​more
light​ ​than​ ​lighter​ ​colors​ ​and,​ ​at​ ​the​ ​same​ ​distance,​ ​produces​ ​a​ ​lower​ ​measurement.​ ​Therefore,
this​ ​sensor​ ​can​ ​also​ ​be​ ​adapted​ ​as​ ​a​ ​color​ ​sensor.

Caution​​ ​-​ ​This​ ​sensor​ ​is​ ​sensitive​ ​to​ ​infrared​ ​light​ ​from​ ​other​ ​sources​ ​as​ ​well.​ ​Therefore,​ ​the
interference​ ​of​ ​sunlight,​ ​fluorescent​ ​light​ ​or​ ​other​ ​infrared​ ​light​ ​sources​ ​may​ ​lead​ ​to​ ​irregular
readings.

Rain​ ​Sensor 

The​ ​metal​ ​below​ ​this​ ​sensor​ ​is​ ​ ​very​ ​sensitive​ ​to​ ​raindrops.​ ​In​ ​the​ ​event​ ​of​ ​a​ ​rainfall,​ ​it​ ​is​ ​best​ ​to
turn​ ​this​ ​side​ ​up​ ​for​ ​direct​ ​rainfall​ ​detection.​ ​Make​ ​sure​ ​to​ ​keep​ ​the​ ​connector​ ​dry.

   

11
Soil​ ​Humidity​ ​Sensor

Under​ ​this​ ​sensor​ ​lies​ ​2​ ​metal​ ​plates​ ​to​ ​measure​ ​soil​ ​humidity​ ​or​ ​moisture​ ​in​ ​the​ ​soil.​ ​After
inserting​ ​the​ ​probe​ ​into​ ​the​ ​soil,​ ​make​ ​sure​ ​the​ ​connector​ ​stays​ ​dry​ ​for​ ​an​ ​accurate​ ​readout.

Terminal​ ​Connector  

This​ ​terminal​ ​connector​ ​is​ ​used​ ​for​ ​additional​ ​sensors​ ​that​ ​are​ ​not​ ​included​ ​in​ ​this​ ​kit.​ ​Three
screws​ ​in​ ​the​ ​adapter​ ​are​ ​used​ ​for​ ​power,​ ​ground,​ ​and​ ​signal​ ​(VCC,​ ​GND,​ ​Sig).

   

12
4.​ ​Using​ ​Output​ ​Ports 

There​ ​are​ ​4​ ​output​ ​ports​ ​available.​ ​These​ ​ports​ ​are​ ​commonly​ ​referred​ ​to​ ​as​ ​motor​ ​ports.
However,​ ​they​ ​can​ ​be​ ​used​ ​to​ ​control​ ​other​ ​types​ ​of​ ​actuators​ ​such​ ​as​ ​lights​ ​and​ ​relays​ ​as​ ​well.
The​ ​four​ ​ports​ ​are​ ​located​ ​on​ ​the​ ​top​ ​left​ ​and​ ​are​ ​labeled​ ​A,B,C​ ​and​ ​D.

4.1​ ​Motor​ ​Types 


Two​ ​kinds​ ​of​ ​motors​ ​can​ ​be​ ​used​ ​with​ ​the​ ​GoGo​ ​Board:​ ​DC​ ​and​ ​servo.​ ​DC​ ​motors​ ​are​ ​the
simplest​ ​kind.​ ​Once​ ​powered,​ ​DC​ ​motors​ ​rotate​ ​indefinitely.​ ​Servo​ ​motors​ ​are​ ​not​ ​usually​ ​used
for​ ​rotation,​ ​but​ ​more​ ​to​ ​point​ ​at​ ​a​ ​given​ ​angle.​ ​More​ ​information​ ​can​ ​be​ ​found​ ​on​ ​Wikipedia’s
article​ ​on​ ​DC​ ​motors​​ ​and​ ​s​ervo​ ​motors​.

DC​ ​and​ ​Servo​ ​Motor​ ​Connectors 

DC​ ​motors​ ​use​ ​the​ ​white​ ​2-pin​ ​JST​ ​connectors​ ​while​ ​servo​ ​motors​ ​use​ ​the​ ​3-pin​ ​male
connectors.​ ​Each​ ​port​ ​can​ ​control​ ​only​ ​one​ ​type​ ​of​ ​motor​ ​at​ ​a​ ​time.​ ​That​ ​is,​ ​you​ ​cannot​ ​connect
both​ ​a​ ​DC​ ​and​ ​a​ ​servo​ ​motor​ ​to​ ​the​ ​same​ ​port.​ ​For​ ​example,​ ​you​ ​cannot​ ​use​ ​DC-A​ ​and​ ​Servo-A
at​ ​the​ ​same​ ​time.​ ​But​ ​using​ ​DC-A​ ​and​ ​Servo-B​ ​is​ ​fine.

Choosing​ ​the​ ​Motor​ ​Mode 

All​ ​four​ ​output​ ​ports​ ​can​ ​be​ ​independently​ ​programmed​ ​(in​ ​Logo/Tinker)​ ​to​ ​control​ ​DC​ ​or​ ​servo
motors.​ ​However,​ ​the​ ​GoGo​ ​Widget​ ​can​ ​control​ ​only​ ​one​ ​type​ ​at​ ​a​ ​time.​ ​To​ ​perform​ ​an
operation,​ ​select​ ​the​ ​desired​ ​motor​ ​ports​ ​and​ ​then​ ​click​ ​on​ ​the​ ​motor​ ​type​ ​icon​ ​as​ ​shown​ ​above.
The​ ​available​ ​operations​ ​will​ ​then​ ​be​ ​shown.

   

13
4.2​ ​DC​ ​Motors​ ​(Direct​ ​Current​ ​Motors) 

To​ ​try​ ​using​ ​DC​ ​motors,​ ​connect​ ​the​ ​motor​ ​and​ ​wheel​ ​provided​ ​in​ ​the​ ​GoGo​ ​kit.​ ​Then​ ​connect
the​ ​leads​ ​on​ ​the​ ​motor​ ​to​ ​port​ ​A​ ​on​ ​the​ ​GoGo​ ​Board.

Selecting​ ​Active​ ​Ports 

To​ ​use​ ​the​ ​output​ ​ports,​ ​ ​first​ ​select​ ​the​ ​ports​ ​you​ ​want​ ​by​ ​clicking​ ​on​ ​the​ ​circular​ ​buttons
labeled​ ​A,B,C,​ ​and​ ​D​ ​as​ ​shown​ ​above.
● Selected​ ​ports​ ​will​ ​have​ ​either​ ​a​ ​red​ ​or​ ​green​ ​arrow​ ​on​ ​the​ ​port​ ​name.​ ​Port​ ​A,​ ​B​ ​above
are​ ​selected.
● The​ ​arrow​ ​colors​ ​correspond​ ​to​ ​the​ ​rotation​ ​direction​ ​(or​ ​polarity)​ ​of​ ​the​ ​output.​ ​A​ ​motor
connected​ ​to​ ​a​ ​port​ ​with​ ​a​ ​red​ ​arrow​ ​will​ ​spin​ ​in​ ​the​ ​opposite​ ​direction​ ​of​ ​a​ ​port​ ​with​ ​a
green​ ​arrow.​ ​Motors​ ​connected​ ​to​ ​port​ ​A​ ​and​ ​B​ ​above​ ​will​ ​turn​ ​in​ ​different​ ​directions.
● Selecting​ ​a​ ​port​ ​does​ ​not​ ​automatically​ ​turn​ ​the​ ​port​ ​on.​ ​Selected​ ​ports​ ​must​ ​be​ ​explicitly
told​ ​to​ ​turn​ ​“on”​ ​or​ ​“off”.​ ​This​ ​can​ ​be​ ​done​ ​by​ ​pressing​ ​the​ ​“on”​ ​and​ ​“off”​ ​buttons
explained​ ​below.
● Ports​ ​that​ ​are​ ​“on”​ ​will​ ​have​ ​a​ ​yellow​ ​background.​ ​Ports​ ​A​ ​and​ ​D​ ​above​ ​are​ ​on.​ ​Note​ ​that
an​ ​unselected​ ​port​ ​could​ ​be​ ​“on”​ ​from​ ​previous​ ​operations.​ ​Deselecting​ ​a​ ​port​ ​does​ ​not
turn​ ​it​ ​off.
● Unselected​ ​ports​ ​are​ ​grayed​ ​out.​ ​Port​ ​C​ ​and​ ​D​ ​above​ ​are​ ​unselected.​ ​Port​ ​C​ ​is​ ​in​ ​the

14
“off”​ ​state​ ​while​ ​port​ ​D​ ​is​ ​“on”.
● A​ ​number​ ​below​ ​each​ ​port​ ​name​ ​indicates​ ​its​ ​“power​ ​level”.​ ​The​ ​default​ ​level​ ​is​ ​100,
which​ ​is​ ​full​ ​power.​ ​This​ ​value​ ​can​ ​be​ ​changed​ ​using​ ​the​ ​power​ ​slider​ ​explained​ ​below.

DC​ ​Motor​ ​Operations 


The​ ​table​ ​below​ ​describes​ ​the​ ​operations​ ​you​ ​can​ ​perform​ ​on​ ​a​ ​motor.

(ON)​ ​Button​ ​-​ ​turns​ ​on​ ​the​ ​selected​ ​motor

(OFF)​ ​Button​ ​-​ ​turns​ ​off​ ​the​ ​selected​ ​motor

(CCW)​ ​Button​ ​-​ ​set​ ​rotational​ ​direction​ ​is​ ​in​ ​counter​ ​clockwise

(RD)​ ​Button​ ​-​ ​reverse​ ​the​ ​original​ ​direction​ ​that​ ​the​ ​motor​ ​is​ ​set.

(CW)​ ​Button​ ​-​ ​set​ ​rotational​ ​direction​ ​to​ ​clockwise

Power​ ​setting​ ​-​ ​scroll​ ​the​ ​scrollbar​ ​to​ ​the​ ​prospective​ ​value​ ​for​ ​the​ ​motor​ ​and​ ​press​ ​“Set​ ​Power.”

   

15
4.3​ ​Servo​ ​Motors 

To​ ​use​ ​the​ ​servo​ ​motor​ ​mode,​ ​press​ ​the​ ​servo​ ​mode​ ​button.​ ​When​ ​in​ ​this​ ​servo​ ​mode,​ ​the​ ​DC
motor​ ​operations​ ​will​ ​be​ ​grayed​ ​out.​ ​The​ ​“Set​ ​Power”​ ​button​ ​will​ ​become​ ​ ​“Set​ ​Head.”​ ​To​ ​control
the​ ​servo,​ ​move​ ​the​ ​slider.​ ​The​ ​servo​ ​motor​ ​should​ ​turn​ ​accordingly.

Caution​​ ​-​ ​Make​ ​sure​ ​you​ ​plug​ ​in​ ​the​ ​servo​ ​motor​ ​correctly.​ ​Since​ ​there​ ​is​ ​no​ ​polarity​ ​enforced
on​ ​the​ ​GoGo​ ​Board​ ​connector,​ ​it​ ​is​ ​possible​ ​to​ ​plug​ ​the​ ​motor​ ​in​ ​the​ ​wrong​ ​way.​ ​Although​ ​this
will​ ​not​ ​harm​ ​the​ ​motor,​ ​it​ ​will​ ​not​ ​function.​ ​Different​ ​brands​ ​have​ ​their​ ​own​ ​color​ ​codes.​ ​The
image​ ​below​ ​shows​ ​the​ ​GoGo’s​ ​pin​ ​layout​ ​and​ ​some​ ​common​ ​servo​ ​connector​ ​color​ ​code.

The​ ​GoGo​ ​Board’s​ ​servo​ ​motor​ ​port​ ​(left)​ ​and​ ​common​ ​servo​ ​lead​ ​colors

   

16
4.4​ ​Specifications​ ​of​ ​the​ ​DC​ ​and​ ​Servo​ ​Motor​ ​Ports 
DC​ ​Motor​ ​Ports 
● Maximum​ ​of​ ​4​ ​DC​ ​motors​ ​can​ ​be​ ​driven​ ​simultaneously
● The​ ​power​ ​and​ ​direction​ ​can​ ​be​ ​individually​ ​selected​ ​for​ ​each​ ​port
● Each​ ​port​ ​has​ ​LEDs​ ​that​ ​indicate​ ​the​ ​on/off​ ​status.​ ​The​ ​LED​ ​color​ ​indicates​ ​the​ ​direction
● Power​ ​adjustment​ ​is​ ​available​ ​from​ ​0​ ​(lowest,​ ​equivalent​ ​to​ ​“off”)​ ​to​ ​100​ ​(highest)
● Each​ ​port​ ​can​ ​drive​ ​3-12v​ ​motors​ ​with​ ​current​ ​under​ ​500mA​ ​per​ ​port.
● The​ ​port​ ​automatically​ ​shuts-off​ ​if​ ​overheated.

Servo​ ​Motors 
● Can​ ​drive​ ​up​ ​to​ ​4​ ​servo​ ​motors​ ​at​ ​the​ ​same​ ​time
● All​ ​4​ ​servo​ ​motors​ ​can​ ​be​ ​independently​ ​controlled
● Works​ ​only​ ​with​ ​5V​ ​servo​ ​motors.​ ​Most​ ​hobby​ ​servo​ ​motors​ ​are​ ​5​ ​volts.

4.5​ ​Power​ ​Supply​ ​Configurations 


In​ ​most​ ​cases,​ ​there​ ​is​ ​no​ ​need​ ​to​ ​worry​ ​about​ ​the​ ​GoGo​ ​Board’s​ ​power​ ​supply.​ ​However,​ ​when
a​ ​non-5v​ ​motor​ ​is​ ​used​ ​or​ ​when​ ​many​ ​power​ ​hungry​ ​output​ ​devices​ ​are​ ​connected,​ ​special​ ​care
will​ ​be​ ​needed​ ​to​ ​make​ ​sure​ ​the​ ​GoGo​ ​Board​ ​functions​ ​properly.

Voltage 
Each​ ​output​ ​port​ ​on​ ​the​ ​GoGo​ ​Board​ ​delivers​ ​5​ ​volts​ ​by​ ​default.​ ​However,​ ​the​ ​GoGo​ ​Board​ ​has
an​ ​auxiliary​ ​power​ ​source​ ​connector​ ​if​ ​other​ ​voltages​ ​are​ ​needed.​ ​This​ ​voltage​ ​must​ ​be​ ​between
3-12v.​ ​There​ ​is​ ​a​ ​jumper​ ​next​ ​to​ ​the​ ​on/off​ ​switch​ ​that​ ​can​ ​be​ ​used​ ​to​ ​send​ ​either​ ​5​ ​volts​ ​or​ ​the
auxiliary​ ​voltage​ ​to​ ​the​ ​output​ ​ports.​ ​The​ ​illustration​ ​below​ ​shows​ ​how​ ​to​ ​use​ ​this​ ​jumper.

Caution:​ ​The​ ​power​ ​source​ ​for​ ​all​ ​four​ ​output​ ​ports​ ​are​ ​internally​ ​connected.​ ​Therefor,​ ​all​ ​ports
will​ ​supply​ ​the​ ​same​ ​voltage.​ ​Devices​ ​that​ ​require​ ​different​ ​voltages​ ​cannot​ ​be​ ​used​ ​at​ ​the​ ​same
time.​ ​You​ ​cannot​ ​mix​ ​5-​ ​and​ ​12-volt​ ​devices,​ ​for​ ​example.

17
Current 
In​ ​some​ ​cases​ ​when​ ​using​ ​many​ ​output​ ​devices,​ ​the​ ​GoGo​ ​Board​ ​many​ ​need​ ​to​ ​be​ ​supplied
with​ ​a​ ​higher​ ​current​ ​source.​ ​A​ ​common​ ​problematic​ ​scenario​ ​is​ ​when​ ​trying​ ​to​ ​drive​ ​many
motors​ ​using​ ​power​ ​only​ ​from​ ​a​ ​computer’s​ ​USB​ ​port.​ ​Most​ ​computer​ ​USB​ ​ports​ ​ ​can​ ​supply
only​ ​500​ ​mA.​ ​Power​ ​banks​ ​or​ ​phone​ ​chargers​ ​with​ ​a​ ​mini​ ​USB​ ​cable​ ​can​ ​usually​ ​supply​ ​1,000​ ​-
2,500​ ​mA.​ ​Alternatively,​ ​the​ ​GoGo​ ​Board​ ​also​ ​has​ ​a​ ​5v​ ​power​ ​supply​ ​connector​ ​(see​ ​illustration
below).​ ​This​ ​connector​ ​can​ ​be​ ​used​ ​with​ ​other​ ​5v​ ​power​ ​sources​ ​such​ ​as​ ​batteries​ ​or​ ​wall
adapters.

   

18
5.​ ​Using​ ​the​ ​built-in​ ​Screen 

The​ ​built-in​ ​7-segment​ ​screen​ ​is​ ​a​ ​useful​ ​tool​ ​to​ ​show​ ​text​ ​or​ ​numbers​ ​that​ ​enhances​ ​the
functionality​ ​of​ ​the​ ​program​ ​or​ ​help​ ​with​ ​the​ ​debugging​ ​process.

Screen​ ​Pages 
The​ ​built-in​ ​screen​ ​consists​ ​of​ ​many​ ​pages,​ ​each​ ​displaying​ ​different​ ​values​ ​as​ ​shown​ ​below.
Press​ ​the​ ​“Display​ ​Select”​ ​button​ ​near​ ​the​ ​screen​ ​to​ ​cycle​ ​through​ ​pages.

● User​.​ ​This​ ​is​ ​the​ ​default​ ​screen​ ​where​ ​all​ ​the​ ​values​ ​from​ ​the​ ​user​ ​program​ ​will​ ​be
shown.
● Off​.​ ​This​ ​screen​ ​is​ ​used​ ​to​ ​deactivate​ ​the​ ​screen.
● Sensor​ ​1​ ​-​ ​Sensor​ ​8​.​ ​Each​ ​screen​ ​will​ ​show​ ​sensor​ ​values​ ​from​ ​the​ ​corresponding​ ​port
number.

19
 

6.​ ​Using​ ​the​ ​Remote​ ​Control 

Using​ ​the​ ​supplied​ ​remote​ ​control​ ​with​ ​the​ ​GoGo​ ​Board​ ​is​ ​simple.​ ​With​ ​the​ ​GoGo​ ​Widget
software​ ​running,​ ​just​ ​point​ ​the​ ​remote​ ​towards​ ​the​ ​GoGo​ ​Board​ ​and​ ​press​ ​any​ ​button.​ ​You
should​ ​see​ ​a​ ​number​ ​code​ ​appear​ ​under​ ​ ​the​ ​remote​ ​icon.​ ​Each​ ​button​ ​will​ ​have​ ​a​ ​unique
number​ ​code.​ ​For​ ​example,​ ​the​ ​number​ ​1​ ​normally​ ​has​ ​a​ ​number​ ​code​ ​=​ ​128.​ ​This​ ​code​ ​can​ ​be
later​ ​used​ ​in​ ​your​ ​program​ ​to​ ​perform​ ​desired​ ​actions.

Setup​:​ ​If​ ​your​ ​GoGo​ ​kit​ ​comes​ ​with​ ​a​ ​universal​ ​remote,​ ​you​ ​must​ ​configure​ ​it​ ​before​ ​use.​ ​The
GoGo​ ​Board​ ​works​ ​with​ ​Sony​ ​remotes.​ ​Consult​ ​your​ ​remote’s​ ​manual​ ​for​ ​detailed​ ​instructions
on​ ​how​ ​to​ ​control​ ​Sony​ ​devices.

Tips:  
● Infrared​ ​remotes​ ​often​ ​do​ ​not​ ​require​ ​direct​ ​line-of-sight​ ​to​ ​work.​ ​The​ ​signal​ ​can​ ​bounce
off​ ​walls​ ​and​ ​penetrate​ ​sheets​ ​of​ ​paper.
● The​ ​“power”​ ​button​ ​will​ ​function​ ​the​ ​same​ ​way​ ​as​ ​the​ ​“run”​ ​button​ ​on​ ​the​ ​GoGo​ ​Board.
Use​ ​this​ ​button​ ​to​ ​run​ ​or​ ​stop​ ​a​ ​program​ ​on​ ​the​ ​GoGo​ ​Board.
● Holding​ ​down​ ​a​ ​button​ ​on​ ​the​ ​remote​ ​usually​ ​causes​ ​repetitive​ ​pulses.​ ​This​ ​may​ ​cause
the​ ​GoGo​ ​Board​ ​to​ ​receive​ ​the​ ​same​ ​command​ ​more​ ​than​ ​once.​ ​Some​ ​remotes​ ​sends
out​ ​three​ ​pulses​ ​even​ ​with​ ​a​ ​quick​ ​press.​ ​You​ ​may​ ​have​ ​to​ ​take​ ​this​ ​into​ ​account​ ​when
writing​ ​your​ ​program.

   

20
7​ ​-​ ​Programming​ ​with​ ​Logo​ ​and​ ​Tinker 

The​ ​following​ ​examples​ ​will​ ​cover​ ​all​ ​of​ ​the​ ​major​ ​features​ ​of​ ​the​ ​Logo​ ​ ​language.​ ​The​ ​examples
assume​ ​that​ ​the​ ​reader​ ​has​ ​a​ ​preliminary​ ​understanding​ ​of​ ​programming.

7.1​ ​Writing​ ​and​ ​Testing​ ​Your​ ​First​ ​Program 

The​ ​following​ ​is​ ​a​ ​simple​ ​program​ ​that​ ​tells​ ​the​ ​GoGo​ ​Board​ ​to​ ​beep​ ​10​ ​times​ ​every​ ​10th​ ​of​ ​a
second.

to​ ​dobeep
repeat​ ​10​ ​[​ ​beep​ ​wait​ ​1]
End

To​ ​write​ ​Logo​ ​programs,​ ​select​ ​the​ ​Tab​ ​labeled​ ​“Logo”​ ​in​ ​the​ ​GoGo​ ​Widget.​ ​Enter​ ​your​ ​logo
code​ ​in​ ​the​ ​empty​ ​area​ ​as​ ​shown​ ​below.

21
The​ ​same​ ​program​ ​written​ ​in​ ​Tinker​ ​looks​ ​like​ ​this:

Click​ ​“Download”​ ​in​ ​the​ ​GoGo​ ​Widget​ ​or​ ​“Write​ ​to​ ​GoGo​ ​Board”​ ​in​ ​Tinker​ ​to​ ​send​ ​this​ ​program
to​ ​the​ ​GoGo​ ​Board.​ ​Before​ ​sending,​ ​the​ ​program​ ​will​ ​be​ ​checked​ ​for​ ​errors.​ ​If​ ​there​ ​are​ ​any
errors,​ ​a​ ​message​ ​will​ ​appear​ ​allowing​ ​fixes​ ​to​ ​be​ ​made.​ ​If​ ​the​ ​program​ ​is​ ​successfully​ ​saved,
the​ ​GoGo​ ​Board​ ​will​ ​beep​ ​once.

When​ ​using​ ​Tinker,​ ​remember​ ​to​ ​keep​ ​the​ ​GoGo​ ​Widget​ ​running​ ​in​ ​the​ ​background.​ ​Tinker
requires​ ​the​ ​GoGo​ ​Widget​ ​in​ ​order​ ​to​ ​communicate​ ​with​ ​the​ ​GoGo​ ​Board.

The​ ​last​ ​step​ ​is​ ​to​ ​run​ ​this​ ​program.​ ​This​ ​can​ ​be​ ​done​ ​by​ ​clicking​ ​on​ ​the​ ​“Run/Stop”​ ​button​ ​on
the​ ​screen​ ​or​ ​by​ ​pressing​ ​the​ ​physical​ ​“Run!”​ ​button​ ​on​ ​the​ ​GoGo​ ​Board​ ​itself.​ ​In​ ​this​ ​example,
when​ ​the​ ​program​ ​runs,​ ​the​ ​GoGo​ ​Board​ ​will​ ​beep​ ​ten​ ​times.​ ​A​ ​red​ ​“run”​ ​LED​ ​on​ ​the​ ​lower-right
of​ ​the​ ​GoGo​ ​Board​ ​will​ ​light​ ​up​ ​while​ ​a​ ​program​ ​is​ ​running​ ​and​ ​will​ ​go​ ​off​ ​when​ ​the​ ​program​ ​is
completed.​ ​The​ ​whole​ ​process​ ​is​ ​illustrated​ ​below.

22
Once​ ​a​ ​program​ ​has​ ​been​ ​saved​ ​to​ ​the​ ​GoGo​ ​Board,​ ​it​ ​remains​ ​there​ ​even​ ​when​ ​the​ ​board​ ​is
disconnected​ ​from​ ​the​ ​computer​ ​or​ ​when​ ​it​ ​looses​ ​power.​ ​That​ ​means​ ​the​ ​GoGo​ ​Board​ ​can​ ​run
the​ ​program​ ​independently​ ​as​ ​long​ ​as​ ​it​ ​has​ ​power.

7.2​ ​Understanding​ ​Procedures 

Every​ ​command​ ​given​ ​to​ ​the​ ​GoGo​ ​Board​ ​must​ ​live​ ​inside​ ​a​ ​procedure.​ ​In​ ​the​ ​example​ ​above,
the​ ​procedure​ ​name​ ​is​ ​“dobeep”.​ ​In​ ​Logo,​ ​a​ ​procedure​ ​consists​ ​of​ ​the​ ​following​ ​structure:

23
A​ ​procedure​ ​begins​ ​with​ ​the​ ​keyword​ ​“to”​ ​followed​ ​by​ ​a​ ​name.​ ​Next​ ​is​ ​the​ ​procedure​ ​body
where​ ​all​ ​the​ ​commands​ ​needed​ ​for​ ​the​ ​procedure​ ​can​ ​be​ ​written.​ ​In​ ​Logo,​ ​more​ ​than​ ​one
command​ ​can​ ​be​ ​written​ ​on​ ​the​ ​same​ ​line.​ ​However,​ ​the​ ​commands​ ​can​ ​take​ ​up​ ​as​ ​many​ ​lines
as​ ​needed.​ ​Finally,​ ​a​ ​procedure​ ​always​ ​ends​ ​with​ ​the​ ​keyword​ ​“end”

In​ ​Tinker,​ ​the​ ​start​ ​and​ ​end​ ​of​ ​a​ ​procedure​ ​is​ ​taken​ ​care​ ​of​ ​visually.

Many​ ​procedures​ ​can​ ​be​ ​created.​ ​In​ ​Logo,​ ​the​ ​first​ ​procedure​ ​will​ ​be​ ​executed​ ​when​ ​pressing
the​ ​Run!​ ​Button.​ ​In​ ​Tinker,​ ​the​ ​primary​ ​procedure​ ​is​ ​colored​ ​blue.​ ​All​ ​other​ ​procedures​ ​created
afterward​ ​will​ ​become​ ​secondary​ ​(they​ ​also​ ​have​ ​a​ ​different​ ​color).

Here​ ​are​ ​guidelines​ ​about​ ​how​ ​to​ ​name​ ​a​ ​procedure:


● A​ ​procedure​ ​name​ ​cannot​ ​be​ ​the​ ​same​ ​as​ ​a​ ​Logo​ ​command.
● A​ ​procedure​ ​name​ ​must​ ​not​ ​include​ ​space​ ​or​ ​other​ ​non-alphabetical​ ​characters.

7.3​ ​DC​ ​Motor​ ​Control 

Connect​ ​a​ ​DC​ ​motor​ ​to​ ​port​ ​A​ ​and​ ​try​ ​the​ ​code​ ​below​ ​using​ ​either​ ​Logo​ ​or​ ​Tinker.

to​ ​motorcontrol
a,​ ​on​ ​wait​ ​10​ ​off
beep
end

24
This​ ​program​ ​will​ ​turn​ ​on​ ​motor​ ​A​ ​for​ ​1​ ​second​ ​(the​ ​wait​ ​command​ ​has​ ​a​ ​unit​ ​of​ ​one-tenth​ ​of​ ​a
second)

Motor​ ​Selection  
Before​ ​performing​ ​any​ ​action,​ ​a​ ​motor​ ​port​ ​or​ ​ports​ ​must​ ​first​ ​be​ ​selected.​ ​In​ ​Logo,​ ​this​ ​is​ ​done
using​ ​the​ ​port​ ​name​ ​followed​ ​by​ ​a​ ​comma.​ ​For​ ​example,​ ​“a,”​ ​will​ ​select​ ​port​ ​A.​ ​“ab,”​ ​will​ ​select
both​ ​port​ ​A​ ​and​ ​B.​ ​“abcd,”​ ​will​ ​select​ ​all​ ​four​ ​ports.​ ​Notice​ ​that​ ​the​ ​alphabetical​ ​order​ ​does​ ​not
affect​ ​port​ ​selection.​ ​That​ ​is​ ​“abcd,”​ ​is​ ​the​ ​same​ ​as​ ​“dcab,”.

In​ ​Tinker,​ ​motor​ ​port​ ​selection​ ​is​ ​done​ ​visually​ ​using​ ​the​ ​“talk​ ​to​ ​motor”​ ​block.​ ​Tick​ ​on​ ​the​ ​port
name​ ​to​ ​select​ ​that​ ​port.​ ​The​ ​example​ ​below​ ​will​ ​select​ ​port​ ​A.

Motor​ ​Actions 
Once​ ​a​ ​port​ ​or​ ​ports​ ​have​ ​been​ ​selected,​ ​actions​ ​can​ ​be​ ​performed​ ​on​ ​them​ ​as​ ​shown​ ​below.

Tinker Logo Action​ ​on​ ​the​ ​selected​ ​motor(s)

on Turns​ ​on

off Turns​ ​off

onfor​ ​1 Turns​ ​on​ ​for​ ​one-tenth​ ​of​ ​a​ ​second.​ ​This


number​ ​can​ ​be​ ​changed.

cc Rotate​ ​motor​ ​clockwise

ccw Rotate​ ​motor​ ​counter-clockwise

rd Reverse​ ​the​ ​current​ ​rotation​ ​to​ ​the


opposite​ ​direction.

setpower​ ​100 Set​ ​the​ ​power​ ​level​ ​to​ ​100.​ ​This​ ​number
can​ ​be​ ​between​ ​0​ ​(off)​ ​to​ ​100​ ​(full​ ​power).

25
Motor​ ​State 
The​ ​on-off​ ​state​ ​of​ ​the​ ​motor​ ​ports​ ​can​ ​be​ ​tested​ ​using​ ​the​ ​following​ ​reporter.

Tinker Logo Value

aon? Returns​ ​“true”​ ​if​ ​the​ ​specified​ ​motor​ ​is


“on”.​ ​If​ ​more​ ​than​ ​one​ ​port​ ​is​ ​selected,
returns​ ​“true”​ ​only​ ​if​ ​all​ ​ports​ ​are​ ​on.

Here’s​ ​an​ ​example​ ​that​ ​will​ ​turn​ ​off​ ​port​ ​A​ ​if​ ​it​ ​is​ ​on.

to​ ​off_if_on
​ ​ ​if​ ​aon?​ ​[​ ​a,​ ​off]
end

7.4​ ​Servo​ ​Motor​ ​Control 

Controlling​ ​a​ ​servo​ ​motor​ ​usually​ ​means​ ​setting​ ​the​ ​desired​ ​motor​ ​position.​ ​The​ ​command​ ​to
perform​ ​this​ ​action​ ​in​ ​Logo​ ​is​ ​“seth”​ ​which​ ​stands​ ​for​ ​“set​ ​heading”.​ ​In​ ​Tinker,​ ​use​ ​the​ ​block​ ​“Set
servo​ ​heading”.​ ​Consider​ ​the​ ​following​ ​example:

to​ ​servo_control
a,​ ​seth​ ​10
wait​ ​10
seth​ ​40
end

26
The​ ​above​ ​example​ ​will​ ​turn​ ​a​ ​servo​ ​motor​ ​connected​ ​to​ ​servo​ ​port​ ​A​ ​to​ ​the​ ​heading​ ​position
“10”,​ ​wait​ ​for​ ​1​ ​second​ ​and​ ​then​ ​turn​ ​the​ ​servo​ ​to​ ​the​ ​heading​ ​position​ ​“40”.

Position​ ​10 Position​ ​40

Servo​ ​Motor​ ​Heading​ ​Position 


The​ ​heading​ ​positions​ ​“10”​ ​or​ ​“40”​ ​in​ ​the​ ​example​ ​does​ ​not​ ​correspond​ ​to​ ​a​ ​standard​ ​angle​ ​or
unit.​ ​It​ ​is​ ​a​ ​GoGo​ ​Board​ ​internal​ ​position​ ​number.​ ​Therefore,​ ​you​ ​need​ ​to​ ​determine​ ​what
number​ ​to​ ​use​ ​so​ ​that​ ​the​ ​motor​ ​points​ ​to​ ​the​ ​desired​ ​direction.​ ​This​ ​is​ ​easily​ ​done​ ​using​ ​the
GoGo​ ​Widget’s​ ​manual​ ​servo​ ​controls​ ​as​​ ​described​ ​earlier.

Caution​​ ​-​ ​Do​ ​not​ ​use​ ​a​ ​heading​ ​position​ ​that​ ​exceeds​ ​the​ ​bounds​ ​of​ ​the​ ​servo.​ ​Since​ ​servos​ ​do
not​ ​rotate​ ​a​ ​full​ ​circle,​ ​exceeding​ ​the​ ​heading​ ​bounds​ ​could​ ​break​ ​the​ ​internal​ ​gearings​ ​of​ ​the
servo.​ ​Although​ ​different​ ​servo​ ​models​ ​and​ ​brands​ ​have​ ​slight​ ​variations​ ​but,​ ​typically,​ ​the
heading​ ​value​ ​should​ ​stay​ ​between​ ​10​ ​-​ ​40.

   

27
7.5​ ​Program​ ​Control 
 
The​ ​following​ ​example​ ​demonstrates​ ​a​ ​common​ ​use​ ​of​ ​program​ ​controls.​ ​Connect​ ​a​ ​button​ ​or
switch​ ​to​ ​sensor​ ​1​ ​and​ ​a​ ​DC​ ​motor​ ​to​ ​the​ ​output​ ​port​ ​A.​ ​Then,​ ​try​ ​the​ ​following​ ​script.

to​ ​sensor_control
forever​ ​[
if​ ​sensor1​ ​>​ ​500​ ​[​ ​a,​ ​on​ ​wait​ ​10​ ​off]
]
End

IF  
The​ ​IF​ ​program-control​ ​allows​ ​parts​ ​of​ ​the​ ​program​ ​to​ ​run​ ​only​ ​when​ ​the​ ​given​ ​condition​ ​is​ ​met.
An​ ​IF​ ​is​ ​always​ ​followed​ ​by​ ​a​ ​condition.​ ​The​ ​example​ ​above​ ​shows​ ​an​ ​IF​ ​followed​ ​by​ ​a​ ​condition
which​ ​reads​ ​“if​ ​sensor​ ​1​ ​is​ ​greater​ ​than​ ​500”.​ ​Then,​ ​the​ ​commands​ ​to​ ​be​ ​executed​ ​are​ ​located
in​ ​the​ ​“do”​ ​section.​ ​In​ ​this​ ​case,​ ​the​ ​program​ ​will​ ​turn​ ​on​ ​motor​ ​A​ ​for​ ​one​ ​second.

Conditions 
Defining​ ​a​ ​suitable​ ​condition​ ​for​ ​an​ ​IF​ ​is​ ​important.​ ​When​ ​using​ ​sensors,​ ​the​ ​first​ ​step​ ​is​ ​usually
to​ ​observe​ ​how​ ​the​ ​sensor​ ​values​ ​change.​ ​Then​ ​a​ ​condition​ ​can​ ​be​ ​defined.​ ​In​ ​this​ ​example,​ ​the
sensor​ ​value​ ​for​ ​an​ ​unpressed​ ​switch​ ​is​ ​usually​ ​0.​ ​This​ ​value​ ​jumps​ ​to​ ​1023​ ​when​ ​the​ ​switch​ ​is
pressed.​ ​ ​Therefore,​ ​the​ ​condition​ ​“if​ ​sensor​ ​1​ ​is​ ​greater​ ​than​ ​500”​ ​really​ ​means​ ​“if​ ​switch
pressed”.​ ​The​ ​number​ ​500​ ​was​ ​selected​ ​as​ ​a​ ​rough​ ​mid-point​ ​between​ ​the​ ​highest​ ​and​ ​lowest
possible​ ​values.​ ​Changing​ ​this​ ​threshold​ ​to​ ​other​ ​numbers​ ​such​ ​as​ ​100​ ​or​ ​1000​ ​will​ ​still​ ​work​ ​for
this​ ​example.

28
Condition​ ​values​ ​are​ ​more​ ​sensitive​ ​when​ ​using​ ​analog​ ​sensors,​ ​which​ ​values​ ​change​ ​in
proportion​ ​to​ ​their​ ​measurements.​ ​Consider​ ​a​ ​light​ ​sensor​ ​that​ ​is​ ​used​ ​to​ ​control​ ​a​ ​lamp​ ​so​ ​that
the​ ​lamp​ ​switches​ ​on​ ​when​ ​the​ ​house​ ​is​ ​dark.​ ​Let’s​ ​say​ ​the​ ​sensor​ ​value​ ​is​ ​zero​ ​when​ ​there​ ​is
no​ ​light​ ​during​ ​the​ ​night​ ​and​ ​the​ ​value​ ​increases​ ​and​ ​reaches​ ​800​ ​during​ ​the​ ​day.​ ​What​ ​will​ ​be​ ​a
good​ ​threshold​ ​for​ ​the​ ​program?​ ​400?​ ​The​ ​answer​ ​is​ ​that​ ​it​ ​depends​ ​on​ ​how​ ​dark​ ​it​ ​should​ ​be
before​ ​the​ ​lamp​ ​turns​ ​on.​ ​A​ ​value​ ​too​ ​low​ ​will​ ​make​ ​the​ ​lamp​ ​too​ ​slow.​ ​A​ ​value​ ​too​ ​high​ ​will
cause​ ​the​ ​lamp​ ​to​ ​switch​ ​on​ ​prematurely.​ ​In​ ​practice,​ ​the​ ​programmer​ ​will​ ​have​ ​to​ ​obtain​ ​a
suitable​ ​threshold​ ​value​ ​by​ ​observing​ ​the​ ​sensor​ ​value​ ​at​ ​the​ ​time​ ​when​ ​the​ ​lamp​ ​owner​ ​feels​ ​it
is​ ​dark​ ​enough​ ​to​ ​switch​ ​it​ ​on.​ ​In​ ​this​ ​case,​ ​the​ ​condition​ ​determines​ ​the​ ​lamp’s​ ​“light​ ​sensitivity”.

Conditions​ ​can​ ​be​ ​combined​ ​to​ ​form​ ​a​ ​more​ ​complex​ ​definition.​ ​Logical​ ​operators​ ​are​ ​often
used.​ ​The​ ​example​ ​below​ ​shows​ ​a​ ​condition​ ​that​ ​requires​ ​two​ ​buttons​ ​to​ ​be​ ​pressed​ ​in​ ​order​ ​to
turn​ ​on​ ​a​ ​motor.

if​ ​sensor1​ ​>​ ​500​ ​and​ ​sensor2​ ​>​ ​500​ ​[​ ​a,​ ​on​ ​wait​ ​10​ ​off]

IF-ELSE 
The​ ​IF-ELSE​ ​program-control​ ​is​ ​an​ ​extension​ ​of​ ​an​ ​IF.​ ​In​ ​addition​ ​to​ ​defining​ ​what​ ​actions​ ​to
perform​ ​when​ ​the​ ​condition​ ​is​ ​true,​ ​IF-ELSE​ ​can​ ​also​ ​define​ ​what​ ​to​ ​do​ ​when​ ​the​ ​condition​ ​is
false.​ ​The​ ​following​ ​example​ ​modifies​ ​the​ ​original​ ​example​ ​so​ ​that​ ​it​ ​turns​ ​on​ ​the​ ​motor​ ​when
the​ ​switch​ ​is​ ​pressed​ ​and​ ​off​ ​when​ ​the​ ​switch​ ​is​ ​released.

Ifelse​ ​sensor1​ ​>​ ​500​ ​[a,​ ​on]​ ​[​ ​a,​ ​off]

29
FOREVER 
The​ ​FOREVER​ ​program-control​ ​tells​ ​the​ ​program​ ​to​ ​loop​ ​indefinitely,​ ​executing​ ​the​ ​blocks​ ​it
contains.​ ​Most​ ​programs​ ​will​ ​need​ ​this​ ​loop.​ ​The​ ​sensor_control​ ​example​ ​is​ ​shown​ ​again​ ​below
with​ ​and​ ​without​ ​FOREVER​ ​(right​ ​and​ ​left​ ​images​ ​respectively).​ ​Without​ ​a​ ​FOREVER,​ ​the
program​ ​will​ ​check​ ​the​ ​condition​ ​once​ ​and​ ​quit,​ ​which​ ​is​ ​not​ ​the​ ​desired​ ​behavior.​ ​This​ ​is​ ​a
common​ ​mistake​ ​of​ ​beginners.

Without​ ​FOREVER With​ ​FOREVER

WAITUNTIL 
The​ ​WAITUNTIL​ ​program-control​ ​allows​ ​the​ ​program​ ​to​ ​halt​ ​until​ ​the​ ​given​ ​condition​ ​is​ ​true.​ ​The
example​ ​program​ ​below​ ​shows​ ​how​ ​WAITUNIL​ ​is​ ​used​ ​so​ ​that​ ​the​ ​program​ ​beeps​ ​once​ ​every
time​ ​a​ ​switch​ ​is​ ​pressed

​ ​ ​ ​ ​ ​Forever​ ​[​ ​if​ ​sensor1​ ​>​ ​500​ ​[​ ​beep​ ​waituntil​ ​[sensor1​ ​<​ ​500]]]

30
Note​ ​that​ ​without​ ​the​ ​WAITUNTIL,​ ​the​ ​program​ ​will​ ​beep​ ​repeatedly​ ​while​ ​the​ ​switch​ ​remains
pressed.

7.6​ ​Programming​ ​the​ ​Built-in​ ​Screen 

In​ ​Logo,​ ​use​ ​the​ ​show​ ​command.​ ​In​ ​Tinker,​ ​there​ ​are​ ​separate​ ​blocks​ ​for​ ​showing​ ​text​ ​and
numbers.​ ​The​ ​following​ ​example​ ​repeatedly​ ​displays​ ​the​ ​text​ ​“SS1”​ ​and​ ​then​ ​followed​ ​by​ ​sensor
1’s​ ​value.

to​ ​show_sensor
forever​ ​[​ ​show​ ​“SS1”​ ​wait​ ​10
​ ​ ​show​ ​sensor1​ ​wait​ ​10
]
end

Make​ ​sure​ ​the​ ​screen​ ​is​ ​in​ ​the​ ​“User”​ ​page.​ ​If​ ​not,​ ​the​ ​values​ ​from​ ​the​ ​program​ ​will​ ​not​ ​be​ ​seen.

   

31
7.7​ ​Using​ ​Variables 

A​ ​variable​ ​is​ ​a​ ​powerful​ ​tool​ ​that​ ​allows​ ​a​ ​program​ ​to​ ​count,​ ​store​ ​data,​ ​define​ ​values​ ​and​ ​much
more.​ ​The​ ​following​ ​example​ ​shows​ ​how​ ​a​ ​variable​ ​can​ ​be​ ​used​ ​to​ ​count​ ​the​ ​number​ ​of​ ​times​ ​a
switch​ ​is​ ​pressed​ ​and​ ​shows​ ​the​ ​number​ ​on​ ​the​ ​GoGo​ ​Board’s​ ​screen.​ ​Connect​ ​a​ ​switch​ ​to
sensor​ ​port​ ​1​ ​and​ ​run​ ​the​ ​following​ ​program.

to​ ​press_count
set​ ​counter​ ​0
forever​ ​[
if​ ​sensor1​ ​>​ ​500​ ​[
set​ ​counter​ ​counter​ ​+​ ​1
show​ ​counter
waituntil​ ​[sensor1​ ​<​ ​500]
]
]
End

The​ ​set​ ​command​ ​is​ ​used​ ​to​ ​assign​ ​a​ ​value​ ​to​ ​a​ ​variable.​ ​In​ ​the​ ​above​ ​example,​ ​the​ ​program
starts​ ​by​ ​setting​ ​a​ ​variable​ ​named​ ​“counter”​ ​to​ ​0.​ ​Note​ ​that​ ​this​ ​initial​ ​setting​ ​also​ ​makes​ ​the
variable​ ​name​ ​valid​ ​and​ ​available​ ​for​ ​use​ ​in​ ​the​ ​rest​ ​of​ ​the​ ​program.​ ​In​ ​Logo​ ​the​ ​variable​ ​name
“counter”​ ​can​ ​be​ ​used​ ​as​ ​an​ ​argument​ ​for​ ​any​ ​command​ ​that​ ​takes​ ​an​ ​expression​ ​as​ ​an​ ​input.

In​ ​Tinker,​ ​variables​ ​are​ ​listed​ ​in​ ​the​ ​section​ ​“Variables”​ ​and​ ​can​ ​be​ ​managed​ ​from​ ​there.​ ​To
create​ ​a​ ​new​ ​variable,​ ​drag​ ​a​ ​“set”​ ​block​ ​onto​ ​the​ ​programing​ ​area.​ ​Then,​ ​click​ ​the​ ​drop-down
button​ ​and​ ​there​ ​will​ ​be​ ​menus​ ​to​ ​either​ ​rename​ ​that​ ​variable​ ​or​ ​create​ ​a​ ​new​ ​one.

32
7.8​ ​Using​ ​the​ ​Remote​ ​Control 

Making​ ​use​ ​of​ ​the​ ​received​ ​IR​ ​remote​ ​commands​ ​are​ ​done​ ​using​ ​the​ ​Logo​ ​commands​ ​“newir?”
and​ ​“ir”.​ ​Here​ ​is​ ​an​ ​example:

to​ ​ir_control
forever​ ​[
if​ ​newir?​ ​[
set​ ​command​ ​ir
if​ ​command​ ​=​ ​128​ [
​ ​ b ​ eep]
if​ ​command​ ​=​ ​129​ [​ ​ a ​ ,​ ​on]
if​ ​command​ ​=​ ​130​ [ ​ ​ a ​ ,​ ​off]
]
]
end

33
The​ ​above​ ​program​ ​checks​ ​if​ ​their​ ​is​ ​a​ ​new​ ​command​ ​from​ ​the​ ​remote​ ​control​ ​using​ ​the​ ​“newir?”
in​ ​Logo​ ​and​ ​the​ ​“new​ ​infrared?”​ ​block​ ​in​ ​Tinker.​ ​When​ ​true,​ ​the​ ​infrared​ ​code​ ​is​ ​retrieved​ ​using
“ir”​ ​in​ ​Logo​ ​and​ ​the​ ​“get​ ​infrared”​ ​block​ ​in​ ​Tinker.​ ​This​ ​infrared​ ​code​ ​is​ ​stored​ ​in​ ​the​ ​variable
“command”.​ ​A​ ​sequence​ ​of​ ​“if”​ ​statements​ ​determine​ ​the​ ​received​ ​code​ ​and​ ​carries​ ​out​ ​different
actions.

8​ ​-​ ​Updating​ ​your​ ​Firmware 

Because​ ​the​ ​GoGo​ ​Board​ ​is​ ​constantly​ ​improved,​ ​make​ ​sure​ ​to​ ​upgrade​ ​the​ ​board’s​ ​firmware​ ​to
the​ ​latest​ ​version.​ ​You​ ​can​ ​download​ ​the​ ​latest​ ​firmware​ ​from​ ​GoGo​ ​Board​ ​website.

Using​ ​the​ ​GoGo​ ​Widget​ ​to​ ​Update​ ​the​ ​Firmware 

A​ ​firmware​ ​is​ ​a​ ​file​ ​with​ ​a​ ​.HEX​ ​extension.​ ​Once​ ​you​ ​have​ ​downloaded​ ​a​ ​new​ ​firmware​ ​and
saved​ ​it​ ​to​ ​your​ ​computer,​ ​launch​ ​the​ ​GoGo​ ​Widget​ ​and​ ​click​ ​on​ ​the​ ​“Configurations”​ ​tab.​ ​There
you​ ​will​ ​see​ ​a​ ​section​ ​on​ ​the​ ​screen​ ​that​ ​tells​ ​you​ ​what​ ​firmware​ ​version​ ​is​ ​running​ ​on​ ​the​ ​GoGo
Board.​ ​ ​Click​ ​on​ ​the​ ​“Update​ ​from​ ​file”​ ​button​ ​and​ ​select​ ​the​ ​new​ ​firmware​ ​HEX​ ​file.​ ​The​ ​update
will​ ​take​ ​place​ ​automatically.​ ​The​ ​LED​ ​on​ ​the​ ​GoGo​ ​Board​ ​will​ ​rapidly​ ​blink​ ​during​ ​this​ ​process.
Once​ ​the​ ​update​ ​is​ ​done,​ ​a​ ​new​ ​version​ ​number​ ​should​ ​be​ ​seen​ ​on​ ​the​ ​screen.

34
Caution​​ ​-​ ​Do​ ​not​ ​interrupt​ ​the​ ​firmware​ ​update​ ​process!​ ​Once​ ​the​ ​process​ ​starts,​ ​wait​ ​until​ ​it​ ​is
done.​ ​The​ ​update​ ​can​ ​take​ ​up​ ​to​ ​1​ ​minute.​ ​The​ ​GoGo​ ​Widget​ ​may​ ​appear​ ​to​ ​be​ ​unresponsive,
but​ ​the​ ​update​ ​process​ ​is​ ​still​ ​going​ ​on.​ ​Any​ ​interruption​ ​can​ ​corrupt​ ​the​ ​firmware​ ​and​ ​render​ ​the
GoGo​ ​Board​ ​unusable.​ ​The​ ​only​ ​way​ ​to​ ​fix​ ​a​ ​corrupted​ ​firmware​ ​is​ ​to​ ​re-flash​ ​the​ ​processor
using​ ​a​ ​flashing​ ​tool.

35

Das könnte Ihnen auch gefallen