Experimenter’s Module
5.2 Programming the Digital I/O Ports
Use the sfCOMDIGOUT PSOS command and the related Saphira convenience command to manage the various digital output ports. They are described in detail in the previous chapter. (PAI and
For example, to turn the right LED on, use:
sfRobotCom2Bytes(sfCOMDIGOUT, sfRIGHTLEDBIT, sfRIGHTLEDBIT)
Or alternatively, specify the state of an LED:
void sfGripperSetLed(int which, int state)
for which=sfLEFT or sfRIGHT, and state=sfON or sfOFF.
5.3 Programming the A/D Ports
The eight
Each AN port accepts a
single byte value
For example, the following Saphira command addresses the AN4 port by masking the
sfRobotCom2Bytes(sfCOMDIGOUT, 0xE0, 0x80)
5.4 Programming the Speaker
The latest PSOS implements a new command called SAY, which plays a sequence of up to 20 notes through the Experimenter’s Module speaker. Now your Pioneer will be humming a different tune!
The SAY command (number 15) has two arguments: a string up to 40 bytes long, and the integer number of actual bytes in the string:
sfRobotComStrn(sfCOMSAY, str, n)
The string is comprised of duration and tone pairs; the duration byte is the number of
20 millisecond increments the following tone value
For example, to play two short, high beeps using the Saphira equivalent command:
void sfPlayToneString ("\010\002\010\000\010\002", 6)
18