This project is for kids
do you need a cookie watcher or a make sure your hidden stash of candy is safe?
well WSS:bit is here for the job!
items you need:
and tape or twisty ties
connect the motion sensor and the sonar board
ok now it is time to code! open makecode microbit make a new project and put in this code
ESP8266_IoT.iotSwitchEvent(ESP8266_IoT.SmartIotSwitchState.off, function () {
watch_mode = false
can_beep = false
})
ESP8266_IoT.iotSwitchEvent(ESP8266_IoT.SmartIotSwitchState.on, function () {
watch_mode = true
can_beep = true
})
let watch_mode = false
let can_beep = false
let beeper_at_pin = 0
let other_items = false // set this to true if you added OLED and beeper
ESP8266_IoT.initWIFI(SerialPin.P8, SerialPin.P12, BaudRate.BaudRate115200)
ESP8266_IoT.connectWifi("your_ssid", "your_pwd") // enter your wifi name and pw
ESP8266_IoT.connectSmartiot("", "") // connecting to smartiot
if (other_items) { //OLED and the beeper
OLED.init(128, 64)
beeper_at_pin = 4
can_beep = true
}
watch_mode = true
basic.forever(function () {
if (watch_mode) {
if (Environment.PIR(DigitalPin.P1)) {
ESP8266_IoT.setSmartIotUploadData(
10
)
basic.showLeds(`
. . # . .
. . # . .
. . # . .
. . . . .
. . # . .
`)
basic.showIcon(IconNames.Angry)
flexFX.playFlexFX(flexFX.builtInFlexFX(flexFX.BuiltInFlexFX.Siren), true)
if (other_items) {
OLED.writeStringNewLine("YOU GET OUT")
if (can_beep) {
pins.digitalWritePin(beeper_at_pin, 1)
} else {
pins.digitalWritePin(beeper_at_pin, 0)
}
}
} else {
basic.showIcon(IconNames.Heart)
basic.showIcon(IconNames.Heart)
basic.showIcon(IconNames.SmallHeart)
basic.showIcon(IconNames.SmallHeart)
}
}
})
plug in micro:bit to computer
now if you use chrome or fire fox or some thing that webusb works on click download and follow what it says
if using safari click download it should go to your downloads drag the hex file in to the MICROBIT drive and there your done!
if you want to add other items like the beeper and oled you can
for oled plug the pins in to the black thing in below the microbit holder
now for the beeper take two female to female wires(one black and one yellow) and connect one end of the yellow wire to the beeper + and connect the other end to the yellow pin on port 4 on the iot:bit now get your black wire connect one end to beeper - and the other end to port 4 black pin and there your done!
and your done go have fun drive people nut keep that candy safe!
This page (Micro:bit wifi security system ) was last updated on July 06, 2026.