Specifications
A bps value of 1 selects 115,200 bps (This large number would not fit into a SNAPpy integer, and so
was treated as a special case).
Usually you will set bps directly to the desired bits per second: 1200, 2400, 9600, etc.
NOTE – you are not limited to “standard” baud rates. If you need 1234 bps, do it.
Valid baud rates are platform-dependent. Refer to the back of this document.
This is the short form of the initUart() function. Data Bits defaults to 8, Parity defaults to None, and
Stop Bits defaults to 1.
This function returns no value.
initUart(uart, bps, dataBits, parity, stopBits) – Initialize a UART
This is the long form of the initUart() function just described.
This function programs the specified uart (0 or 1) to the specified bits per second (bps).
In addition, this variant of the initUart() function also allows you to specify the dataBits (7 or 8), the
parity (‘E’, ‘O’, or ‘N’ representing EVEN, ODD, or NO parity), and the number of stop bits.
This function returns no value.
initVm() – Initialize (restart) the SNAPpy Virtual Machine
This function takes no parameters, and returns no value.
Calling this function restarts the SNAPpy virtual machine. If a SNAPpy image is currently loaded in
the node, the scripts “startup” handler will be invoked, and then normal SNAPpy script execution will
begin (timer hooks, GPIO hooks, STDIN hooks, etc.)
This function is normally only used by Portal and SNAPconnect (at the end of the script upload
process).
This function does not return a value.
int(obj) – Convert an object to numeric form (if possible)
Converts the specified obj (usually a string) into numeric form. For example, int(‘123’) = 123,
int(True) = 1, and int(False) = 0.
NOTE – unlike regular Python, the SNAPpy int() function does not take an optional second parameter
indicating the numeric base to be used. The obj to be converted to a numeric value is required to be in
base 10 (decimal).
SNAP Reference Manual Document Number 600-0007K Page 59 of 202