Programming the SIB™
SiB™ vs SID mode
Programs in SiB™ mode
Programs in SID mode
- Door Bell
- Emergency Button
- Freezer Monitor
- I Love You
- Lights Demo
- Magnetic Alarm
- Motion Sensor
- Sweet Dreams
- Water/Moisture Sensor
- Yes or No
A - Z
This command enables or disables debug messaging.
DEBUG Usage: DEBUG on|off This command enables or disables debug messaging. When enabled, you will receive extra information via IM about operations on your SiB™. Disabled by default.
This statement breaks a FOR loop.
EN Usage: EN This statement breaks a FOR loop. Use this statement to exit a FOR loop before the loop reaches it's exit condition. See FOR for more information.
This command allows you to create and manage functions.
FN Usage: FN name|function [parameters...] This command allows you to create and manage functions. Functions are blocks of code that can be called inside of a program. The following commands are possible: FN LIST FN PRINT FN DEL To learn more, enter HELP FN function To create a new function, enter FN followed by the function name, and, on new lines, the code for the function, in a single IM. For example: FN myFunction [code] will create a new function called myFunction and that function will contain the code [code].
This command lists all currently configured functions.
FN LIST Usage: FN LIST This command lists all currently configured functions.
This command outputs the program code stored for the given function.
FN PRINT Usage: FN PRINT function_name This command outputs the program code stored for the given function.
This function deletes the specified function.
FN DEL Usage: FN DEL function_name This function deletes the specified function. FN DEL * will delete all stored functions. Neither of these commands provide a confirmation prompt prior to deletion; functions are immediately deleted and the operation cannot be undone.
Creates a loop with a counter and incrementer.
FOR Usage: FOR var start end increment ... NEXT Creates a loop with a counter and incrementer. This function creates a FOR loop, allowing you to repeat a step multiple times or increment a variable. Example: FOR myVar 1000 0 -100 IM Step myVar RD button 35 IF button=1 EN EI NEXT The above program will loop and run the block with a value of 1000, then 900, then 800, up 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). See also: NEXT, EN
Shuts down a SID as though it had reached the end of a SiB™ (button-mode) program.
HALT Usage: HALT Shuts down a SID as though it had reached the end of a SiB™ (button-mode) program. See also: RESET
This function executes code conditionally, depending on a given variable's value.
IF Usage: IF variable =|>|>=|<|<=|!= value [code] ELSE [code] EI This function executes code conditionally, depending on a given variable's value. A variable can be any string used in functions that output to variables; for example: TEMP temp_var IF temp_var > 30 IM The temperature is over 30, it's temp_var C EI The above code reads the current temperature value, stores it in a variable named temp_var and executes the code only if temp_var is greater than 30.
This function initializes a variable to the given value if the variable does not already exists.
INIT Usage: 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. See also: SET
This function should only be used in a PROG or FUNCTION block.
LOOP Usage: LOOP This function should only be used in a PROG or FUNCTION block. 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.
This statement marks the end of a FOR loop.
NEXT Usage: NEXT This statement marks the end of a FOR loop. See FOR for more information.
This function disables the state saving of the SiB.
NOSAVE Usage: NOSAVE This function disables the state saving of the SiB. This function stops any future save operations on the SiB until the next power cycle (SL or HALT). There are many reasons this function might be used. The SiB saves it's 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.
Enables and disables polling for new commands.
NOTIFS Usage: NOTIFS ON|OFF Enables and disables polling for new commands. This function enables or disables the polling for commands via IM. This function should only be used in a program. The state of NOTIFS is not preserved after a power reset. This function allows you to disable remote polling when performing time-critical operations such as IO reads and writes. This function garantees that the SiB™ will not perform any other task during the execution of the code while NOTIFS is OFF. This function should be used safely: NOTIFS OFF [code...] NOTIFS ON
Pauses the execution of the current running program or function.
PAUSE Usage: 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. See also: STOP, RUN, RESUME
Example: PRE temp mytemp
PRE Usage: PRE command Example: PRE temp mytemp This will execute a command on the next SiB™ reset, while the WIFI is connecting. It is useful to queue commands to run while the SiB™ is still cool. See also: PREW, POST
This will execute a command on the next SiB™ reset, prior to WIFI starting. This is useful when accessing GPIO's on the ADC2.
PREW Usage: PREW [command] This will execute a command on the next SiB™ reset, prior to WIFI starting. This is useful when accessing GPIO's on the ADC2. It is also useful to execute entire programs without starting the WiFi component, preserving battery. PREW can be used to queue a single [command] at the next startup, or it can be used to 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. In a PREW program, the command POST can be used to start WiFi. Example: PROG myprog PREW TEMP mytemp IF mytemp<0 POST IM The temperature is below freezing EI SL 1m LOOP This program will measure the temperature but keep WiFi off and power use at a minimum until the temperature reaches below 0 Celcius. At that point, the POST command initiates WiFi. See also: PRE, POST
Instructs the SiB™ to connect to WiFi when used in a PREW program. See PREW for more details.
POST Usage: POST Instructs the SiB™ to connect to WiFi when used in a PREW program. See PREW for more details. See also: PRE, PREW
This function allows you to create or manage programs.
PROG Usage: PROG name|function [parameters] This function allows you to create or manage programs. To manage programs, you can execute the following: PROG LIST PROG DEL PROG PRINT PROG LOAD To learn more, enter HELP PROG function. To create a new program in SiB™ mode, you must name your program according to a click sequence, where S = a short click, and L = a long click. 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.
Lists all stored programs.
PROG LIST Usage: PROG LIST Lists all stored programs.
Deletes the specified program by name, or all programs if an asterisk * is specified. This function provides no warning or confirmation
PROG DEL Usage: PROG DEL name|* Deletes the specified program by name, or all programs if an asterisk * is specified. This function provides no warning or confirmation prompt and immediately deletes the specified program(s), with no option to undo. Use this function with care!
Outputs the program code for the named program, or, if no program is specified, for the current running program.
PROG PRINT Usage: PROG PRINT [name] Outputs the program code for the named program, or, if no program is specified, for the current running program.
Loads the program specified.
PROG LOAD Usage: PROG LOAD name Loads the program specified. If the SiB™ is not in STOPPED or PAUSED mode, the program will execute immediately.
This function resets the SiB™.
RESET Usage: RESET This function resets the SiB™. See also: HALT
This function resumes a paused program.
RESUME Usage: RESUME This function resumes a paused program. See also: PAUSE, STOP, RUN
Runs a program.
RUN Usage: RUN [name] Runs a program. If [name] is specified, loads and runs the named program. Otherwise, this will run the current program in-memory. If a program is in-memory and is in PAUSED mode, the program will be reset before running. See also: PAUSE, RESUME, STOP
Runs a program in exclusive mode.
RUNEX Usage: RUNEX [name] Runs a program in exclusive mode. If [name] is specified, loads and runs the named program. This function operates exactly as the RUN function, but runs any program in Exclusive mode. In Exclusive mode, commands issued via IM will be stored and will execute only when the program finishes. A STOP command can exit exclusive mode.
Runs a function.
RUNFN Usage: RUNFN name Runs a function. Runs the named function. See also: FN
Allows the execution of mathematical equations in running programs.
SET Usage: SET variable=equation Allows the execution of mathematical equations in running programs. Example: INIT a=10 SET b=a*20 IM a b This program will send an IM containing the message: 10 200 See also: INIT
Echos back to SiMP™ the current status of the SiB™.
STATUS Usage: STATUS [extend] Echos back to SiMP™ the current status of the SiB™. Specify EXTEND to receive more information.
Stops the running function, program or sleep.
STOP Usage: STOP Stops the running function, program or sleep. This function will stop the execution of any program or function. It also exits from exclusive mode, and clears any queued items that were received but not executed. See also: RUN, PAUSE, RESUME
Remains in deep sleep with short WiFi scans and wakes if a specific SSID is found.
WAKE Usage: WAKE ssid time Remains in deep sleep with short WiFi scans and wakes if a specific SSID is found. 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 SSID is seen, the SiB™ will wake and the program code will continue to execute. If the specified SSID is not seen, the SiB™ will go back to sleep for the given time, and try again. The time is specified in milliseconds, however the following suffixes are permitted: s = seconds, m = minutes, h = hours Waking the SiB™ via button press overrides the WAKE command.