Giter Club home page Giter Club logo

pxt-wappsto's Introduction

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:

  • Wappsto:bit Basic (Wifi connectivity)
  • Wappsto:bit NB-IoT (Wifi, 5G NB-IoT connectivity)
  • Wappsto:bit NB-IoT+ (Wifi, 5G NB-IoT connectivity and GPS location)

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

  • for PXT/microbit
  • for PXT/calliopemini

(The metadata above is needed for package search.)

pxt-wappsto's People

Contributors

andreasbomholtz avatar evelinamihailova avatar karstentonnesenseluxit avatar mads-slx avatar tsvetomir-ivanov avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.