Approved content
The content below is provided by a partner.
This is the Micro:bit extension for Wappsto:bit by Seluxit. Wappsto:bit is a module that lets you connect your microbit to the Internet in an easy and intuitive way. Drag in the blocks in makecode and data is available on wappsto.com in a dashboard right away. The Wappsto mobile App allows for both viewing data and controlling your micro:bit from the Internet.
Wappsto:bit comes in 3 configurations:
// Configure adv settings
wappsto.configureWifi("ssid", "passsword");
wappsto.configureApn("new apn");
// Clean old data model
wappsto.sendCleanToWappsto();
// Configure Data model
wappsto.configureName("MyBit");
wappsto.configureValue(1, "Light Value", WappstoValueTemplate.Light);
wappsto.configureNumberValue(2, "Test Value", "Test", 0, 100, 1, "none");
wappsto.configureStringValue(15, "Test String Value", "Test");
// Register event handlers
wappsto.onNumberEvent(2, (num) => {
basic.showNumber(num);
});
wappsto.onStringEvent(15, (str) => {
basic.showString(str);
});
basic.showIcon(IconNames.No);
// Wait for connecting
while(!wappsto.connected()) {
basic.pause(100);
}
basic.showIcon(IconNames.Yes);
basic.pause(1000);
// Send updates to Wappsto
wappsto.sendNumberToWappsto(1, input.lightLevel(), WappstoTransmit.OnChange);
wappsto.sendStringToWappsto("Hello From Wappsto:Bit", 15, WappstoTransmit.ASAP);
// Read data from Wappsto:bit
basic.showString("GPS");
let lon = wappsto.longitude();
let lat = wappsto.latitude();
if (isNaN(lat) || isNaN(lon)) {
basic.showString("NO");
} else {
basic.showNumber(lon);
basic.showNumber(lat);
}
basic.clearScreen();
basic.pause(1000);
if(wappsto.signalQuality() > 30) {
basic.showString("Good signal");
} else {
basic.showString("Bad signal");
}
basic.pause(3000);
basic.showString(wappsto.carrier());
basic.pause(3000);
basic.showNumber(wappsto.time());
basic.pause(1000);
basic.showNumber(wappsto.uptime());
Configure the name of your Micro:bit on Wappsto.
wappsto.configureName("name")
Configure a Wappsto value.
wappsto.configureValue(1, "value name", WappstoValueTemplate.Temperature)
Configure Wappsto number value.
wappsto.configureNumberValue(1, "value name", "type", 0, 1, 1, "unit")
Configure Wappsto string value.
wappsto.configureStringValue(1, "value name", "type")
Send the state of a number value to Wappsto.
wappsto.sendNumberToWappsto(1, 1, WappstoTransmit.OnChange)
Send the state of a string value to Wappsto.
wappsto.sendStringToWappsto("value", 15, WappstoTransmit.OnChange)
Event handler for Wappsto number events.
wappsto.onNumberEvent(1, (num) => {
basic.showNumber(num)
});
Event handler for Wappsto string events.
wappsto.onStringEvent(1, (str) => {
basic.showString(str)
});
Send a clean command to Wappsto.
wappsto.sendCleanToWappsto()
Input block returning the longitude of the Wappsto:bit. NaN if not available.
wappsto.longitude()
Input block returning the latitude of the Wappsto:bit. NaN if not available.
wappsto.latitude()
Input block returning the signal quality of the network link [0-100%].
wappsto.signalQuality()
Input block returning the network name of which the Wappsto:bit is connected to.
wappsto.carrier()
Input block returning the Wappsto:bit UTC time in seconds.
wappsto.time()
Input block returning the Wappsto:bit uptime. I.e. time in seconds since last power cycle.
wappsto.uptime()
Conditional block returning a boolean flag to signal whether or not Wappsto:bit is fully connected and ready.
wappsto.connected()
Configure the SSID to which the Wappsto:bit connects when on Wi-Fi network.
wappsto.configureWifi("ssid", "password")
Configure the APN to which the Wappsto:bit connects when on cellular network.
wappsto.configureApn("apn")
MIT
(The metadata above is needed for package search.)
wappsto=github:wappsto/pxt-wappsto#v1.2.3