ALERT chat_name|recipient_list message
Sends an urgent IM to one or more recipients. Multiple recipients can be included, using a comma as a separator. Recipient numbers must be written in International format including the country code, but without characters such as -,( and ). Variable names included in your message will automatically be replaced. If you want to create a chat with a specific name/subject line, use the NEWCHAT command, and then include the chat's name as the first parameter.
TEMP myval IF myval<0 ALERT 12345556789,61401234567 It's myval degrees! EI
IM,HM,SM,SMTO,IMTO,NEWCHAT
AP LIST AP SCAN AP STATUS AP ADD ssid password [priority] AP USE ssid|number AP PRIO ssid|number|auto|manual [new_priority] AP DEL ssid|number AP SETIP ssid|number ip netmask gateway dnsip
This command allows you to configure and manage multiple Access Points.
AP LIST lists the configured access points. This command provides a numbered list of access points. When using the other commands (AP DEL, AP SETIP, AP USE, AP PRIO), you can specify the number of the access point, OR the SSID.
AP SCAN performs a WiFi scan and reports all visible access points.
AP STATUS shows the access point currently connected, along with the IP address of the SiB.
AP USE allows you to change to another access point in real-time.
AP PRIO allows you to change the priority of an access point if you have more than one configured. When the SiB connects to the Internet, it will try each access point starting from the access point with the lowest number. You must specify a priority value when setting the priority for an SSID or numbered access point. You can also use AP PRIO AUTO to switch to automatic mode, where the SiB will automatically connect to the strongest signal, rather than follow the priority order. Use AP PRIO MANUAL to return to the priority-ordered connection.
AP ADD adds an access point. The PRIORITY parameter is optional. If the priority parameter is left out, AP ADD will automatically add the access point as the first access point. Note that AP ADD does not test the access point first, so ensure you enter the SSID and password correctly!
AP DEL deletes an access point. Note that you cannot delete the access point you are currently using, and you cannot delete an access point if it is the only one remaining!
AP LIST AP SETIP myHomeRouter 192.168.0.22 255.255.255.0 192.168.0.1 8.8.8.8 AP PRIO 1 2 AP ADD my_router abcd1234
PREW,POST
AUTH ADD|DEL|LIST [number]
This function allows you to managed authorized users for your SiB™. The authorized users will be able to issue commands to your SiB™ directly via IM in SiMP. User phone numbers must be entered in international format without any formatting symbols such as +, -, ( and ). It is NOT ENOUGH to simply AUTH ADD a SiMP user. Once you have authorized the user, you must add them to the SiB chat from within SiMP. To view a list of authorized users, send AUTH LIST.
AUTH ADD 12345556789 AUTH DEL 61401234567
IGNORE
BT SEND targetName command BT RECEIVE targetName
Two SiBs can communicate via Bluetooth using the BT command.
The receiving SiB must be powered externally as it needs to remain powered on in SiD mode.
The receiving SiB will receive commands from the sending SiB and execute them.
A command can be any supported SiB command, including RUN programName or running a custom function.
The sending SiB could be in SiB mode (sending when pressed) or in any SiD program.
The parameter targetName should be a single unique word (no spaces) that is shared between the two SiBs. This is how the two SiBs find each other.
Receiver: PROG rec BT RECEIVE homeLights Sender: PROG S BT SEND homeLights WD GREEN 1 PROG L BT SEND homeLights WD GREEN 0 This program requires two SiBs, the first SiB running the program rec in SiD mode, the second SiB having two programs. When the second SiB is pressed short, it will light the GREEN LED of the receiving SiB. When the second SiB is pressed long, it will turn off the GREEN LED of the receiving SiB.
BUTTON S|L functionName
This function allows a long-running SiD or SiB program to monitor and take actions when a button press is detected. The first parameter is the letter S (for short click) or L (for long click). The second parameter is a function name. After this command is issued in a PROG, the SiB, until the next reboot, will monitor the button for presses. When a button press is detected, the SiB will call the appropriate function. NOTE that if you are already running a function, that function will be interrupted for the button-press function and will NOT return. If a short (s) function is setup but not a long (l) function, the short function will be called for presses of any length. A short and long function can be added in the same running program by calling the BUTTON function twice. The BUTTON command only listens for button presses while your SiB is awake. It will not listen for button presses while your SiB is sleeping (SL). Your PROG must also run the BUTTON command after each point where it wakes from any sleep/wake command, if you intend to receive button events in these blocks.
FUNC myShortFN IM Short Press FUNC myLongFN IM Long Press! PROG myProg BUTTON S myShortFN BUTTON L myLongFN LOOP
IF
CALIB HALL CALIB STATUS|LIST CALIB RV millivolts CALIB TIME [seconds] CALIB TEMP[+] degrees_celsius
While SiBs will leave the manufacturer pre-calibrated, in some cases it may be necessary to recalibrate a SiB component.
Use CALIB STATUS to view the current calibration status. You can use this command to calibrate time-keeping when in sleep mode, the temperature, battery voltage, and the magnetic sensor (hall sensor).
CALIB HALL calibrates the magnetic sensor. You must issue this command when the SiB is mounted in it's intended location, with the magnet REMOVED.
CALIB RV calibrates the battery voltage reading, which is used to report remaining battery life.
CALIB TIME calibrates the SiB's accuracy in keeping time while in Sleep mode. This is accomplished by sleeping for a given duration and then measuring the actual time passed. You can specify the sleep duration in seconds (i.e, CALIB TIME 600 will measure a 10 minute span). The default is 600 seconds.
CALIB TEMP calibrates the SiB's temperature. You must issue this command while the SiB is in SiB mode and while it has been off for at least 30 minutes. The SiB is very sensitive to it's own internal temperature. Issue this command after 30 minutes and then press your SiB to run the calibration. You must specify the ambient temperature in degrees Celsius.
CALIB TEMP+ works the same way as CALIB TEMP but forces your SiB to sleep for a period before applying the calibration.
CALIB TEMP 24 CALIB TIME 600 CALIB RV 3100 CALIB STATUS CALIB HALL
CHART SUBMIT|LOG|RESET chartName [variable] [name=value] ...
The chart command can collect data over time and store it locally on the SiB while WiFi is off. The data can be submitted after a given period of time (for example, once daily) to the SiBCloud portal. The SiBCloud portal will render the graph in any web browser!
This command has three options:
SUBMIT: Submits data collected to the SiBCloud Portal and resets the data locally
RESET: Resets the data locally without submitting to SiBCloud
LOG: Adds data to the chart collection
The SiB can collect data for multiple charts at the same time. Each chart is given a name (as the second parameter). The name can be any text containing letters and number, but no symbols nor spaces.
To generate a new chart, you simply need to CHART LOG to a new name.
Each chart can also hold and display up to ten individual items, and charts are ALL rendered over time.
For example, a single chart can display the temperature and the air quality value, if your SiB was equipped with appropriate accessories.
The chart accepts up to 10 values in the following format:
- A variable name on it's own
- a name and value pair that is NOT a variable, for example: CHART LOG myChart x=1
- a value on it's own: CHART LOG myChart 1
When logging to a specific chart, each LOG must match the format of the former LOG. For example, you cannot do:
CHART LOG mychart temperature
CHART LOG mychart airquality
in two separate lines. This will create two timed records, where one record has /only/ the temperature and the next record has /only/ the airquality value. Items must be
charted together if they are to appear on the same chart, for example: CHART LOG mychart temperature airquality
PROG chartQ PREW TEMP myTemp CHART LOG temptime myTemp IF $h=18 POST CHART SUBMIT temptime EI SL 1h LOOP This program charts the temperature every 1h and stores it in a chart named 'temptime'. Once a day between 18:00 and 18:59 it will connect to WiFi and submit the chart to the SiBCloud, which will display the temperature over time in a graph. Note the use of PREW in this program, will ensure that the SiB uses minimal battery during the day as it only connects to the Internet once.
CONF setting value
CONF is the primary function to apply configuration changes to the SiB.
Issue CONF LIST to view all available settings and their current value:
CPU.SPEED: Can be set to MIN or MAX (maximum speed is dependent on the CPU installed on the SiB)
SAFETIES: Can be set to ON or OFF. Set to OFF to disable safeties that prevent accidental battery drainage.
SSIDPRESS: Sets the number of seconds to wait for a long-press to exit a WAKESSID sleep.
TEMP: Sets the default temperature scale to C or F
LANG: Sets the language code: example: fr, en_us, en_ca, pt
OFFLINE: when the SiB is offline, it can store IMs to be sent later (send CONF OFFLINE STORE), or discard the IMs (CONF OFFLINE DISCARD)
PERSIST: Sets how persistent the SiB should be at attempting to re-connect to WiFi in the event that it fails; and sets the interval of time between retries. For example, to retry wifi 3 times with 1 minute between each retry, send CONF PERSIST 3 1m
PIN: Sets the PIN code required to factory-reset the SiB. Use CONF PIN OFF to disable.
RECOVERY: Can be set to ON or OFF. If set to OFF, factory reset by long-click is disabled.
HEALTH: Your SiB when in SiD mode, will send health reports to the SiB network on a specified interval of days (CONF HEALTH 1d 12), weeks (CONF HEALTH 1w 12), or months (CONF HEALTH 1m 12). The health reports include the battery status. If a SiB fails to submit a report, an IM is automatically sent to you to notify you of a SiB failure. The second parameter (in the examples, 12) is the hour that you want to receive the notifications. You can also enable realtime health alerts for SiBs that run in SID mode with external power.
Send CONF HEALTH ONLINE 1m to get notified after 1 minute of inactivity. 30s is the minimum time for this setting. In this configuration, a daily health report is still submitted, but the failure reporting occurs as soon as the timeout has elapsed. Turn off with CONF HEALTH OFF.
ERRORS: Configures the type of IM to be sent to report WiFi failover or failures. By default, these are sent as an IM, but you can choose instead DM, SM or ALERT.
CONF SAFETIES OFF CONF TEMP F
STATUS
DEBUG on|off
This command enables or disables debug messaging.
When enabled, you will receive extra information via IM about operations on your SiB™. Debug mode is disabled by default.
The debug output is limitted at the present time; this command has little value except for very specific conditions.
DEBUG OFF
DIM zero triac percentage
This function allows you to control a triac dimmer with the SiB. The first two parameters are the GPIOs used by the traic dimmer, and the percentage parameter sets the brightness on a scale from 0 to 100.
DIM 4 21 80
PWM,WA
DL[+] time
This function pauses a running SiB program for a specified amount of time. The time parameter is by default a value in milliseconds; however the following suffixes are permitted: s = seconds, m = minutes, h = hours. For example, DL 1h will delay execute for one hour.
Your SiB™ continues to operate during that time and unless notifications are disabled, your SiB™ will accept and queue commands received by IM.
This command can be enhanced with the + symbol, for example: DL+ 1h. This symbol instructs your SiB™ to use calibrated time. See HELP CALIB for more information.
The DL command cannot be used in STOPPED mode; it must only be used in a running program.
IM Hello! DL 10s IM World!
CALIB,SL,SLB,UDL
DM message...
Sends a silent, already opened IM to SiMP. SiMP will not display a notification nor play a tone, and will NOT show a new item in the chat. This is useful for a any SiB program that needs to send regular information to SiMP without triggering a notification each time. Variable names included in your message will automatically be replaced.
DM This is a direct message.
IM,HM,ALERT,SMTO,IMTO
EI
EI (ENDIF) marks the end of an IF instruction block. See HELP IF for more information
IF a>10 IM a is bigger than 10! EI
IF,ELSE
ELSE
The ELSE command is used in an IF statement to define a block of instructions to run if the IF statement is FALSE.
IF a=1 IM a is one ELSE IM a is not one! EI
IF,EI
EN
This function immediately exits a FOR ... NEXT. The program will continue running on the line following the NEXT command.
You must NEVER use this command while outside of a FOR...NEXT, or in an incomplete FOR...NEXT loop.
FOR i 1 10 1 TEMP myVal if myVal>30 EN EI SL 1h NEXT This program reads the temperature once every hour for 10 hours, but stops if the temperature is over 30 degrees.
FOR,NEXT
FL pin|STATUS|STATE|RED|GREEN|BLUE
This command resets a GPIO to a floating state; that is, any output, pull-up, pull-down or hold on the pin is removed. The pin number can be represented by a variable.
You can also see the status of all GPIOs with the FL STATUS or FL STATE command.
FL 23
WD,WA,HOLD
FLUSH
This command should only ever be used in conjunction with PREW and PRE.
FLUSH pauses the program execution until WiFi connects and all items in queue have run.
PROG flush PREWIFI : program is running with wifi OFF : do some processing... : PRE stars wifi connection PRE : do something while wifi is connecting.. : wait until wifi finishes FLUSH : SiB is now online
POST,PREW,PRE,STARTWIFI
FN DEL|PRINT [name] FN [name] FN LIST
This function allows you to create or manage functions. Functions can be run directly from an IM simply by sending the function name.
Functions also support parameters. You can use up to 10 parameters by placing <0> to <9> in your function source code where needed.
To manage functions, you can execute the following:
FN LIST: shows a list of functions
FN DEL name|*: Deletes the named function, or delets all functions if * is used.
FN PRINT name: Prints the function's source code
To create a new function, start an IM with FN name, and then enter the function's instructions on the following lines in the same IM.
Your function name must be a single word without spaces and without numbers.
The SiB can run only one function at a time. If a function is running and you start another function, the first function will not complete. Functions have no return values.
FN myFunc IM hello <0>! myFunc World
PROG,RUN,STOP,PAUSE,RESUME
FOR var start end increment ... NEXT
This function creates a FOR loop, allowing you to repeat a step multiple times or increment a variable.
The FOR loop is inclusive for both the start and end value.
p to and including 0. The block will send a message with the current step value, then check the status of GPIO 35. IF GPIO 35 is high, the loop is ended early with EN. Otherwise, it continues until its end.
PLEASE NOTE that FOR cannot be used within a FN (function); only within a PROG (program).
FOR myVar 1000 0 -100 IM Step myVar RD button 35 IF button=1 EN EI NEXT This program will loop and run the block with a value of 1000, then 900, then 800, u
EI,EN,NEXT
FORMAT PLEASE
This command foramts your SiB™. It effectively performs a factory reset.
There is no confirmation prompt when this command is issued. This command executes immediately and all content on your SiB™ is lost.
Your SiB™ will enter provision mode on the next power-on or reset. You must delete your SiB TILE from SiMP manually.
FORMAT PLEASE
FREQ gpio frequency duration
This function generates a square frequency (consisting of only HIGH and LOW outputs), on a specific GPIO.
The frequency parameter is given in HZ, and the duration can be given in milliseconds (ms), seconds (s), minutes (m) or hours (h).
FREQ 8 200 1m
WD,WA,PWM
GET s|i variable url
This function performs an HTTP or HTTPS get request and returns the result to the SiB program.
The first parameter specified whether the result should be returned as a string (s) or an integer (i).
The variable to receive the request result is provided next, followed by the URL.
Be Aware: GET requests are processed by a SiB API server, and not directly by the SiB itself.
This ensures that any unexpected failure, timeout, or other result can be handled safely without impacting the SiB's firmware or battery status.
In addition, it allows us to provide new technologies, deploy new SSL certificate authorities, etc, without requiring SiB updates.
GET i myYear https://someurl.abc/get_year.php IM The current year is : myYear
HALL [variable]
This function reads the HALL sensor's value and stores it into a given variable. If no variable is specified, the function will send an IM with the HALL reading.
Due to a hardware requirement, this function will clear any GPIOs in HOLD state before executing.
Ideally, a HALL reading when no magnet is present should return 0 or a value near 0. If HALL reads a higher value or lower value, it may need to be recalibrated.
While all SiBs are calibrated by the manufacturer, it is sometimes necessary to recalibrate. See HELP CALIB for further information.
HALL myVal IF HALL>20 OR HALL<-20 IM a Magnet is present! EI
WAKEHALL
HALT
This command powers down the SiB and clears all variables stored in-memory. After running this command, your SiB will not be using any battery power, but will awaken again if the button is pressed. If HALT is issued or used in a program, the program will resume when the SiB is pressed again.
HALT
SLB,RESET,STOP
HM message...
Sends a hidden IM to SiMP. SiMP will not display a notification nor play a tone. Variable names included in your message will automatically be replaced.
IMs received in SiMP™ from this function will not be visible in any conversation, unless the user enables the "Include Diagnostics Messages" Filter.
HM This is a hidden message.
IM,HMTO,ALERT,SMTO,IMTO
HMTO chat_name|recipient_list message
Sends a hidden IM to one or multiple recipients. SiMP will not display a notification nor play a tone. Multiple recipients can be included, using a comma as a separator. Recipient numbers must be written in International format including the country code, but without characters such as -,( and ). Variable names included in your message will automatically be replaced. If you want to create a chat with a specific name/subject line, use the NEWCHAT command, and then include the chat's name as the first parameter.
IMs received in SiMP™ from this function will not be visible in any conversation, unless the user enables the "Include Diagnostics Messages" Filter.
HMTO 12345556789,61401234567 This is a silent message.
IM,HM,ALERT,SM,IMTO
HOLD[+] gpio|red|green|blue|variable 0|1
This function holds a pin output to high or low even during deep sleep.
NOTICE: This command will briefly reset the state of the GPIO and render it floating.
This function only works on RTC pins. An error will be returned if an invalid pin is given.
Specify 1 for HIGH, and 0 for LOW.
When deep sleep ends, the HOLD value is lost and the PIN will reset to its default state.
HOLD+
If you wish to carry a held value after a reset or deep sleep, issue HOLD+ instead of HOLD.
HOLD+ may only be used on RTC GPIOs.
HOLD 18 1
WD,FL
HR time
In SiD mode, the SiB regularly polls for inbound messages. By default, the interval is set to 10 seconds. However, the interval can be reduced if necessary.
In most cases, changing this setting is not needed, as the SiB has an inbound PUSH mechanism to instantly receive messages. However, in networks where UDP is blocked or the push mechanism is blocked, a reduction in the polling interval will result in faster responses from your SiB to commands sent via SiMP.
The time parameter can be given in millseconds (ms) or seconds (s), with a minimum of 200ms and a maximum of 10s.
HR 8s
CONF
IF variable =|>|>=|<|<=|!= value [AND|OR] [condition 2] ... IF BUTTONWAKE IF BUTTONWAKES IF BUTTONWAKEL IF TIMERWAKE IF ONLINE|OFFLINe IF SSID =|!= ssid
An IF block is used to run a set of instructions only if a condition is met. The IF command in the SiB has a few preset functions:
IF BUTTONWAKE: executes if the SiB woke from a button press in an SLB, WAKEHALL, WAKEAT, or WAKEC block.
IF BUTTONWAKES: executes if the SiB woke from a short button press in an SLB block
IF BUTTONWAKEL: executes if the SiB woke from a long button press in an SLB block
IF TIMERWAKE: executes if the SiB woke from a timer in an SLB block
IF ONLINE: executes if the SiB has WiFi access
IF OFFLINE: executes if the SiB does not have WiFi access
IF SSID =|!= ssid: executes if the currently used WiFi access point matches the specified SSID
Beyond these, any combination of conditions using any variable or system variable is support.
The IF statement uses the operations = (equals), != (does not equal), <, <= (less than, less or equal to), >, >= (greater than, greater or equal).
The IF statement can also combine multiple conditions using the keywords AND and OR.
The IF statement can use any variable, including the following system variables:
$ver: The SiB Firmware version
$h: The current hour
$m: The current minute
$t: The current time - when comparing with $t, the second operand must be in the format: HH:MM (24 hours)
An IF block must be terminated with an EI (end if) statement; and can include an ELSE block.
SLB 10m IF BUTTONWAKE IM 10 minute sleep interrupted by button EI IF myVal>10 AND myVal<13 IM My value is 11 or 12! ELSE IM My value is not 11 or 12! EI
ELSE,EI,SET
IGNORE ADD|DEL|LIST [number]
When using your SiB to send out messages, it is often useful to send messages to other users, who should otherwise have no access to your SiB. Using the IGNORE command, you can add a person's mobile number to SiB's ignore list. The person will still be able to receive messages from the SiB, but anything they enter in the chat will be ignored by the SiB.
IGNORE ADD 12345556789 IGNORE DEL 61401234567 IGNORE LIST
AUTH
IIC ON sda scl frequency [1|0] IIC OFF IIC REGR address register len variable IIC REGW address register value IIC SEQ sequence
With this function, your SiB can communicate with a connected I2C device. This function supports a variety of communication methods to cover most common I2C uses.
You must first enable I2C on an IO pair (SDA, SCL). Note that the SiB will only allow I2C communications on a single bus (one SDA IO and one SCL IO), since an I2C bus can support multiple connected devices on the same bus. To enable I2C, issue the command
IIC ON sda scl frequency [1|0]
- sda and scl are to be replaced with your selected GPIOs, frequency is the number of bits per second, and an optional hardware pull-up is available by setting the last (optional variable) to 1.
To disable or terminate an I2C session, use IIC OFF.
To read a register, use:
IIC REGR address register length variable
- address is the I2C address as a 2-character hexadecimal value
- register is the device register to read from, as a 2-character hexadecimal value
- len is the length to read, either 1 (1 byte), 2 (2 bytes). Append to the length u for unsigned (for example: 1u to read 0 to 255, or just 1 to read -128 to 127). Append m to the length (2m, 2um) to swap from little-endian to big-endian
- variable is the name of the variable to receive the read data.
To write to an I2C register, use IIC REGW:
IIC REGW address register value
- address is the I2C address as a 2-character hexadecimal value
- register is the device register to write to, as a 2-character hexadecimal value
- value is either a 1 or 2 byte value represented as either 2-hexadecimal characters, or 4-hexadecimal characters
You can use the final variation: IIC SEQ, to submit a sequence of IIC commands in a single operation. This is necessary for any device that requires multiple register writes in order to initialize.
A sequence string includes the following characters:
b: indicates the beginning of a block
p: indicates the end of a block
w: indicates the start of a write operation. W is followed immediately by a 2-character hexadecimal address
+: indicates a required ACK from the remote device.
All other values are in hexadecimal.
For example, to initialize registers 1 and 2 of an IIC device at adddress 88, with the values 0x44 and, ox8844, send:
IIC SEQ BW88+01+44+PBW88+02+44+88+P
IIC ON 26 25 200000 1 IIC SEQ BW88+01+44+PBW88+02+44+88+P IIC REGR 88 03 2 myvar IM I read 16 bits as : myvar !
IIS bclk ws output input IN|OUT bits bitrate duration filename
Plays or records audio.
IIS requires at least three GPIOs: bclk (clock), WS (word select), and either INPUT (if recording) or OUTPUT (if playing audio).
When recording audio, put 0 for "output" and use the IN parameter.
When playing audio back, put 0 for "input" and use the OUT parameter.
The bits parameter supports 16 and 32 bits.
The bitrate parameter supports 8000 and 16000.
Duration is specified in seconds.
IIS 4 0 0 2 IN 16 8000 10000 myFile IIS 18 17 5 0 OUT 16 8000 10000 myFile
IISMCLK
IISMCLK gpio
If you are using I2S to record or play audio and require a Master clock GPIO, use this command before the I2S command to configure the clock GPIO.
IISMCLK 4
IIS
IM message...
Sends an instant message to SiMP. Variable names included in your message will automatically be replaced.
IM This is an instant message!
SM,HM,ALERT,SMTO,IMTO
IMTO chat_name|recipient_list message
Info: Sends an instant message to one or multiple recipients. Multiple recipients can be included, using a comma as a separator. Recipient numbers must be written in International format including the country code, but without characters such as -,( and ). Variable names included in your message will automatically be replaced. If you want to create a chat with a specific name/subject line, use the NEWCHAT command, and then include the chat's name as the first parameter.
IMTO 12345556789,61401234567 This is an instant message!
SM,HM,ALERT,SM,IMTO
INIT variable=value
This function initializes a variable to the given value if the variable does not already exists.
This function should always be used at the beginning of a program (after PREW for pre-wifi programs, which must be the first line).
If a variable with the given name already exists, it's value will not be modified.
You cannot use mathematical equations in this command; the target value must be an integer.
INIT a=0 SET a=a+1 IM a equals 1
SET
IO LED on|off
This function allows you to toggle the SiB™'s default LED use on or off.
This function must be followed by a reset in SID mode. When the LED is ON, the SiB™ will animate the LED to provide feedback. When the LED is OFF, the SiB™ will not make use of the LED, leaving the GPIOs available for your use. The LEDs can still be used directly via WA in this mode.
IO LED OFF
CONF
LOOP
This function should only be used in a PROG.
Outside of a program, this function resets the current running program back to the first line, even if the running program is paused.
This function, when execute, loops back to the beginning of a program. It can be used to create long-running SID-mode programs.
Labels can be added into your program for looping. A label is any keyword followed by a colon (:). If a label is specified, LOOP will jump to the line with the matching label.
The LOOP command can also be limitted to a specific number of iterations. Specify an iteration quantity after the label to limit the number of LOOPS performed.
PROG loopcount SET count=0 increment: SET count=count+1 LOOP increment: 8 IM The total is count
FOR
MASK variable value
This function applies an AND mask to a variable.
SET myVal=5 MASK myVal 4 : myVal is equal to 4 (5 & 4 = 1) MASK myVal 8 : myVal is equal to 0 (4 & 8 = 0)
SHIFT,SET,INIT
MODE sib|sid
The SiB supports two operation modes: SiB and SiD.
In SiB mode, at startup, a button click sequence is detected and the appropriate program is selected and executed.
If no program exists, the SiB goes back to sleep. If a program executes and the execution completes, the SiB goes back to sleep.
In SiD mode, at startup, the button click sequence detection is skipped and the last running program resumes.
When a running program ends, the SiD stays on and waits for a command.
MODE SID
RUN,RESUME,PAUSE,STOP
NEWCHAT chatName recipients chatSubject
This function creates a new chat that can be used in IMTO, SMTO and ALERT.
The first parameter (chatName) must be a short word (no spaces) that will represent this chat in all IMTO/ALERT/SMTO commands.
The recipient list must be comma separated, and each number must be in international format without formatting characters such as -, ( and ).
The chat subject chosen will show up on each recipient's SiMP app.
NEWCHAT myChat 12345556789,61401234567 Grocery List IMTO myChat Hey everyone, here's my shopping list!
IMTO,SMTO,ALERT
NEXT
This statement marks the end of a FOR loop. See FOR for more information.
FOR i 0 10 1 IM Number i NEXT
FOR
NOSAVE
This function stops any future save operations on the SiB until the next power cycle (such as waking from SL). There are many reasons this function might be used. The SiB saves the program state on each program line execution, and each variable change. These operations can add hundreds of milliseconds to a running program, and may be undesirable in a program where the state is not needed (i.e., in a SiB program that resets on each power cycle). Likewise, this reduces overall battery use.
NOSAVE
NOTIFS
NOTIFS on|off
This command MUST only be used within a Program. A NOTIFS OFF must be followed by a NOTIFS ON within a Program.
This command disables polling and inbound IM push notifications to the SiB. As a result, once NOTIFS OFF is executed, you will not be able to send any commands to your SiB until your program executes NOTIFS ON. This may leave your SiB in a state that can only be recovered by a factory reset.
This command exists to allow time-critical functions to execute without any external delays.
If your program executes any function that requires a reset or a deep sleep, the NOTIFS state will NOT be preserved after the SiB wakes up again.
PROG myProg NOTIFS OFF FOR i 0 1000 1 RD 18 myVAl WD 19 myVal NEXT NOTIFS ON
PAUSE
Pauses the execution of the current running program or function. When Pause is issued, the SiB™ stays powered on and awaits further instruction. The current line of execution is stored so the program can be resumed. Note that PAUSE will not interrupt a running DELAY. The DELAY will finish before pause takes effect.
RUN myProg PAUSE myProg RESUME myProg
STOP,RUN,RESUME
POST
Instructs the SiB™ to connect to WiFi when used in a PREW program. See PREW for more details.
Must only be used in SiD mode.
PROG myprog PREW : read temperature TEMP mytemp : if temperature is below freezing, start WiFi and then send the IM IF mytemp<0 POST IM The temperature is below freezing EI : check again in 1 hour. SL 1h LOOP
PREW,FLUSH,PRE
PRE
This command should only be used in a PREW program where an action, such as a measurement, etc, needs to be executed concurrently while WiFi is connecting.
When the concurrent operation completes, the command FLUSH should be used to wait for WiFi to complete.
In most conditions, this command is not needed, and STARTWIFI (which connects to WiFi but delays the program until WiFi connects) should be used.
PROG myPre PREW : start wifi but keep doing work PRE TEMP myval : wait for wifi to finish FLUSH IM my temperature at startup was myVal
PREW,POST
PREW
This command runs entire programs without starting the WiFi component, preserving battery.
PREW instruct the SiB™ to skip WiFi at startup in a program. To use PREW in a program, PREW MUST BE the first line of the program.
Regardless of where in the program the SiB wakes up, wether it is after an SL command, or a WAKEHALL command, etc, the SiB will always start with WiFi off.
You must use the command POST whenever the SiB needs to go online (i.e., to send an IM, etc).
When running a PREW command, if the SiB powers on with the button pressed down, PREW will be bypassed and the SiB will go online.
PROG myprog PREW : read temperature TEMP mytemp : if temperature is below freezing, start WiFi and then send the IM IF mytemp<0 POST IM The temperature is below freezing EI : check again in 1 hour. SL 1h LOOP
PRE,POST,FLUSH
PROG DEL|PRINT|LOAD [programName] PROG [progName] PROG LIST
This function allows you to create or manage programs.
To manage programs, you can execute the following:
PROG LIST: shows a list of programs
PROG DEL progName|*: Deletes the named program, or deletes all programs if * is used.
PROG PRINT progName: Prints the program's source code
PROG LOAD progName: Loads a program into memory. If the SiB is not in STOPPED or PAUSED mode, the program will start immediately!
To create a new program, start an IM with PROG progName, and then enter the program's instructions on the following lines in the same IM.
In SiB mode, you must name your program according to a click sequence, where S = a short click, and L = a long click. If you want a program in SiB mode that runs for any click sequence that doesn't have a program, use PROG ANY.
For example, to create a program that executes after two short clicks, enter the following:
PROG SS
[code...]
In SID mode, you can give any name to your program other than those keywords 'LIST','DEL','PRINT','LOAD', for example:
PROG daily reminder
[code...]
When a program is created, if the SiB is not in 'STOPPED' or 'PAUSED' mode, the program executes immediately.
PROG s IM SiB Pressed!
FN,RUN,STOP,PAUSE,RESUME
PWM gpio cycle duration(ms)
This function generates a pulse-width modulation output on the specified GPIO, for the specified amount of time.
The GPIO, cycle and duration can be represented by variables.
The cycle parameter is a scale from 0 to 1024, where 0 is fully LOW, and 1024 is fully HIGH.
The duration parameter is the duration in milliseconds the PWM must be output, for a maximum of 10 seconds.
During the PWM operation, no other commands or functions will execute, including STOP.
To run PWM on a GPIO in the background, use the command WA instead.
PWM 4 900
WA,WD
RA pin variable
Reads an analog value from a GPIO into the specified variable.
This function is only available on some specific GPIOs. Entering a wrong GPIO will result in an error.
This function returns a value representing millivolts (mv).
RA 4 myVal IM The voltage on GPIO 4 is myVAl
WD,WA,HOLD,RD,FL,RAX
RAX pin variable
Reads a raw voltage value in millivolts from a GPIO into the specified variable.
This function reads an uncalibrated (raw) voltage reading from an ADC-enabled GPIO. This function will return a maximum of approximately 3060, for 3V.
The difference between RA and RAX is that RAX reads an uncalibrated value and the SiB performs no error correction on the result.
RA 4 myVal IM The voltage on GPIO 4 is myVAl
WD,WA,HOLD,RD,FL,RA
RC pin variable
Reads a capactive touch GPIO into the given variable.
This function is only available on some specific pin. Entering an invalid pin will result in an error.
This function reads a value between 0 and 4095 and stores it in the speficied variable. A floating GPIO will return a high value, while a GPIO under capacitance will read a lower value.
It is recommended that you perform a floating read of a GPIO before using it in a program, to understand the output.
RC 4 myVal IF myVal<200 IM Water detected! EI
WAKEC
RD pin variable
Reads a digital value from a GPIO into the given variable. This function returns either 0 for low, and 1 for high. The value is stored in the specified variable. This function is available with an internal pull-up or pull-down using RDH and RDL.
RD 18 myVal IF myVal=1 IM High Detected! EI
RDH,RDL,RA,WD,WA
RDH pin variable
Reads a digital value from a GPIO into the given variable. This function returns either 0 for low, and 1 for high. The value is stored in the specified variable. This function applies a pull-up to the input GPIO so that a floating value is read as HIGH.
RDH 18 myVal IF myVal=1 IM High Detected! EI
RD,RDL,RA,WD,WA
RDL pin variable
Reads a digital value from a GPIO into the given variable. This function returns either 0 for low, and 1 for high. The value is stored in the specified variable. This function applies a pull-down to the input GPIO so that a floating value is read as LOW.
RDL 18 myVal IF myVal=1 IM High Detected! EI
RD,RDL,RA,WD,WA
RESET
This function reboots the SiB. If a program is running, your program will resume after restarting. If your program includes a PREW, your SiB will restart in PREW mode regardless of where in the program it is running! RESET also clears all GPIOs that are not in HOLD.
RESET
HALT
RESUME
This function resumes a paused program. If a program is paused during a DL (delay), the delay will complete before the PAUSE takes effect. If a program is STOPPED, resume will run the program from the beginning.
RUN myProg PAUSE RESUME
PAUSE,STOP,RUN
RUN programName
Resets the currently running program, loads and runs the named program.
RUN myProg
PAUSE,RESUME,STOP
RUNFN name [parameters...]
Runs a function created using the FN command. Your function can include up to 10 variables. Use <0> to <9> anywhere inside your function to represent parameters.
You can run a function without the RUNFN command; simply use your function name.
FN myFunc IM Hello <0>! : with runfn RUNFN myFunc world : without runfn myFunc World
FN
RV [variable]
This function reads the voltage level of the SiB's battery if on Battery power, or otherwise, the voltage level of the SiB's external power source (attached to GPIO 35).
This function requires calibration. Your SiB is already calibrated by the manufacturer, but you can use the command CALIB RV to recalibrate if necessary.
If a variable is given, the result in millivolts will be stored. Otherwise, an IM will be sent.
RV myVar
CALIB
SET variable=equation
This function assigns a value or executes a mathematical equation and stores the result into a variable.
INIT a=10 SET b=a*20 IM my result is b
INIT
SHIFT variable L|R bitnum
This function performs a bit-shift operation on the specified variable. The value will be shifted left (L) or right (R) by the specified number of bits.
SET a=4 SHIFT a L 1 IM a equals 8 SHIFT a R 2 IM a equals 2
MASK,SET,INIT
SL[+] time|button
When issuing this command, the SiB™ will go into a deep sleep state. It will sleep for the specified amount of time. The button will not respond to button presses during this time.
If 'button' is supplied rather than a time, the SiB™ will go to sleep until a button press is detected.
The time parameter is in milliseconds, however the following suffixes are permitted: s = seconds, m = minutes, h = hours.
The SL command can be enhanced using the + symbol, where the time to sleep will be calculated using the result for CALIB TIME.
SL 1h
DL,UDL,SLB
SLB time
When issuing this command, the SiB™ will go into a deep sleep state. It will sleep for the specified amount of time. However, a button press can wake up the SiB before the end of the sleep period.
The time parameter is in milliseconds, however the following suffixes are permitted: s = seconds, m = minutes, h = hours.
SLB 1h
DL,UDL,SL
SM message...
Sends a silent IM to SiMP. SiMP will not display a notification nor play a tone, but will show a new item in the chat. Variable names included in your message will automatically be replaced.
SM This is a silent message.
IM,HM,ALERT,SMTO,IMTO
SMSTO recipient message
This command uses SiMP's mobile network to send an SMS to the specified recipient. NOTE that the SMS feature is only available for users who have installed our direct-download app (APK) on Android, and not avaialble to any users who have installed SiMP via the Google Play Sotre nor the iOS App store. Both of these stores have strict restrictions on apps that sends out SMS.
Since this function relies on the SiMP device that originally paired the SiB, the mobile must be powered on and online to receive and send the SMS.
The recipient number must be written in International format including the country code, but without characters such as -,( and ). Variable names included in your message will automatically be replaced.
SMSTO 12345556789 This is an SMS!
IM,HM,ALERT,SM,IMTO
SMTO chat_name|recipient_list message
Sends a silent IM to one or multiple recipients. SiMP will not display a notification nor play a tone, but will show a new item in the chat. Multiple recipients can be included, using a comma as a separator. Recipient numbers must be written in International format including the country code, but without characters such as -,( and ). Variable names included in your message will automatically be replaced. If you want to create a chat with a specific name/subject line, use the NEWCHAT command, and then include the chat's name as the first parameter.
SMTO 12345556789,61401234567 This is a silent message.
IM,HM,ALERT,SM,IMTO
STATE [gpio]
This command outputs the output state of a specified GPIO. If no GPIO is specified, this command outputs the output state of all GPIOs.
For digital outputs (WD), sends 0 or 1; for PWM outputs, sends the cycle in a scale from 0 to 1024. If a GPIO is not used or floating, sends 'Floating'.
Currently, STATE does not show the HOLD state of any GPIO.
STATE 4
WD,WA,HOLD,FL
STATUS [extend]
This function sends a short status report for your SiB, including the current time, connected access point, and program state.
For more details, STATUS EXTEND can be used to get a full report, including the line number of the current running program.
STATUS EXTEND
STEP INIT 1|2|3|4 GPIO_count IO1 [IO2] [IO3] [IO4] [IO5] STEP COUNT 1|2|3|4 +|- steps speed [STOPRD gpio 0|1] STEP UNTIL 1|2|3|4 +|- time(ms) speed [STOPRD gpio 0|1]
This function can control an attached stepper.
The SiB can run up to four steppers. You must initialize each stepper, giving them each a unique number between 1 and 4 as the first parameter to STEP INIT
The third second parameter in STEP INIT is the number of GPIOs used by your stepper: 1, 2, 4 or 5. The remaining parameters are the stepper IOs in order.
Once a stepper is initialized (you must only initialize it once), you can use STEP COUNT to move the stepper, or STEP UNTIL to move the stepper until a read condition is met.
In STEP COUNT, the stepper will perform the specified number of steps.
In STEP UNTIL, the stepper will perform steps for the specified time in milliseconds, or -1 to keep going.
An external GPIO (added using STOPRD gpio 0|1) can be read as an additional stop condition.
The speed is given in steps per minute.
The direction is indicated by a + or -.
PROG stepper STEP INIT 1 1 4 start: : take 20 steps forward at 100 steps per minute STEP COUNT 1 + 20 100 : take steps backwards for 1 second at 200 steps per minute, or until 2 is read HIGH STEP UNTIL 1 - 1000 200 STOPRD 2 1 LOOP start:
WD,FREQ,PWMfs
STOP
This function will stop the execution of any program or function, and exits any current DELAY (DL). It also clears any queued commands/IMs sent to your SiB that have not yet been executed, and resets all GPIOs to their default state. It also clears any BUTTON listeners, and all stored variables. It does not, however, stop any Bluetooth listeners.
STOP
RUN,PAUSE,RESUME
TEMP [variable] [c|f]
This function reads the temperature. If no parameters are specified, the function will respond with the current temperature in an IM. If a variable name is specified, the temperature will be stored in the variable and no IM will be sent. You can also specify a scale, either F for Farhenheit, or C for Celsius.
The default scale is automatically set to C or F during SiB pairing based on your region. You can change the scale using the CONF TEMP command.
This sensor requires calibration. Your SiB was calibrated by the manufacturer. However, you can re-calibrate the temperature sensor using the CALIB TEMP command.
TEMP myVal IM IT is myVal degrees here!
CALIB,CONF
TILE message...
This function updates the SiB Tile text in SiMP. Variable names included in your message will automatically be replaced.
In addition, the Tile supports basic HTML formatting!
All messaging functions also include multiple pre-set variables such as the date and time, see HELP VARIABLES for further information.
TILE Window was opened at $t on $d
IM,HM,ALERT,SM
TZ zoneName
This command sets your timezone, which will be applied the next time you restart your SiB.
While some abbreviations are supported, we strongly recommend you use the timezone names provided here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
TZ America/Los_Angeles
WAKEAT
UDL time
This function pauses your program for the given number of microseconds. The time parameter here is accepted only in microseconds. Once UDL starts, there is no way to stop the delay. UDL can be used for a maximum of 10 seconds (10000000 microseconds). Use DL for longer delays.
UDL 100
DL,SL
UNTIL RDH|RDL|RCH|RCL GPIO Threshold [TO timeval] [STATUSTO variable] [TIMETO variable]
This function pauses your program and waits for a GPIO to reach a specified target. During this time, your SiB is powered on but idling. This command is ideal for brief periods of inactivity; for longer wait times, WAKECAP or WAKEIO should be used instead.
The first parameter must be one of RDH, RDL, RCH, or RCL. RDH and RDL are digital inputs with either a pull-up (H) or a pull-down (L); RCH and RCL are capacitive touch reads targeting a threshold higher (H) than, or lower (L) than the specified target.
Only specific GPIO's can read capacitance.
You can specify a timeout using the TO keyword (example: TO 1h)
You can also receive the result of the UNTIL command in variables; STATUSTO will store the last read value into the specified variable, while TIMETO will store the time it took for UNTIL to reach the target value, in milliseconds.
UNTIL RDL 35 1 TO 1h TIMETO waited STATUSTO result IM I woke up after waited milliseconds with the GPIO at result
WAKECAP,WAKEIO
UPDATE [version] [force]
Updates the SiB™ to the specified firmware version. If no version is specified, updates to the latest firmware.
If you already have the latest version, or you cannot upgrade directly to the latest version, UPDATE will respond accordingly.
To downgrade to an earlier firmware version, you must use the FORCE paramter.
UPDATE UPDATE 785 FORCE
WA pin|red|green|blue 0-1024
This function outputs pulse-width modulation (PWM) to a specified PIN. Both the GPIO # and the value can be represented by variables. In the output scale, 0 represents completely off (100% LOW), and 1024 represents always on (100% HIGH).
WA red 300
WD,RD,RA,HOLD,FL,FREQ
WAKEAT hh:mm [hh:mm] [hh:mm] ...
The WAKEAT function puts the SiB™ to sleep until the specified time. This command can only be used in SiD mode. The SiB will sleep until the specified time is reached, or until the button is pressed.
Multiple times can be specified in a single command to create a repeating reminder:
WAKEAT 6:00 12:00 18:00
The time given must be in 24-hour format. Use the TZ command to set your timezone before using this command.
PROG reminder WAKEAT 8:30 IM Time to go to work! WAKEAT 17:30 IM Welcome home! LOOP
SL,SLB,TZ
WAKECAP gpio threshold [interval]
This command will put the SiB™ to sleep and monitor a capacitive touch GPIO. A floating GPIO will read a high value; while a GPIO sensing some capacitance will read lower values. This command will wake your SiB™ when a capacitive touch GPIO reads a value below the requested threshold.
An interval can be specified in milliseconds to specify the time in between measurements. The default interval is 2500ms (or 2.5 seconds). A shorter interval will result in a shorter battery life, while a larger interval will mean some delay between contact and the SiB reacting.
Use the RC command to test your GPIO while floating, and while in contact, to determine the ideal threshold to use.
WAKECAP 4 100 IM Detected touch! WAKECAP 4 0 IM Detected water!
WAKEIO,WAKEHALL,WAKESSID
WAKEHALL time [target] [direction]
This command puts the SiB in a deep sleep until a magnet is removed, or is added near the SiB.
While in deep sleep, the SiB will periodically measure the HALL sensor output to see if a magnet is present or not.
The first parameter time can be specified in milliseconds (100ms) or seconds (2s).
By default, WAKEHALL will wake up if a magnet is removed.
A target threshold can be added as a second parameter if the default value is insufficient.
To use this, send the HALL command to the SiB with the magnet present, and then with the magnet absent, to see what values are read. The SiB will wake if the HALL sensor measures a value LESS THAN the specified target.
For example, if your HALL command reads higher than 20 when the magnet is present, then WAKEHALL 1s 20 will be sufficient to wake the SiB when the magnet is removed.
The third parameter allows you to invert the command, so that the SiB wakes when a magnet is present rather than absent. In this case, the SiB will wake if the HALL sensor reads anything HIGHER THAN the target specified.
Use a value of 0 for direction to detect when a magnet is removed, or 1 to detect when a magnet is present.
The HALL sensor requires calibration. Your SiB was calibrated by the manufacturer, however, it may sometimes be necessary to recalibrate. See HELP CALIB for further information.
PROG door WAKEHALL 1s 10 0 IM Door is open! WAKEHALL 1s 20 1 IM Door is closed! LOOP
WAKESSID,WAKECAP,WAKEIO
WAKEIO gpio 1|0 [timeout]
Goes to sleep until a specific GPIO event is triggered.
This command will put the SiB™ to sleep until the specified GPIO reads the target level HIGH (1) or LOW (0).
When specifying a HIGH value, the sleep can also be interrupted by button press. When specifying a LOW value, the sleep will not be interrupted by button press.
The timeout value is optional. Specify a timeout (i.e., 20s, 10ms, 1h) to have the sleep end without the GPIO level being reached.
The IF buttonwake command can be used to determine if the SiB woke due to the timer or due to the button.
WAKEIO 35 1 1h IF buttonwake IM Pressed button ELSE IM Slept for 1 hour EI
WAKESSID,WAKECAP,WAKEHALL
WAKE [-]ssid time [absentSSID]
This function will go to deep sleep and sleep for the specified time. The SiB™ will then wake and scan for nearby Access Points. If the specified access point is found, the SiB will wake up and your program will continue running; otherwise, the SiB will go back to sleep and continue this scan.
This function can also do the reverse: wake up when an SSID is no longer visible. In that case, simply prepend your SSID with a -
The time is specified in milliseconds, however the following suffixes are permitted: s = seconds, m = minutes, h = hours
You can override this function at any time with a long press of the SiB. The long press duration can be configured using CONF SSIDPRESS.
A third parameter: absentSSID, allows you to specify a second SSID that should be considered the opposite state. The benefit of this parameter is that it allows the SiB to skip the long SSID scan, saving several seconds of battery use per cycle.
WAKESSID myAccessPoint 1s IM Access Point present! WAKESSID -myAccessPoint 1s IM Access Point no longer present!
CONF,AP
WD STATUS|STATE|pin|red|green|blue 0|1|variable
Outputs High (1) or Low (0) to the specified GPIO. Both the GPIO # and the value can be represented by variables.
WD STATUS and WD STATE will list the output status of all GPIOs.
WD GREEN 1
RD, WA, FL, HOLD
The Yes or No program demonstrates the ability to run multiple programs depending on the number of button presses to your SiB. In this specific setup, your SiB will simply send an IM saying "YES" when powered on with a single click, and "NO" when powered on with a double-click. Of course, you can modify these to be any sequence you want, such as a single click and a long click, or two clicks and three clicks, and so on...
PROG S
IMTO 12345551234 Yes!
HALT
PROG SS
IMTO 12345551234 No!
HALT
TO SUBMIT THIS PROGRAM:
You must send each program as a separate IM to your SiB. Then, press your SiB to receive BOTH programs at the same time. That's all!