Programming the SiB


The motion sensor app uses a motion sensor accessory. The motion sensor can operate while the SiB is sleeping, and uses one of the SiB's GPIO's to wake the SiB when motion is felt. The sensor is initialized over I2C.

FN startmotion ; define a function to start motion detection
iic off ; disable IIC in case it was already on
wd 4 0 ; power off the sensor to perform a reset
wd 13 0
dl 100 ; allow a 100ms break for the sensor reset
iic on 26 25 200000 1 ; intiialize I2C on GPIO 26 and 25
; at 200000 bits per second
; with software pull-up enabled
hold 13 1 ; power the sensor EVEN when the SiB is sleeping
dl 100ms ; allow the sensor time to power on
wd 4 1 ; enable the sensor
; initialize the sensor
; note the <0> - represents a parameter for sensitivity
; from 00 to FF
iic seq bw18+21+03+pbw18+28+<0>+pbw18+27+02+pbw18+16+07+pbw18+17+00+pbw18+1b+04+pbw18+19+04+p

; the sensor is ready and operating. The SiB will
; go to sleep and wake when GPIO 34 is set to high by the sensor.
wakeio 34 1


; main program
PROG alarm
startmotion 80
imto 12345551234 MOTION DETECTED!
Loop

TO SUBMIT THIS PROGRAM:
First, send MODE SID to your SiB, as this is a SID program. It is not activated by the button press but rather by a sensor
Next, send the funciton (FN) in an IM to your SiB
Next, send the program (PROG) in an IM to your SiB
Finally, press your SiB to receive all instructions.!