Approved content

The content below is provided by a partner.

wappsto/pxt-wappsto 1.2.2 GitHub

Wappsto:bit Build Status

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:

Getting started

Example

// 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());

Reference

configure name

Configure the name of your Micro:bit on Wappsto.

wappsto.configureName("name")

configure value

Configure a Wappsto value.

wappsto.configureValue(1, "value name", WappstoValueTemplate.Temperature)

configure number value

Configure Wappsto number value.

wappsto.configureNumberValue(1, "value name", "type", 0, 1, 1, "unit")

configure string value

Configure Wappsto string value.

wappsto.configureStringValue(1, "value name", "type")

send number to wappsto

Send the state of a number value to Wappsto.

wappsto.sendNumberToWappsto(1, 1, WappstoTransmit.OnChange)

send string to wappsto

Send the state of a string value to Wappsto.

wappsto.sendStringToWappsto("value", 15, WappstoTransmit.OnChange)

on number event

Event handler for Wappsto number events.

wappsto.onNumberEvent(1, (num) => {
    basic.showNumber(num)
});

on string event

Event handler for Wappsto string events.

wappsto.onStringEvent(1, (str) => {
    basic.showString(str)
});

send clean to wappsto

Send a clean command to Wappsto.

wappsto.sendCleanToWappsto()

longitude

Input block returning the longitude of the Wappsto:bit. NaN if not available.

wappsto.longitude()

latitude

Input block returning the latitude of the Wappsto:bit. NaN if not available.

wappsto.latitude()

signal quality

Input block returning the signal quality of the network link [0-100%].

wappsto.signalQuality()

carrier

Input block returning the network name of which the Wappsto:bit is connected to.

wappsto.carrier()

time

Input block returning the Wappsto:bit UTC time in seconds.

wappsto.time()

uptime

Input block returning the Wappsto:bit uptime. I.e. time in seconds since last power cycle.

wappsto.uptime()

connected

Conditional block returning a boolean flag to signal whether or not Wappsto:bit is fully connected and ready.

wappsto.connected()

configure wifi

Configure the SSID to which the Wappsto:bit connects when on Wi-Fi network.

wappsto.configureWifi("ssid", "password")

configure apn

Configure the APN to which the Wappsto:bit connects when on cellular network.

wappsto.configureApn("apn")

License

MIT

Supported targets

(The metadata above is needed for package search.)

wappsto=github:wappsto/pxt-wappsto#v1.2.2