Approved content
The content below is provided by a partner.
A MakeCode extension for Smarthon IoT:bit
Smarthon IoT:bit enables micro:bit to connect Wi-Fi and allows users to record sensor data on cloud platforms like IFTTT and ThingSpeak. Besides, the great feature is supporting WAN control.
The users can connect up to 12 sensors and actuators. Let’s upgrade your micro:bit and ready for the IoT world!
Configurate the connection between IoT:bit and Micro:bit via Serial protocol
Default setting for Connection pins on IoT:bit is P16(TX) and P8(RX)smarthonIoTBit.initializeWifi(SerialPin.P16, SerialPin.P8)
Connect to the specific Wifi Station by SSID and Password
In example,smarthonIoTBit.setWifi("Smarthon", "12345678")
Upload the value data to the specific Thingspeak channel.
Required to input vaild channel API key. Allow sending up to 8 value field at the same time. In example,smarthonIoTBit.sendThingspeak(
"abcdefg",
100,
0
)
Summit a request to IFTTT Webhooks Service.
Required to input vaild API key provided by webhooks. In example,smarthonIoTBit.sendIFTTT(
"abcdefg",
"email",
10
)
The IoT:bit can recevied command via internet
Before control the IoT:bit, you need an ID to identify the IoT:bit on the internet.
basic.showString(smarthonIoTBit.getDeviceID())
You are required to set up the callback function to get the command message when the the command was received.
The WAN_Command variable can be access and use to make decision.
smarthonIoTBit.onWANRemote(function (WAN_Command) {
})
Connect to a specifc channel to prepare for listen other user’s message
smarthonIoTBit.WifiListenChannel("abc")
To listen the message, you are required to set up this callback block to get the variable
smarthonIoTBit.onWifiReceived(function (Channel, receivedMessage) {
})
Sending the message to other user in the specific channel
smarthonIoTBit.WifiSendMessage("abc", "hi")
Get the NTP time from the internet
smarthonIoTBit.getNTP(smarthonIoTBit.CityList.HongKong)
To make use of the time, you are required to set up this callback block to get the variable
smarthonIoTBit.onNTPReceived(function (Year, Month, Day, Hour, Minute, Second) {
})
MIT
(The metadata above is needed for package search.)
smarthon-iotbit=github:SMARTHON/pxt-iot-bit#v0.8.3