Data Streamer support in MakeCode for micro:bit
Перейти к файлу
Abhijith Chatra d934644de9 0.0.17 2018-10-19 09:09:45 -07:00
.vscode init 2018-05-22 22:24:30 -07:00
.gitignore init 2018-05-22 22:24:30 -07:00
.travis.yml setting baud rate (#1) 2018-06-07 13:35:20 -07:00
LICENSE Updating the right name 2018-10-19 07:53:47 -07:00
Makefile init 2018-05-22 22:24:30 -07:00
README.md More readme updates 2018-10-18 18:56:54 -07:00
enums.d.ts setting baud rate (#1) 2018-06-07 13:35:20 -07:00
extension.cpp Add format to the print 2018-10-18 17:15:10 -07:00
extension.ts Bump the category right next to radio 2018-10-19 09:09:44 -07:00
icon.png adding icon 2018-05-23 07:38:11 -07:00
pxt.json 0.0.17 2018-10-19 09:09:45 -07:00
shims.d.ts Add format to the print 2018-10-18 17:15:10 -07:00
test.ts Shortening the block name for write array 2018-10-18 18:15:51 -07:00
tsconfig.json init 2018-05-22 22:24:30 -07:00

README.md

Hacking STEM Build Status

Support for Hacking STEM activities in micro:bit. For Hacking Stem activities you will need excel add-on Data Streamer as well. To download Data Streamer click here

Usage

Go to https://makecode.microbit.org, click on the gearwheel menu and select Extensions, search for hacking stem and select this extension. Once you load the extension you should see a new category named DataStreamer.

Reference

dataStreamer.writeNumber

The ||dataStreamer.writeNumber|| block writes a number to the serial port as a floating point number.

dataStreamer.writeNumber(1.52, 2);

Parameters

  • value is the floating point number to write to the serial port
  • decimal digits is the number of decimal digits to write. Default is 2.

Example 1

For example,

dataStreamer.writeNumber(1.52);

writes the following number to serial 1.52

Example 2

This example reads the analog signal on pin P0, scales it to 3.3v and writes it to serial.

let mv = 0
basic.forever(() => {
    mv = pins.analogReadPin(AnalogPin.P0) * 3.3 / 1023
    dataStreamer.writeNumber(mv)
})

dataStreamer.writeString

The ||dataStreamer.writeString|| block writes a string to the serial port, without starting a new line afterward.

dataStreamer.writeString(",");

Parameters

  • text is the string to write to the serial port

Example: simple serial

This program writes a comma , seperated 10.25 to the serial port repeatedly, without any new lines.

basic.forever(() => {
    dataStreamer.writeNumber(10.25);
    dataStreamer.writeString(",");
});

License

MIT

Supported targets

  • for PXT/microbit (The metadata above is needed for package search.)

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.