Compare commits

...

32 Commits

Author SHA1 Message Date
52e67c6bfc 0.6.43 2016-12-16 15:29:33 -08:00
5a6f23a7d0 Bump pxt-core to 0.6.5 2016-12-16 15:29:26 -08:00
d1b36f2022 0.6.42 2016-12-16 14:57:24 -08:00
284579181b Bump pxt-core to 0.6.4 2016-12-16 14:57:09 -08:00
20fcb05538 0.6.41 2016-12-16 14:40:12 -08:00
e1a2074ef5 Bump pxt-core to 0.6.3 2016-12-16 14:39:58 -08:00
fa3e33dab9 Default product.json for enabling Electron builds (#323) 2016-12-16 12:16:06 -08:00
300a98b858 0.6.40 2016-12-13 21:58:35 -08:00
5986671bcb Bump pxt-core to 0.6.1 2016-12-13 21:58:29 -08:00
efd5c46143 0.6.39 2016-12-14 09:16:58 +11:00
62c1a1da35 Bump pxt-core to 0.5.102 2016-12-14 09:16:57 +11:00
ebbc7c983d 0.6.38 2016-12-13 12:49:06 -08:00
173fc4bf7b Bump pxt-core to 0.5.101 2016-12-13 12:49:04 -08:00
47f1eadd27 0.6.37 2016-12-13 12:33:39 -08:00
8c06277a92 Bump pxt-core to 0.5.100 2016-12-13 12:33:37 -08:00
395f482f11 Merge pull request #322 from Microsoft/pr/monacotoolbox
Pr/monacotoolbox
2016-12-13 12:29:42 -08:00
bbd21a84d6 annotating apis to support toolbox 2016-12-13 12:14:32 -08:00
fcf680e9bd automatically detect/add missing package references in project 2016-12-12 10:42:02 -08:00
8ac848c812 Merge branch 'master' into pr/monacotoolbox 2016-12-12 08:39:45 +11:00
dd591af224 Turning flag for monaco toolbox on 2016-12-11 09:01:08 +13:00
e5a7a81198 Better monaco flyout contrast 2016-12-11 08:52:02 +13:00
7a5228a5d0 Reverting toolbox color 2016-12-11 06:52:08 +13:00
fe5c8e520a monaco draggable block 2016-12-11 06:34:11 +13:00
96d354a8a8 Merge pull request #316 from OwenBrotherwood/patch-1
Correction for max. length of advertised url to 17
2016-12-09 15:13:12 -08:00
02480b1c54 updated master to 0.6.36 2016-12-09 13:51:23 -08:00
4fd321cccf 0.6.36 2016-12-09 13:43:41 -08:00
4641c9456f Bump pxt-core to 0.5.99 2016-12-09 13:43:37 -08:00
3469ad6f8d Added note about protocol encoding. 2016-12-08 12:01:35 -08:00
cfc3eae77c adding monacotoolboxbuttons margin 2016-12-07 17:03:28 -08:00
438b745d32 Merge branch 'master' into pr/monacotoolbox 2016-12-07 17:02:07 -08:00
30211aa006 Correction for max. length of advertised url to 17
https://github.com/google/eddystone/tree/master/eddystone-url#frame-specification states 1-17
When one makes a general google for the max length, some have written 18 and some 17 :(
The difference could lie in the https://github.com/google/eddystone/tree/master/eddystone-url#url-scheme-prefix which adds an extra byte but it's use is to in someway allow for more bytes in the 1-17.
The implementation in the micro:bit Lancaster is unknown as to how the url-scheme-prefix is or is not used: there does not seem to be a scheme for "Just take the 1-17" for the url.

At the moment, "play it safe" and write 17 ?
2016-12-06 20:51:44 +01:00
efca68672a Support for monaco toolbox 2016-12-06 00:34:42 -08:00
19 changed files with 116 additions and 150 deletions

View File

@ -1,2 +0,0 @@
node_modules
projects

View File

@ -1,5 +0,0 @@
# PXT micro:bit Electron app
A very basic wrapper around the web app. To install, copy the contents of this
directory to somewhere outside the main `pxt-microbit` repository. Then run `npm
install && npm start`.

View File

@ -1,15 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>code the micro:bit</title>
</head>
<body>
<webview id="webview" style="position:absolute; left:0; top:0; right:0; bottom:0"/>
<script>
const webview = document.getElementById("webview")
const url = `http://localhost:3232/${window.location.hash}`
webview.src = url
</script>
</body>
</html>

View File

@ -1,39 +0,0 @@
const {app, BrowserWindow, Menu} = require('electron')
const pxt = require('pxt-core')
const path = require('path')
let win
const cliPath = path.join(process.cwd(), "node_modules/pxt-microbit")
function startServerAndCreateWindow() {
pxt.mainCli(cliPath, ["serve", "-no-browser"])
createWindow()
}
function createWindow () {
win = new BrowserWindow({
width: 800,
height: 600,
title: "code the micro:bit"
})
Menu.setApplicationMenu(null)
win.loadURL(`file://${__dirname}/index.html#local_token=${pxt.globalConfig.localToken}`)
win.on('closed', () => {
win = null
})
}
app.on('ready', startServerAndCreateWindow)
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
if (win === null) {
createWindow()
}
})

