pxt-hacking-stem/README.md

1.4 KiB

Hacking STEM Build Status

Support for Hacking STEM activities in https://makecode.microbit.org

Usage

Go to https://makecode.microbit.org, click on the gearwheel menu and select Add Package, search for hacking stem and select this package.

Reference

serial.writeMilliNumber #serialWriteMilliNumber

The ||serial:write milli number|| block scales the input value by 1000 and writes it to the serial as a floating point number.

serial.writeMilliNumber(1);

For example,

serial.writeMilliNumber(1);

writes the following number to serial

0.001

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) * 3300 / 1023
    serial.writeMilliNumber(mv)
})

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.