Specifications

Output from the print statement is enqueued to STDOUT, which can be connected to a serial port or
transparent connection using the switchboard API (see the crossConnect() function).
Since a limited number of output RAM buffers can be enqueued to STDOUT, a script doing lots of
‘print’ output will need to HOOK_STDOUT. This allows your script to ‘print’ more output as space
becomes available.
pulsePin(pin, msWidth, isPositive) – Generate a timed pulse
You could generate a pulse using an IO pin, and multiple writePin() commands. Function pulsePin()
lets you initiate the pulse in a single step, gives you finer grained control of the pulse duration, and
frees your script from having to “time” (countdown) the pulse.
Parameter pin is which IO pin (GPIO_0-GPIO_18 on an RF100 SNAP Engine) to generate the pulse
on. Parameter msWidth specifies the desired pulse width in milliseconds (1-32767)
Specifying a pulse width of 0 will simply result in no pulse at all.
Specifying a pulse width > 0 will generate a non-blocking pulse – pulsePin() just initiates the pulse,
but your SNAPpy script continues to run in parallel. Among other things, this means you can have
multiple pulses in progress at the same time.
As of version 2.2, you can also specify a negative pulse width. Specifying a negative pulse width
instead of a positive pulse width does two things:
1. It makes the pulse generation “blocking.” When you specify a negative duration, the pulse runs
to completion, and then your SNAPpy script resumes execution at the next line of code.
2. The time units are different for negative values. The resolution varies by platform, but is
typically in the range of 1 microsecond per “tick.” Refer to the “platform section” for your
hardware in section 10 of this document for specifics. As a quick example, on a Synapse
RF100 SNAP Engine a msWidth of -10000 would result in a pulse approximately 10
milliseconds wide.
Parameter isPositive controls the polarity of the pulse. It essentially specifies the logic level of the
leading edge of the pulse, and the opposite of this value is used for the trailing edge of the pulse.
This function has no effect unless/until the specified IO pin is also configured as an output (via
setPinDir()).
This function does not return a value.
Page 66 of 202 SNAP Reference Manual Document Number 600-0007K