View File

@ -1,14 +0,0 @@
{
"name" : "code-the-microbit",
"version" : "1.0.0",
"description": "Blocks / Javascript editor",
"author": "Microsoft",
"main" : "main.js",
"scripts": {
"start": "node_modules/.bin/electron ."
},
"devDependencies": {
"electron": "*",
"pxt-microbit": "*"
}
}

View File

@ -1,3 +1,3 @@
{
"appref": "v0.6.13"
"appref": "v0.6.36"
}

View File

@ -23,7 +23,7 @@ bluetooth.advertiseUrl("https://pxt.microbit.org/", 7, true);
### Parameters
* ``url`` - a [string](/reference/types/string) containing the URL to broadcast, at most 18 characters long
* ``url`` - a [string](/reference/types/string) containing the URL to broadcast, at most 17 characters long, excluding the protocol (eg: ``https://``) which gets encoded as 1 byte.
* ``power`` - a [number](/reference/types/number) representing the power level between 0 (short) and 7 (maximum range).
### Example: Broadcast a secret code
@ -38,4 +38,4 @@ bluetooth.advertiseUrl("https://pxt.io?secret=42", 7, true);
```package
bluetooth
```
```

14
electron/product.json Normal file
View File

@ -0,0 +1,14 @@
{
"applicationName": "pxt-microbit-oss",
"dataFolderName": ".pxt-microbit-oss",
"darwinBundleIdentifier": "com.microsoft.pxtoss",
"nameShort": "PXT Microbit - OSS",
"nameLong": "PXT Microbit - OSS",
"targetId": "pxt-microbit",
"win32AppId": "{{92db071a-6f58-4938-8c97-13c873f4da13}",
"win32AppUserModelId": "Microsoft.PXTMicrobitOss",
"win32DirName": "Microsoft PXT-Microbit - OSS",
"win32MutexName": "pxtmicrobitoss",
"win32NameVersion": "Microsoft PXT-Microbit-OSS",
"win32RegValueName": "PXTMicrobitOss"
}

View File

@ -97,26 +97,28 @@
"input.acceleration": "Get the acceleration value in milli-gravitys (when the board is laying flat with the screen up, x=0, y=0 and z=-1024)",
"input.acceleration|param|dimension": "TODO",
"input.buttonIsPressed": "Get the button state (pressed or not) for ``A`` and ``B``.",
"input.buttonIsPressed|param|button": "the button to query the request, eg: Button.A",
"input.calibrate": "Obsolete, compass calibration is automatic.",
"input.compassHeading": "Get the current compass heading in degrees.",
"input.lightLevel": "Reads the light level applied to the LED screen in a range from ``0`` (dark) to ``255`` bright.",
"input.magneticForce": "Get the magnetic force value in ``micro-Teslas`` (``µT``). This function is not supported in the simulator.",
"input.magneticForce|param|dimension": "TODO",
"input.onButtonPressed": "Do something when a button (``A``, ``B`` or both ``A+B``) is pressed",
"input.onButtonPressed|param|body": "TODO",
"input.onButtonPressed|param|button": "TODO",
"input.onButtonPressed|param|body": "code to run when event is raised",
"input.onButtonPressed|param|button": "the button that needs to be pressed",
"input.onGesture": "Do something when when a gesture is done (like shaking the micro:bit).",
"input.onGesture|param|body": "TODO",
"input.onGesture|param|body": "code to run when gesture is raised",
"input.onGesture|param|gesture": "the type of gesture to track, eg: Gesture.Shake",
"input.onLogoDown": "Attaches code to run when the logo is oriented downwards and the board is vertical.",
"input.onLogoDown|param|body": "TODO",
"input.onLogoUp": "Attaches code to run when the logo is oriented upwards and the board is vertical.",
"input.onLogoUp|param|body": "TODO",
"input.onPinPressed": "Do something when a pin is pressed.",
"input.onPinPressed|param|body": "the code to run when the pin is pressed",
"input.onPinPressed|param|name": "the pin that needs to be pressed",
"input.onPinPressed|param|name": "the pin that needs to be pressed, eg: TouchPin.P0",
"input.onPinReleased": "Do something when a pin is released.",
"input.onPinReleased|param|body": "the code to run when the pin is released",
"input.onPinReleased|param|name": "the pin that needs to be released",
"input.onPinReleased|param|name": "the pin that needs to be released, eg: TouchPin.P0",
"input.onScreenDown": "Attaches code to run when the screen is facing down.",
"input.onScreenDown|param|body": "TODO",
"input.onScreenUp": "Attaches code to run when the screen is facing up.",
@ -124,7 +126,7 @@
"input.onShake": "Attaches code to run when the device is shaken.",
"input.onShake|param|body": "TODO",
"input.pinIsPressed": "Get the pin state (pressed or not). Requires to hold the ground to close the circuit.",
"input.pinIsPressed|param|name": "pin used to detect the touch",
"input.pinIsPressed|param|name": "pin used to detect the touch, eg: TouchPin.P0",
"input.rotation": "The pitch or roll of the device, rotation along the ``x-axis`` or ``y-axis``, in degrees.",
"input.rotation|param|kind": "TODO",
"input.runningTime": "Gets the number of milliseconds elapsed since power on.",
@ -166,7 +168,7 @@
"music.changeTempoBy": "Change the tempo by the specified amount",
"music.changeTempoBy|param|bpm": "The change in beats per minute to the tempo, eg: 20",
"music.noteFrequency": "Gets the frequency of a note.",
"music.noteFrequency|param|name": "the note name",
"music.noteFrequency|param|name": "the note name, eg: Note.C",
"music.playTone": "Plays a tone through pin ``P0`` for the given duration.",
"music.playTone|param|frequency": "pitch of the tone to play in Hertz (Hz)",
"music.playTone|param|ms": "tone duration in milliseconds (ms)",
@ -182,21 +184,21 @@
"pins.analogPitch|param|frequency": "frequency to modulate in Hz.",
"pins.analogPitch|param|ms": "duration of the pitch in milli seconds.",
"pins.analogReadPin": "Read the connector value as analog, that is, as a value comprised between 0 and 1023.",
"pins.analogReadPin|param|name": "pin to write to",
"pins.analogReadPin|param|name": "pin to write to, eg: AnalogPin.P0",
"pins.analogSetPeriod": "Configures the Pulse-width modulation (PWM) of the analog output to the given value in **microseconds** or `1/1000` milliseconds.\nIf this pin is not configured as an analog output (using `analog write pin`), the operation has no effect.",
"pins.analogSetPeriod|param|micros": "period in micro seconds. eg:20000",
"pins.analogSetPeriod|param|name": "analog pin to set period to",
"pins.analogSetPeriod|param|name": "analog pin to set period to, eg: AnalogPin.P0",
"pins.analogSetPitchPin": "Sets the pin used when using `analog pitch` or music.",
"pins.analogSetPitchPin|param|name": "pin to modulate pitch from",
"pins.analogWritePin": "Set the connector value as analog. Value must be comprised between 0 and 1023.",
"pins.analogWritePin|param|name": "pin name to write to",
"pins.analogWritePin|param|name": "pin name to write to, eg: AnalogPin.P0",
"pins.analogWritePin|param|value": "value to write to the pin between ``0`` and ``1023``. eg:1023,0",
"pins.createBuffer": "Create a new zero-initialized buffer.",
"pins.createBuffer|param|size": "number of bytes in the buffer",
"pins.digitalReadPin": "Read the specified pin or connector as either 0 or 1",
"pins.digitalReadPin|param|name": "pin to read from",
"pins.digitalReadPin|param|name": "pin to read from, eg: DigitalPin.P0",
"pins.digitalWritePin": "Set a pin or connector value to either 0 or 1.",
"pins.digitalWritePin|param|name": "pin to write to",
"pins.digitalWritePin|param|name": "pin to write to, eg: DigitalPin.P0",
"pins.digitalWritePin|param|value": "value to set on the pin, 1 eg,0",
"pins.i2cReadBuffer": "Read `size` bytes from a 7-bit I2C `address`.",
"pins.i2cReadNumber": "Read one number from 7-bit I2C address.",
@ -209,19 +211,21 @@
"pins.map|param|toLow": "the lower bound of the value's target range",
"pins.map|param|value": "value to map in ranges",
"pins.onPulsed": "Configures this pin to a digital input, and generates events where the timestamp is the duration that this pin was either ``high`` or ``low``.",
"pins.onPulsed|param|name": "digital pin to register to, eg: DigitalPin.P0",
"pins.onPulsed|param|pulse": "the value of the pulse, eg: PulseValue.High",
"pins.pulseDuration": "Gets the duration of the last pulse in micro-seconds. This function should be called from a ``onPulsed`` handler.",
"pins.pulseIn": "Returns the duration of a pulse in microseconds",
"pins.pulseIn|param|name": "the pin which measures the pulse",
"pins.pulseIn|param|value": "the value of the pulse (default high)",
"pins.pulseIn|param|name": "the pin which measures the pulse, eg: DigitalPin.P0",
"pins.pulseIn|param|value": "the value of the pulse, eg: PulseValue.High",
"pins.servoSetPulse": "Configures this IO pin as an analog/pwm output, configures the period to be 20 ms, and sets the pulse width, based on the value it is given **microseconds** or `1/1000` milliseconds.",
"pins.servoSetPulse|param|micros": "pulse duration in micro seconds, eg:1500",
"pins.servoSetPulse|param|name": "pin name",
"pins.servoWritePin": "Writes a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).",
"pins.servoWritePin|param|name": "pin to write to",
"pins.servoWritePin|param|name": "pin to write to, eg: AnalogPin.P0",
"pins.servoWritePin|param|value": "angle or rotation speed, eg:180,90,0",
"pins.setPull": "Configures the pull of this pin.",
"pins.setPull|param|name": "pin to set the pull mode on",
"pins.setPull|param|pull": "one of the mbed pull configurations: PullUp, PullDown, PullNone ",
"pins.setPull|param|name": "pin to set the pull mode on, eg: DigitalPin.P0",
"pins.setPull|param|pull": "one of the mbed pull configurations, eg: PinPullMode.PullUp",
"pins.sizeOf": "Get the size in bytes of specified number format.",
"pins.spiWrite": "Write to the SPI slave and return the response",
"pins.spiWrite|param|value": "Data to be sent to the SPI slave",
@ -232,8 +236,9 @@
"serial.readUntil": "Reads a line of text from the serial port and returns the buffer when the delimiter is met.",
"serial.readUntil|param|delimiter": "text delimiter that separates each text chunk",
"serial.redirect": "Dynamically configuring the serial instance to use pins other than USBTX and USBRX.",
"serial.redirect|param|rx": "the new reception pin",
"serial.redirect|param|tx": "the new transmission pins",
"serial.redirect|param|rate": "the new baud rate. eg: 115200",
"serial.redirect|param|rx": "the new reception pin, eg: SerialPin.P1",
"serial.redirect|param|tx": "the new transmission pins, eg: SerialPin.P0",
"serial.writeLine": "Prints a line of text to the serial",
"serial.writeNumber": "Prints a numeric value to the serial",
"serial.writeString": "Sends a piece of text through Serial connection.",

View File

@ -123,7 +123,7 @@
"input.magneticForce|block": "magnetic force (µT)|%NAME",
"input.onButtonPressed|block": "on button|%NAME|pressed",
"input.onGesture|block": "on |%NAME",
"input.onPinPressed|block": "on pin %NAME|pressed",
"input.onPinPressed|block": "on pin %name|pressed",
"input.onPinReleased|block": "on pin %NAME|released",
"input.pinIsPressed|block": "pin %NAME|is pressed",
"input.rotation|block": "rotation (°)|%NAME",

View File

@ -111,8 +111,8 @@ enum class Gesture {
namespace input {
/**
* Do something when a button (``A``, ``B`` or both ``A+B``) is pressed
* @param button TODO
* @param body TODO
* @param button the button that needs to be pressed
* @param body code to run when event is raised
*/
//% help=input/on-button-pressed weight=85 blockGap=8
//% blockId=device_button_event block="on button|%NAME|pressed" icon="\uf192"
@ -123,7 +123,8 @@ namespace input {
/**
* Do something when when a gesture is done (like shaking the micro:bit).
* @param body TODO
* @param gesture the type of gesture to track, eg: Gesture.Shake
* @param body code to run when gesture is raised
*/
//% help=input/on-gesture weight=84 blockGap=8
//% blockId=device_gesture_event block="on |%NAME" icon="\uf135"
@ -138,11 +139,11 @@ namespace input {
/**
* Do something when a pin is pressed.
* @param name the pin that needs to be pressed
* @param name the pin that needs to be pressed, eg: TouchPin.P0
* @param body the code to run when the pin is pressed
*/
//% help=input/on-pin-pressed weight=83
//% blockId=device_pin_event block="on pin %NAME|pressed" icon="\uf094"
//% blockId=device_pin_event block="on pin %name|pressed" icon="\uf094"
void onPinPressed(TouchPin name, Action body) {
auto pin = getPin((int)name);
if (!pin) return;
@ -154,7 +155,7 @@ namespace input {
/**
* Do something when a pin is released.
* @param name the pin that needs to be released
* @param name the pin that needs to be released, eg: TouchPin.P0
* @param body the code to run when the pin is released
*/
//% help=input/on-pin-released weight=6 blockGap=8
@ -171,6 +172,7 @@ namespace input {
/**
* Get the button state (pressed or not) for ``A`` and ``B``.
* @param button the button to query the request, eg: Button.A
*/
//% help=input/button-is-pressed weight=60
//% block="button|%NAME|is pressed"
@ -189,7 +191,7 @@ namespace input {
/**
* Get the pin state (pressed or not). Requires to hold the ground to close the circuit.
* @param name pin used to detect the touch
* @param name pin used to detect the touch, eg: TouchPin.P0
*/
//% help=input/pin-is-pressed weight=58
//% blockId="device_pin_is_pressed" block="pin %NAME|is pressed" icon="\uf094"

View File

@ -170,7 +170,7 @@ namespace music {
/**
* Gets the frequency of a note.
* @param name the note name
* @param name the note name, eg: Note.C
*/
//% weight=50 help=music/note-frequency
//% blockId=device_note block="%note"

View File

@ -92,7 +92,7 @@ namespace pins {
/**
* Read the specified pin or connector as either 0 or 1
* @param name pin to read from
* @param name pin to read from, eg: DigitalPin.P0
*/
//% help=pins/digital-read-pin weight=30
//% blockId=device_get_digital_pin block="digital read|pin %name" blockGap=8
@ -102,7 +102,7 @@ namespace pins {
/**
* Set a pin or connector value to either 0 or 1.
* @param name pin to write to
* @param name pin to write to, eg: DigitalPin.P0
* @param value value to set on the pin, 1 eg,0
*/
//% help=pins/digital-write-pin weight=29
@ -113,7 +113,7 @@ namespace pins {
/**
* Read the connector value as analog, that is, as a value comprised between 0 and 1023.
* @param name pin to write to
* @param name pin to write to, eg: AnalogPin.P0
*/
//% help=pins/analog-read-pin weight=25
//% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8"
@ -123,7 +123,7 @@ namespace pins {
/**
* Set the connector value as analog. Value must be comprised between 0 and 1023.
* @param name pin name to write to
* @param name pin name to write to, eg: AnalogPin.P0
* @param value value to write to the pin between ``0`` and ``1023``. eg:1023,0
*/
//% help=pins/analog-write-pin weight=24
@ -135,7 +135,7 @@ namespace pins {
/**
* Configures the Pulse-width modulation (PWM) of the analog output to the given value in **microseconds** or `1/1000` milliseconds.
* If this pin is not configured as an analog output (using `analog write pin`), the operation has no effect.
* @param name analog pin to set period to
* @param name analog pin to set period to, eg: AnalogPin.P0
* @param micros period in micro seconds. eg:20000
*/
//% help=pins/analog-set-period weight=23 blockGap=8
@ -146,6 +146,8 @@ namespace pins {
/**
* Configures this pin to a digital input, and generates events where the timestamp is the duration that this pin was either ``high`` or ``low``.
* @param name digital pin to register to, eg: DigitalPin.P0
* @param pulse the value of the pulse, eg: PulseValue.High
*/
//% help=pins/on-pulsed weight=22 blockGap=8 advanced=true
//% blockId=pins_on_pulsed block="on|pin %pin|pulsed %pulse"
@ -169,8 +171,8 @@ namespace pins {
/**
* Returns the duration of a pulse in microseconds
* @param name the pin which measures the pulse
* @param value the value of the pulse (default high)
* @param name the pin which measures the pulse, eg: DigitalPin.P0
* @param value the value of the pulse, eg: PulseValue.High
* @param maximum duration in micro-seconds
*/
//% blockId="pins_pulse_in" block="pulse in (µs)|pin %name|pulsed %value"
@ -198,7 +200,7 @@ namespace pins {
/**
* Writes a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).
* @param name pin to write to
* @param name pin to write to, eg: AnalogPin.P0
* @param value angle or rotation speed, eg:180,90,0
*/
//% help=pins/servo-write-pin weight=20
@ -260,8 +262,8 @@ namespace pins {
/**
* Configures the pull of this pin.
* @param name pin to set the pull mode on
* @param pull one of the mbed pull configurations: PullUp, PullDown, PullNone
* @param name pin to set the pull mode on, eg: DigitalPin.P0
* @param pull one of the mbed pull configurations, eg: PinPullMode.PullUp
*/
//% help=pins/set-pull weight=3 advanced=true
//% blockId=device_set_pull block="set pull|pin %pin|to %pull"

View File

@ -83,9 +83,9 @@ namespace serial {
/**
* Dynamically configuring the serial instance to use pins other than USBTX and USBRX.
* @param tx the new transmission pins
* @param rx the new reception pin
* @param baud the new baud rate. eg: 115200
* @param tx the new transmission pins, eg: SerialPin.P0
* @param rx the new reception pin, eg: SerialPin.P1
* @param rate the new baud rate. eg: 115200
*/
//% weight=10
//% help=serial/redirect-to

44
libs/core/shims.d.ts vendored
View File

@ -216,8 +216,8 @@ declare namespace input {
/**
* Do something when a button (``A``, ``B`` or both ``A+B``) is pressed
* @param button TODO
* @param body TODO
* @param button the button that needs to be pressed
* @param body code to run when event is raised
*/
//% help=input/on-button-pressed weight=85 blockGap=8
//% blockId=device_button_event block="on button|%NAME|pressed" icon="\uf192"
@ -226,7 +226,8 @@ declare namespace input {
/**
* Do something when when a gesture is done (like shaking the micro:bit).
* @param body TODO
* @param gesture the type of gesture to track, eg: Gesture.Shake
* @param body code to run when gesture is raised
*/
//% help=input/on-gesture weight=84 blockGap=8
//% blockId=device_gesture_event block="on |%NAME" icon="\uf135"
@ -235,16 +236,16 @@ declare namespace input {
/**
* Do something when a pin is pressed.
* @param name the pin that needs to be pressed
* @param name the pin that needs to be pressed, eg: TouchPin.P0
* @param body the code to run when the pin is pressed
*/
//% help=input/on-pin-pressed weight=83
//% blockId=device_pin_event block="on pin %NAME|pressed" icon="\uf094" shim=input::onPinPressed
//% blockId=device_pin_event block="on pin %name|pressed" icon="\uf094" shim=input::onPinPressed
function onPinPressed(name: TouchPin, body: () => void): void;
/**
* Do something when a pin is released.
* @param name the pin that needs to be released
* @param name the pin that needs to be released, eg: TouchPin.P0
* @param body the code to run when the pin is released
*/
//% help=input/on-pin-released weight=6 blockGap=8
@ -254,6 +255,7 @@ declare namespace input {
/**
* Get the button state (pressed or not) for ``A`` and ``B``.
* @param button the button to query the request, eg: Button.A
*/
//% help=input/button-is-pressed weight=60
//% block="button|%NAME|is pressed"
@ -264,7 +266,7 @@ declare namespace input {
/**
* Get the pin state (pressed or not). Requires to hold the ground to close the circuit.
* @param name pin used to detect the touch
* @param name pin used to detect the touch, eg: TouchPin.P0
*/
//% help=input/pin-is-pressed weight=58
//% blockId="device_pin_is_pressed" block="pin %NAME|is pressed" icon="\uf094"
@ -512,7 +514,7 @@ declare namespace pins {
/**
* Read the specified pin or connector as either 0 or 1
* @param name pin to read from
* @param name pin to read from, eg: DigitalPin.P0
*/
//% help=pins/digital-read-pin weight=30
//% blockId=device_get_digital_pin block="digital read|pin %name" blockGap=8 shim=pins::digitalReadPin
@ -520,7 +522,7 @@ declare namespace pins {
/**
* Set a pin or connector value to either 0 or 1.
* @param name pin to write to
* @param name pin to write to, eg: DigitalPin.P0
* @param value value to set on the pin, 1 eg,0
*/
//% help=pins/digital-write-pin weight=29
@ -529,7 +531,7 @@ declare namespace pins {
/**
* Read the connector value as analog, that is, as a value comprised between 0 and 1023.
* @param name pin to write to
* @param name pin to write to, eg: AnalogPin.P0
*/
//% help=pins/analog-read-pin weight=25
//% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8" shim=pins::analogReadPin
@ -537,7 +539,7 @@ declare namespace pins {
/**
* Set the connector value as analog. Value must be comprised between 0 and 1023.
* @param name pin name to write to
* @param name pin name to write to, eg: AnalogPin.P0
* @param value value to write to the pin between ``0`` and ``1023``. eg:1023,0
*/
//% help=pins/analog-write-pin weight=24
@ -547,7 +549,7 @@ declare namespace pins {
/**
* Configures the Pulse-width modulation (PWM) of the analog output to the given value in **microseconds** or `1/1000` milliseconds.
* If this pin is not configured as an analog output (using `analog write pin`), the operation has no effect.
* @param name analog pin to set period to
* @param name analog pin to set period to, eg: AnalogPin.P0
* @param micros period in micro seconds. eg:20000
*/
//% help=pins/analog-set-period weight=23 blockGap=8
@ -556,6 +558,8 @@ declare namespace pins {
/**
* Configures this pin to a digital input, and generates events where the timestamp is the duration that this pin was either ``high`` or ``low``.
* @param name digital pin to register to, eg: DigitalPin.P0
* @param pulse the value of the pulse, eg: PulseValue.High
*/
//% help=pins/on-pulsed weight=22 blockGap=8 advanced=true
//% blockId=pins_on_pulsed block="on|pin %pin|pulsed %pulse" shim=pins::onPulsed
@ -571,8 +575,8 @@ declare namespace pins {
/**
* Returns the duration of a pulse in microseconds
* @param name the pin which measures the pulse
* @param value the value of the pulse (default high)
* @param name the pin which measures the pulse, eg: DigitalPin.P0
* @param value the value of the pulse, eg: PulseValue.High
* @param maximum duration in micro-seconds
*/
//% blockId="pins_pulse_in" block="pulse in (µs)|pin %name|pulsed %value"
@ -581,7 +585,7 @@ declare namespace pins {
/**
* Writes a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).
* @param name pin to write to
* @param name pin to write to, eg: AnalogPin.P0
* @param value angle or rotation speed, eg:180,90,0
*/
//% help=pins/servo-write-pin weight=20
@ -617,8 +621,8 @@ declare namespace pins {
/**
* Configures the pull of this pin.
* @param name pin to set the pull mode on
* @param pull one of the mbed pull configurations: PullUp, PullDown, PullNone
* @param name pin to set the pull mode on, eg: DigitalPin.P0
* @param pull one of the mbed pull configurations, eg: PinPullMode.PullUp
*/
//% help=pins/set-pull weight=3 advanced=true
//% blockId=device_set_pull block="set pull|pin %pin|to %pull" shim=pins::setPull
@ -685,9 +689,9 @@ declare namespace serial {
/**
* Dynamically configuring the serial instance to use pins other than USBTX and USBRX.
* @param tx the new transmission pins
* @param rx the new reception pin
* @param baud the new baud rate. eg: 115200
* @param tx the new transmission pins, eg: SerialPin.P0
* @param rx the new reception pin, eg: SerialPin.P1
* @param rate the new baud rate. eg: 115200
*/
//% weight=10
//% help=serial/redirect-to

View File

@ -1,6 +1,6 @@
{
"name": "pxt-microbit",
"version": "0.6.35",
"version": "0.6.43",
"description": "micro:bit target for PXT",
"keywords": [
"JavaScript",
@ -34,6 +34,6 @@
"semantic-ui-less": "^2.2.4"
},
"dependencies": {
"pxt-core": "0.5.98"
"pxt-core": "0.6.5"
}
}

View File

@ -43,11 +43,19 @@
"microbit-serial": ""
}
},
{
"type": "missingPackage",
"map": {
"radio\\s*\\.": "radio",
"bluetooth\\s*\\.": "bluetooth",
"devices\\s*\\.": "devices"
}
},
{
"type": "api",
"map": {
"bluetooth\\.uartRead\\((.*?)\\)": "bluetooth.uartReadUntil($1)",
"bluetooth\\.uartWrite\\((.*?)\\)": "bluetooth.uartWriteUntil($1)"
"bluetooth\\s*\\.uartRead\\s*\\((.*?)\\)": "bluetooth.uartReadUntil($1)",
"bluetooth\\s*\\.uartWrite\\s*\\((.*?)\\)": "bluetooth.uartWriteUntil($1)"
}
}
]
@ -315,6 +323,7 @@
],
"invertedMenu": true,
"coloredToolbox": true,
"monacoToolbox": true,
"blocklyOptions": {
"grid": {
"spacing": 45,

View File

@ -74,12 +74,12 @@
}
/* Blockly Toolbox Buttons */
#blocklyToolboxButtons .blocklyAddPackageButton {
.blocklyToolboxButtons .blocklyAddPackageButton {
&:extend(.ui.inverted.pink.button all);
&:extend(.circular all);
}
#blocklyToolboxButtons .blocklyUndoButton {
.blocklyToolboxButtons .blocklyUndoButton {
&:extend(.ui.inverted.blue.button all);
&:extend(.circular all);
}
@ -92,12 +92,17 @@
background: #ecf0f1;
}
.monacoDraggableBlock {
background: #ecf0f1;
border: solid 3px #ecf0f1;
}
.monaco-editor-background {
background: #ecf0f1;
}
.monacoFlyout {
background: rgba(82, 90, 103, 0.8);
background: rgba(82, 90, 103, 0.5);
}
@ -117,7 +122,7 @@
top: auto;
}
/* Blockly Toolbox buttons */
#blocklyToolboxButtons {
#blocklyToolboxButtons, #monacoToolboxButtons {
margin-right: 0.5rem;
margin-left: 0.5rem;
}
@ -129,7 +134,7 @@
top: auto;
}
/* Blockly Toolbox buttons */
#blocklyToolboxButtons {
#blocklyToolboxButtons, #monacoToolboxButtons {
margin-right: 1rem;
margin-left: 1rem;
}
@ -142,7 +147,7 @@
padding-left: 1rem;
}
/* Blockly Toolbox buttons */
#blocklyToolboxButtons {
#blocklyToolboxButtons, #monacoToolboxButtons {
margin-right: 2rem;
margin-left: 2rem;
}

View File

@ -52,7 +52,7 @@
@dimmer : 'default';
@dropdown : 'default';
@embed : 'default';
@modal : 'default';
@modal : 'pxt';
@nag : 'default';
@popup : 'default';
@progress : 'default';