Open this page at https://adumont.github.io/pxt-ADTools/
Use as Extension
This repository can be added as an extension in MakeCode.
- open https://makecode.microbit.org/
- click on New Project
- click on Extensions under the gearwheel menu
- search for https://github.com/adumont/pxt-ADTools and import
Edit this project
To edit this repository in MakeCode.
- open https://makecode.microbit.org/
- click on Import then click on Import URL
- paste https://github.com/adumont/pxt-ADTools and click import
Usage
packNums
Say we have some sensors readings, and we want to send sensors via Radio. ADTools.packNums() lets us pack them all into a string we can send in a single message, like this:
let sensors = [0.2, 251, 0.01, 895]
// @highlight
let send = ADTools.packNums(sensors, Delimiters.Pipe)
unpackNums
On the receiving end, say we received the packed string via Radio, we can unpack a string into an array of numbers using ADTools.unpackNums(), like this:
// @highlight
let received = ADTools.unpackNums(send, Delimiters.Pipe)
logString
Logs a string to the console (for debugging purpose).
ADTools.logString("Hello world")
logNumber
Logs a number to the console (for debugging purpose).
ADTools.logNumber(25)
Full Example
This image shows the blocks code from the last commit in master. (This image may take a few minutes to refresh).
Metadata (used for search, rendering)
- for PXT/microbit