Specifications
random() – Generate a random number
This function returns a random number between 0-4095.
This function does not take any parameters.
readAdc(channel) – Read an Analog Input pin (or reference)
This function can be called to read one of the available analog input channels. Some channels
correspond to external analog input pins, the internal low voltage reference, or the internal high
voltage reference.
Parameter channel specifies which analog input channel (platform dependent) to read.
readPin(pin) – Read the logic level of a pin
This function can be called for IO pins that are configured as digital inputs or digital outputs (see also
setPinDir()).
Parameter pin specifies which IO pin to read.
This function returns a boolean value representing the current logic level of the specified pin. For an
input pin, this is a “live value.” For an output pin, this is the last value written to the pin.
reboot() – Schedule a reboot
This function takes no parameters, and returns no value.
Approximately 200 milliseconds after this function is called, the SNAP node will reboot.
The 200 milliseconds delay is to allow the node time to acknowledge the reboot() request (in case it
came in over-the-air).
resetVm() – Reset (shut down) the SNAPpy Virtual Machine
This function takes no parameters, and returns no value.
When this function is called, the SNAPpy Virtual Machine stops running any loaded script (but the
script remains in the unit).
This function is used (by Portal and SNAPconnect) at the start of the script upload process, and would
not normally be used by users. However, sometimes when testing a script it is useful to be able to halt
it.
See also function initVm(), which restarts the SNAPpy VM.
SNAP Reference Manual Document Number 600-0007K Page 67 of 202