updated docs paths

This commit is contained in:
Peli de Halleux 2016-03-21 22:13:39 -07:00
parent 3d3332faa1
commit 9fbc17c8ce
11 changed files with 96 additions and 97 deletions

View File

@ -121,7 +121,7 @@ namespace devices {
* Sends a ``camera`` command to the parent device.
* @param event TODO
*/
//% weight=30 help=functions/tell-camera-to shim=micro_bit::devices::camera
//% weight=30 help=devices/tell-camera-to shim=micro_bit::devices::camera
//% blockId=devices_camera icon="\uf030" block="tell camera to|%property" blockGap=8
export function tellCameraTo(event: MesCameraEvent): void { }
@ -129,7 +129,7 @@ namespace devices {
* Sends a ``remote control`` command to the parent device.
* @param event TODO
*/
//% weight=29 help=functions/tell-remote-control-to shim=micro_bit::devices::remote_control
//% weight=29 help=devices/tell-remote-control-to shim=micro_bit::devices::remote_control
//% blockId=devices_remote_control block="tell remote control to|%property" blockGap=14 icon="\uf144"
export function tellRemoteControlTo(event: MesRemoteControlEvent): void { }
@ -137,7 +137,7 @@ namespace devices {
* Sends an ``alert`` command to the parent device.
* @param event TODO
*/
//% weight=27 help=functions/raise-alert-to shim=micro_bit::devices::alert
//% weight=27 help=devices/raise-alert-to shim=micro_bit::devices::alert
//% blockId=devices_alert block="raise alert to|%property" icon="\uf0f3"
export function raiseAlertTo(event: MesAlertEvent): void { }
@ -146,7 +146,7 @@ namespace devices {
* @param event TODO
* @param body TODO
*/
//% shim=micro_bit::onDeviceInfo help=functions/on-notified
//% shim=micro_bit::onDeviceInfo help=devices/on-notified
//% weight=26
//% blockId=devices_device_info_event block="on notified" icon="\uf10a"
export function onNotified(event: MesDeviceInfo, body: Action): void { }
@ -156,7 +156,7 @@ namespace devices {
* @param name TODO
* @param body TODO
*/
//% help=functions/on-gamepad-button weight=40 shim=micro_bit::onGamepadButton
//% help=devices/on-gamepad-button weight=40 shim=micro_bit::onGamepadButton
//% weight=25
//% blockId=devices_gamepad_event block="on gamepad button|%NAME" icon="\uf11b"
export function onGamepadButton(name: MesDpadButtonInfo, body: Action): void { }
@ -164,7 +164,7 @@ namespace devices {
/**
* Returns the last signal strength reported by the paired device.
*/
//% help=functions/signal-strength weight=24 shim=micro_bit::signalStrength
//% help=devices/signal-strength weight=24 shim=micro_bit::signalStrength
//% blockId=devices_signal_strength block="signal strength" blockGap=14 icon="\uf012" blockGap=14
export function signalStrength(): number {
return 0;
@ -174,7 +174,7 @@ namespace devices {
* Registers code to run when the device notifies about a change of signal strength.
* @param body TODO
*/
//% shim=micro_bit::onSignalStrengthChanged weight=23 help=functions/on-signal-strength-changed
//% shim=micro_bit::onSignalStrengthChanged weight=23 help=devices/on-signal-strength-changed
//% blockId=devices_signal_strength_changed_event block="on signal strength changed" icon="\uf012"
export function onSignalStrengthChanged(body: Action): void { }
}

View File

@ -3,7 +3,7 @@ namespace radio {
/**
* Broadcasts a number over radio to any connected micro:bit in the group.
*/
//% help=/functions/send-number
//% help=radio/send-number
//% weight=60
//% blockId=radio_datagram_send block="send number %MESSAGE" blockGap=8
export function sendNumber(value: number) : void {
@ -13,7 +13,7 @@ namespace radio {
/**
* Broadcasts 4 numbers over radio to any connected micro:bit in the group.
*/
//% help=/functions/send-numbers
//% help=radio/send-numbers
//% shim=micro_bit::datagramSendNumbers
//% weight=59
//% blockId=radio_datagram_send_numbers block="send numbers|0: %VALUE0|1: %VALUE1|2: %VALUE2|3: %VALUE3"
@ -24,7 +24,7 @@ namespace radio {
/**
* Registers code to run when a packet is received over radio.
*/
//% help=/functions/on-data-received
//% help=radio/on-data-received
//% shim=micro_bit::onDatagramReceived
//% weight=50
//% blockId=radio_datagram_received_event block="on data received" blockGap=8
@ -35,7 +35,7 @@ namespace radio {
/**
* Reads the next packet as a number from the radio queue.
*/
//% help=/functions/receive-number
//% help=radio/receive-number
//% shim=micro_bit::datagramReceiveNumber
//% weight=46
//% blockId=radio_datagram_receive block="receive number" blockGap=8
@ -49,7 +49,7 @@ namespace radio {
* Reads a number at a given index, between ``0`` and ``3``, from the packet received by ``receive number``. Not supported in simulator.
* @param index index of the number to read from 0 to 3. eg: 1
*/
//% help=/functions/received-number-at
//% help=radio/received-number-at
//% shim=micro_bit::datagramGetNumber
//% weight=45
//% blockId=radio_datagram_received_number_at block="receive number|at %VALUE" blockGap=8
@ -64,7 +64,7 @@ namespace radio {
* Gets the received signal strength indicator (RSSI) from the packet received by ``receive number``. Not supported in simulator.
* namespace=radio
*/
//% help=/functions/received-signal-strength
//% help=radio/received-signal-strength
//% shim=micro_bit::datagramGetRSSI
//% weight=40
//% blockId=radio_datagram_rssi block="received signal strength"
@ -76,7 +76,7 @@ namespace radio {
* Sets the group id for radio communications. A micro:bit can only listen to one group ID at any time.
* @ param id the group id between ``0`` and ``255``, eg: 1
*/
//% help=/functions/set-group
//% help=radio/set-group
//% shim=micro_bit::setGroup
//% weight=10
//% blockId=radio_set_group block="set group %ID"
@ -87,7 +87,7 @@ namespace radio {
* Change the output power level of the transmitter to the given value.
* @param power a value in the range 0..7, where 0 is the lowest power and 7 is the highest, eg: 7
*/
//% help=/functions/set-transmit-power
//% help=radio/set-transmit-power
//% shim=micro_bit::setTransmitPower
//% weight=9
//% blockId=radio_set_transmit_power block="set transmit power %power"

View File

@ -8,7 +8,7 @@ namespace basic {
* Scroll a number on the screen. If the number fits on the screen (i.e. is a single digit), do not scroll.
* @param interval speed of scroll; eg: 150, 100, 200, -100
*/
//% help=functions/show-number
//% help=basic/show-number
//% weight=96
//% shim=micro_bit::scrollNumber
//% blockId=device_show_number block="show|number %number" blockGap=8 icon="\uf1ec"
@ -20,7 +20,7 @@ namespace basic {
* @param leds TODO
* @param interval TODO
*/
//% help=functions/show-leds
//% help=basic/show-leds
//% weight=95 blockGap=8
//% shim=micro_bit::showLeds
//% imageLiteral=1 async
@ -33,7 +33,7 @@ namespace basic {
* @param text the text to scroll on the screen, eg: "Hello!"
* @param interval how fast to shift characters; eg: 150, 100, 200, -100
*/
//% help=functions/show-string
//% help=basic/show-string
//% weight=87 blockGap=8
//% shim=micro_bit::scrollString async
//% block="show|string %text" icon="\uf031"
@ -44,7 +44,7 @@ namespace basic {
/**
* Turn off all LEDs
*/
//% help=functions/clear-screen weight=79
//% help=basic/clear-screen weight=79
//% shim=micro_bit::clearScreen
//% blockId=device_clear_display block="clear screen" icon="\uf12d"
export function clearScreen(): void { }
@ -54,21 +54,21 @@ namespace basic {
* @param leds TODO
* @param interval TODO
*/
//% help=functions/show-animation shim=micro_bit::showAnimation imageLiteral=1 async
//% help=basic/show-animation shim=micro_bit::showAnimation imageLiteral=1 async
export function showAnimation(leds: string, interval: number = 400): void { }
/**
* Draws an image on the LED screen.
* @param leds TODO
*/
//% help=functions/plot-leds weight=80 shim=micro_bit::plotLeds imageLiteral=1
//% help=basic/plot-leds weight=80 shim=micro_bit::plotLeds imageLiteral=1
export function plotLeds(leds: string): void { }
/**
* Repeats the code forever in the background. On each iteration, allows other codes to run.
* @param body TODO
*/
//% help=functions/forever weight=55 blockGap=8
//% help=basic/forever weight=55 blockGap=8
//% blockId=device_forever block="forever" icon="\uf01e" shim=micro_bit::forever
export function forever(body: () => void): void { }
@ -76,7 +76,7 @@ namespace basic {
* Pause for the specified time in milliseconds
* @param ms how long to pause for, eg: 100, 200, 500, 1000, 2000
*/
//% help=functions/pause weight=54
//% help=basic/pause weight=54
//% shim=micro_bit::pause async block="pause (ms) %pause"
//% blockId=device_pause icon="\uf110"
export function pause(ms: number): void { }

View File

@ -1,13 +1,13 @@
namespace control {
/**
* Schedules code that run in the background.
//% help=functions/in-background shim=micro_bit::runInBackground
//% help=control/in-background shim=micro_bit::runInBackground
*/
export function inBackground(body: Action): void { }
/**
* Resets the BBC micro:bit.
*/
//% weight=1 shim=uBit.reset async help=functions/reset
//% weight=1 shim=uBit.reset async help=control/reset
export function reset() : void { }
}

View File

@ -49,7 +49,7 @@ namespace game {
/**
* Gets the current score
*/
//% weight=9 help=td/game-library
//% weight=9 help=game/score
//% blockId=game_score block="score" blockGap=8
export function score(): number {
return _score;
@ -59,7 +59,7 @@ namespace game {
* Adds points to the current score
* @param points amount of points to change, eg: 1
*/
//% weight=10 help=td/game-library
//% weight=10 help=game/add-score
//% blockId=game_add_score block="change score by|%points" blockGap=8
export function addScore(points: number): void {
setScore(_score + points);
@ -77,7 +77,7 @@ namespace game {
* Starts a game countdown timer
* @param ms countdown duration in milliseconds, eg: 10000
*/
//% weight=9 help=td/game-library
//% weight=9 help=game/start-countdown
//% blockId=game_start_countdown block="start countdown|(ms) %duration" blockGap=8
export function startCountdown(ms: number): void {
if (checkStart()) {
@ -99,7 +99,7 @@ namespace game {
/**
* Displays a game over animation.
*/
//% weight=8 help=td/game-library
//% weight=8 help=game/game-over
//% blockId=game_game_over block="game over"
export function gameOver(): void {
if (!_isGameOver) {
@ -140,7 +140,7 @@ namespace game {
* Sets the current score value
* @param value TODO
*/
//% weight=10 help=td/game-library
//% weight=10 help=game/set-score
export function setScore(value: number): void {
_score = Math.max(0, value);
}
@ -148,7 +148,7 @@ namespace game {
/**
* Gets the current life
*/
//% weight=10 help=td/game-library
//% weight=10
export function life(): number {
return _life;
}
@ -157,7 +157,7 @@ namespace game {
* Sets the current life value
* @param value TODO
*/
//% weight=10 help=td/game-library
//% weight=10
export function setLife(value: number): void {
_life = Math.max(0, value);
if (_life <= 0) {
@ -169,7 +169,7 @@ namespace game {
* Adds life points to the current life
* @param lives TODO
*/
//% weight=10 help=td/game-library
//% weight=10
export function addLife(lives: number): void {
setLife(_life + lives);
}
@ -177,7 +177,7 @@ namespace game {
/**
* Gets the remaining time (since `start countdown`) or current time (since the device started or `start stopwatch`) in milliseconds.
*/
//% weight=10 help=td/game-library
//% weight=10
export function currentTime(): number {
if (_endTime > 0) {
return Math.max(0, _endTime - input.runningTime());
@ -190,7 +190,7 @@ namespace game {
* Removes some life
* @param life TODO
*/
//% weight=10 help=td/game-library
//% weight=10
export function removeLife(life: number): void {
setLife(_life - life);
control.inBackground(() => {
@ -206,7 +206,7 @@ namespace game {
/**
* Increments the level and display a message.
*/
//% weight=10 help=td/game-library
//% weight=10
export function levelUp(): void {
_level = _level + 1;
basic.showString("LEVEL:", 150);
@ -216,7 +216,7 @@ namespace game {
/**
* Gets the current level
*/
//% weight=10 help=td/game-library
//% weight=10
export function level(): number {
return _level;
}
@ -224,7 +224,7 @@ namespace game {
/**
* Starts a stopwatch timer. `current time` will return the elapsed time.
*/
//% weight=10 help=td/game-library
//% weight=10
export function startStopwatch(): void {
_startTime = input.runningTime();
_endTime = -1;
@ -233,7 +233,7 @@ namespace game {
/**
* Gets a value indicating if the game is still running. Returns `false` if game over.
*/
//% weight=10 help=td/game-library
//% weight=10
export function isRunning(): boolean {
let running: boolean;
return !_isGameOver;
@ -242,7 +242,7 @@ namespace game {
/**
* Displays the score on the screen.
*/
//% help=td/game-library weight=60
//% weight=60
export function showScore(): void {
basic.showString(" SCORE ", 100);
basic.showNumber(_score, 150);
@ -252,7 +252,6 @@ namespace game {
/**
* Indicates if the game is display the game over sequence.
*/
//% help=/functions/game-library
export function isGameOver(): boolean {
let over: boolean;
return _isGameOver;

View File

@ -3,7 +3,7 @@ namespace images {
/**
* Creates an image that fits on the LED screen.
*/
//% weight=75
//% weight=75 help=images/create-image
//% blockId=device_build_image block="create image" imageLiteral=1
export function createImage(leds: string): Image {
return null;
@ -12,7 +12,7 @@ namespace images {
/**
* Creates an image with 2 frames.
*/
//% weight=74
//% weight=74 help=images/create-big-image
//% blockId=device_build_big_image block="create big image" imageLiteral=2
export function createBigImage(leds: string): Image {
return null;
@ -23,7 +23,7 @@ namespace images {
* Shows an frame from the image at offset ``x offset``.
* @param xOffset TODO
*/
//% help=functions/show-image weight=80 shim=micro_bit::showImage
//% help=images/show-image weight=80 shim=micro_bit::showImage
//% blockId=device_show_image_offset block="show image %sprite|at offset %offset" blockGap=8
public showImage(xOffset: number): void {}
@ -32,7 +32,7 @@ namespace images {
* @param frameOffset x offset moved on each animation step, eg: 5, 1, -1
* @param interval time between each animation step in milli seconds, eg: 200
*/
//% help=functions/show-image weight=79 shim=micro_bit::scrollImage async
//% help=images/show-image weight=79 shim=micro_bit::scrollImage async
//% blockId=device_scroll_image block="scroll image %sprite|with offset %frameoffset|and interval (ms) %delay" blockGap=8
public scrollImage(frameOffset: number, interval : number = 200) {
}

View File

@ -126,7 +126,7 @@ namespace input {
* @param button TODO
* @param body TODO
*/
//% help=functions/on-button-pressed weight=85
//% help=input/on-button-pressed weight=85
//% shim=micro_bit::onButtonPressed
//% blockId=device_button_event
//% block="on button|%NAME|pressed"
@ -137,7 +137,7 @@ namespace input {
* Attaches code to run when the screen is facing up.
* @param body TODO
*/
//% help=functions/on-gesture shim=micro_bit::onGesture weight=84
//% help=input/on-gesture shim=micro_bit::onGesture weight=84
//% blockId=device_gesture_event block="on |%NAME" icon="\uf135"
export function onGesture(gesture: Gestures, body: Action): void { }
@ -146,14 +146,14 @@ namespace input {
* @param name TODO
* @param body TODO
*/
//% help=functions/on-pin-pressed weight=83 shim=micro_bit::onPinPressed
//% help=input/on-pin-pressed weight=83 shim=micro_bit::onPinPressed
//% blockId=device_pin_event block="on pin|%NAME|pressed" icon="\uf094"
export function onPinPressed(name: TouchPins, body: Action): void { }
/**
* Get the button state (pressed or not) for ``A`` and ``B``.
*/
//% help=functions/button-is-pressed weight=57
//% help=input/button-is-pressed weight=57
//% shim=micro_bit::isButtonPressed
//% block="button|%NAME|is pressed"
//% blockId=device_get_button2
@ -166,7 +166,7 @@ namespace input {
/**
* Get the current compass compass heading in degrees.
*/
//% help=functions/compass-heading
//% help=input/compass-heading
//% weight=56 icon="\uf14e"
//% shim=micro_bit::compassHeading
//% blockId=device_heading block="compass heading (°)" blockGap=8
@ -179,7 +179,7 @@ namespace input {
* Gets the temperature in Celsius degrees (°C).
*/
//% weight=55 icon="\uf06d"
//% help=functions/temperature shim=micro_bit::temperature
//% help=input/temperature shim=micro_bit::temperature
//% blockId=device_temperature block="temperature (°C)" blockGap=8
export function temperature(): number {
return 0;
@ -189,7 +189,7 @@ namespace input {
* Get the acceleration value in milli-gravitys (when the board is laying flat with the screen up, x=0, y=0 and z=-1024)
* @param dimension TODO
*/
//% help=functions/acceleration weight=54 icon="\uf135"
//% help=input/acceleration weight=54 icon="\uf135"
//% shim=micro_bit::getAcceleration
//% blockId=device_acceleration block="acceleration (mg)|%NAME" blockGap=8
export function acceleration(dimension: Dimension): number {
@ -200,7 +200,7 @@ namespace input {
/**
* Reads the light level applied to the LED screen in a range from ``0`` (dark) to ``255`` bright. In the simulator, the ``acceleration y`` is used to emulate this value.
*/
//% help=functions/light-level weight=53 shim=micro_bit::lightLevel
//% help=input/light-level weight=53 shim=micro_bit::lightLevel
//% blockId=device_get_light_level block="light level" blockGap=8 icon="\uf185"
export function lightLevel(): number {
return 0;
@ -210,7 +210,7 @@ namespace input {
* The pitch of the device, rotation along the ``x-axis``, in degrees.
* @param kind TODO
*/
//% help=/functions/rotation weight=52 shim=micro_bit::getRotation
//% help=/input/rotation weight=52 shim=micro_bit::getRotation
//% blockId=device_get_rotation block="rotation (°)|%NAME" blockGap=8 icon="\uf197"
export function rotation(kind: Rotation): number {
return 0;
@ -220,7 +220,7 @@ namespace input {
* Get the magnetic force value in ``micro-Teslas`` (``µT``). This function is not supported in the simulator.
* @param dimension TODO
*/
//% help=functions/magnetic-force weight=51 shim=micro_bit::getMagneticForce
//% help=input/magnetic-force weight=51 shim=micro_bit::getMagneticForce
//% blockId=device_get_magnetic_force block="magnetic force (µT)|%NAME" blockGap=8 icon="\uf076"
export function magneticForce(dimension: Dimension): number {
return 0;
@ -229,7 +229,7 @@ namespace input {
/**
* Gets the number of milliseconds elapsed since power on.
*/
//% help=functions/running-time shim=micro_bit::getCurrentTime weight=50
//% help=input/running-time shim=micro_bit::getCurrentTime weight=50
//% blockId=device_get_running_time block="running time (ms)" icon="\uf017"
export function runningTime(): number {
return 0;
@ -238,14 +238,14 @@ namespace input {
/**
* Obsolete, compass calibration is automatic.
*/
//% help=functions/calibrate weight=0 shim=TD_NOOP
//% help=input/calibrate weight=0 shim=TD_NOOP
export function calibrate(): void { }
/**
* Get the pin state (pressed or not). Requires to hold the ground to close the circuit.
* @param name TODO
*/
//% help=functions/pin-is-pressed weight=58 shim=micro_bit::isPinTouched block="pin|%NAME|is pressed" icon="\uf094"
//% help=input/pin-is-pressed weight=58 shim=micro_bit::isPinTouched block="pin|%NAME|is pressed" icon="\uf094"
export function pinIsPressed(name: TouchPins): boolean {
return false;
}
@ -254,7 +254,7 @@ namespace input {
* Attaches code to run when the screen is facing up.
* @param body TODO
*/
//% help=functions/on-screen-up
//% help=input/on-screen-up
export function onScreenUp(body: Action): void {
onGesture(Gestures.ScreenUp, body);
}
@ -263,7 +263,7 @@ namespace input {
* Attaches code to run when the screen is facing down.
* @param body TODO
*/
//% help=functions/on-screen-down
//% help=input/on-screen-down
export function onScreenDown(body: Action): void {
onGesture(Gestures.ScreenDown, body);
}
@ -272,7 +272,7 @@ namespace input {
* Attaches code to run when the device is shaken.
* @param body TODO
*/
//% help=functions/on-shake
//% help=input/on-shake
export function onShake(body: Action): void {
onGesture(Gestures.Shake, body);
}
@ -281,7 +281,7 @@ namespace input {
* Attaches code to run when the logo is oriented upwards and the board is vertical.
* @param body TODO
*/
//% help=functions/on-logo-up
//% help=input/on-logo-up
export function onLogoUp(body: Action): void {
onGesture(Gestures.LogoUp, body);
}
@ -290,7 +290,7 @@ namespace input {
* Attaches code to run when the logo is oriented downwards and the board is vertical.
* @param body TODO
*/
//% help=functions/on-logo-down
//% help=input/on-logo-down
export function onLogoDown(body: Action): void {
onGesture(Gestures.LogoDown, body);
}
@ -299,7 +299,7 @@ namespace input {
* Sets the accelerometer sample range in gravities.
* @param range a value describe the maximum strengh of acceleration measured
*/
//% help=functions/set-accelerator-range
//% help=input/set-accelerator-range
//% blockId=device_set_accelerometer_range block="set accelerometer|range %range" icon="\uf135"
//% weight=5
//% shim=micro_bit::setAccelerometerRange

View File

@ -12,7 +12,7 @@ namespace led {
* @param x TODO
* @param y TODO
*/
//% help=functions/plot weight=78 shim=micro_bit::plot
//% help=led/plot weight=78 shim=micro_bit::plot
//% blockId=device_plot block="plot|x %x|y %y" icon="\uf205" blockGap=8
export function plot(x: number, y: number): void { }
@ -21,7 +21,7 @@ namespace led {
* @param x TODO
* @param y TODO
*/
//% help=functions/unplot weight=77 shim=micro_bit::unPlot
//% help=led/unplot weight=77 shim=micro_bit::unPlot
//% blockId=device_unplot block="unplot|x %x|y %y" icon="\uf204" blockGap=8
export function unplot(x: number, y: number): void { }
@ -30,7 +30,7 @@ namespace led {
* @param x TODO
* @param y TODO
*/
//% help=functions/point weight=76 shim=micro_bit::point
//% help=led/point weight=76 shim=micro_bit::point
//% blockId=device_point block="point|x %x|y %y" icon="\uf10c"
export function point(x: number, y: number): boolean {
return false;
@ -39,7 +39,7 @@ namespace led {
/**
* Get the screen brightness from 0 (off) to 255 (full bright).
*/
//% help=functions/brightness weight=60 shim=micro_bit::getBrightness
//% help=led/brightness weight=60 shim=micro_bit::getBrightness
//% blockId=device_get_brightness block="brightness" icon="\uf042" blockGap=8
export function brightness(): number {
return 0;
@ -49,14 +49,14 @@ namespace led {
* Set the screen brightness from 0 (off) to 255 (full bright).
* @param value the brightness value, eg:255, 127, 0
*/
//% help=functions/set-brightness weight=59 shim=micro_bit::setBrightness
//% help=led/set-brightness weight=59 shim=micro_bit::setBrightness
//% blockId=device_set_brightness block="set brightness %value" icon="\uf042"
export function setBrightness(value: number): void { }
/**
* Cancels the current animation and clears other pending animations.
*/
//% weight=50 shim=uBit.display.stopAnimation help=functions/stop-animation
//% weight=50 shim=uBit.display.stopAnimation help=led/stop-animation
//% blockId=device_stop_animation block="stop animation" icon="\uf04d"
export function stopAnimation(): void { }
@ -65,7 +65,7 @@ namespace led {
* @param value current value to plot
* @param high maximum value, eg: 1023, 255
*/
//% help=/functions/plot-bar-graph weight=20
//% help=/led/plot-bar-graph weight=20
//% blockId=device_plot_bar_graph block="plot bar graph of %value |up to %high" icon="\uf080" blockExternalInputs=true
export function plotBarGraph(value: number, high: number): void {
@ -97,7 +97,7 @@ namespace led {
* Sets the display mode between black and white and greyscale for rendering LEDs.
* @param mode TODO
*/
//% shim=micro_bit::setDisplayMode weight=1 help=/functions/set-display-mode
//% shim=micro_bit::setDisplayMode weight=1 help=/led/set-display-mode
export function setDisplayMode(mode: DisplayMode): void { }
/**
@ -105,7 +105,7 @@ namespace led {
* @param x TODO
* @param y TODO
*/
//% help=functions/toggle
//% help=led/toggle
export function toggle(x: number, y: number): void {
if (led.point(x, y)) {
led.unplot(x, y);
@ -117,7 +117,7 @@ namespace led {
/**
* Turns all LEDS on
*/
//% help=functions/plot-all
//% help=led/plot-all
export function plotAll(): void {
for (let i = 0; i < 5; i++) {
for (let j = 0; j < 5; j++) {
@ -129,7 +129,7 @@ namespace led {
/**
* Inverts the current LED display
*/
//% help=functions/toggle-all
//% help=led/toggle-all
export function toggleAll(): void {
for (let i = 0; i < 5; i++) {
for (let j = 0; j < 5; j++) {
@ -142,7 +142,7 @@ namespace led {
* Fades in the screen display.
* @param ms TODO
*/
//% help=functions/fade-in
//% help=led/fade-in
export function fadeIn(ms: number = 700): void {
if (ms < 20) {
led.setBrightness(255);
@ -164,7 +164,7 @@ namespace led {
* Fades out the screen brightness.
* @param ms TODO
*/
//% help=functions/fade-out
//% help=led/fade-out
export function fadeOut(ms: number = 700): void {
if (ms < 20) {
led.setBrightness(0);
@ -185,7 +185,7 @@ namespace led {
/**
* Takes a screenshot of the LED screen and returns an image.
*/
//% shim=uBit.display.screenShot help=functions/screenshot
//% shim=uBit.display.screenShot help=led/screenshot
export function screenshot(): images.Image {
/*
let img: Image;

View File

@ -119,7 +119,7 @@ namespace music {
* @param frequency TODO
* @param ms TODO
*/
//% help=functions/play-tone weight=90
//% help=music/play-tone weight=90
//% blockId=device_play_note block="play|tone (Hz) %note=device_note|for (ms) %duration=device_beat" icon="\uf025" blockGap=8
export function playTone(frequency: number, ms: number): void {
pins.analogSetPitchPin(AnalogPins.P0);
@ -130,7 +130,7 @@ namespace music {
* Plays a tone through pin ``P0``.
* @param frequency TODO
*/
//% help=functions/ring-tone weight=80
//% help=music/ring-tone weight=80
//% blockId=device_ring block="ring tone (Hz)|%note=device_note" icon="\uf025" blockGap=8
export function ringTone(frequency: number): void {
pins.analogSetPitchPin(AnalogPins.P0);
@ -141,7 +141,7 @@ namespace music {
* Rests (plays nothing) for a specified time through pin ``P0``.
* @param ms TODO
*/
//% help=functions/rest weight=79
//% help=music/rest weight=79
//% blockId=device_rest block="rest(ms)|%duration=device_beat"
export function rest(ms: number): void {
playTone(0, ms);
@ -152,7 +152,7 @@ namespace music {
* Gets the frequency of a note.
* @param name TODO
*/
//% shim=TD_ID weight=50 help=functions/note-frequency
//% shim=TD_ID weight=50 help=music/note-frequency
//% blockId=device_note block="%note"
export function noteFrequency(name: Notes): number {
return name;
@ -165,7 +165,7 @@ namespace music {
/**
* Returns the duration of a beat in milli-seconds
*/
//% help=/functions/beat weight=49
//% help=music/beat weight=49
//% blockId=device_beat block="%fraction|beat"
export function beat(fraction : BeatFraction = BeatFraction.Whole): number {
init();
@ -180,7 +180,7 @@ namespace music {
/**
* Returns the tempo in beats per minute. Tempo is the speed (bpm = beats per minute) at which notes play. The larger the tempo value, the faster the notes will play.
*/
//% help=/functions/tempo weight=40
//% help=music/tempo weight=40
//% blockId=device_tempo block="tempo (bpm)" blockGap=8
export function tempo(): number {
init();
@ -191,7 +191,7 @@ namespace music {
* Change the tempo by the specified amount
* @param bpm The change in beats per minute to the tempo, eg: 20
*/
//% help=/functions/tempo weight=39
//% help=music/tempo weight=39
//% blockId=device_change_tempo block="change tempo by (bpm)|%value" blockGap=8
export function changeTempoBy(bpm: number): void {
setTempo(beat(BeatFraction.Whole) + bpm);
@ -201,7 +201,7 @@ namespace music {
* Sets the tempo to the specified amount
* @param bpm The new tempo in beats per minute, eg: 120
*/
//% help=/functions/tempo weight=38
//% help=music/tempo weight=38
//% blockId=device_set_tempo block="set tempo to (bpm)|%value"
export function setTempo(bpm: number): void {
init();

View File

@ -61,7 +61,7 @@ namespace pins {
* Read the specified pin or connector as either 0 or 1
* @param name pin to read from
*/
//% help=functions/digital-read-pin weight=30 shim=micro_bit::digitalReadPin
//% help=pins/digital-read-pin weight=30 shim=micro_bit::digitalReadPin
//% blockId=device_get_digital_pin block="digital read|pin %name" blockGap=8
export function digitalReadPin(name: DigitalPins): number {
@ -73,7 +73,7 @@ namespace pins {
* @param name pin to write to
* @param value value to set on the pin, eg: 1,0
*/
//% help=functions/digital-write-pin weight=29 shim=micro_bit::digitalWritePin
//% help=pins/digital-write-pin weight=29 shim=micro_bit::digitalWritePin
//% blockId=device_set_digital_pin block="digital write|pin %name|to %value"
export function digitalWritePin(name: DigitalPins, value: number): void { }
@ -81,7 +81,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
*/
//% help=functions/analog-read-pin weight=25 shim=micro_bit::analogReadPin
//% help=pins/analog-read-pin weight=25 shim=micro_bit::analogReadPin
//% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8"
export function analogReadPin(name: AnalogPins): number {
return 0;
@ -92,7 +92,7 @@ namespace pins {
* @param name pin name to write to
* @param value value to write to the pin between ``0`` and ``1023``. eg:1023,0
*/
//% help=functions/analog-write-pin weight=24 shim=micro_bit::analogWritePin
//% help=pins/analog-write-pin weight=24 shim=micro_bit::analogWritePin
//% blockId=device_set_analog_pin block="analog write|pin %name|to %value" blockGap=8
export function analogWritePin(name: AnalogPins, value: number): void { }
@ -102,7 +102,7 @@ namespace pins {
* @param pin analog pin to set period to
* @param micros period in micro seconds. eg:20000
*/
//% shim=micro_bit::setAnalogPeriodUs help=functions/analog-set-period weight=23
//% shim=micro_bit::setAnalogPeriodUs help=pins/analog-set-period weight=23
//% blockId=device_set_analog_period block="analog set period|pin %pin|to (µs)%micros"
export function analogSetPeriod(pin: AnalogPins, micros: number): void { }
@ -111,7 +111,7 @@ namespace pins {
* @param name pin to write to
* @param value angle or rotation speed, eg:180,90,0
*/
//% help=functions/servo-write-pin weight=20 shim=micro_bit::servoWritePin
//% help=pins/servo-write-pin weight=20 shim=micro_bit::servoWritePin
//% blockId=device_set_servo_pin block="servo write|pin %name|to %value" blockGap=8
export function servoWritePin(name: AnalogPins, value: number): void { }
@ -120,7 +120,7 @@ namespace pins {
* @param pin pin name
* @param micros pulse duration in micro seconds, eg:1500
*/
//% shim=micro_bit::setServoPulseUs help=functions/serial-set-pulse weight=19
//% shim=micro_bit::setServoPulseUs help=pins/serial-set-pulse weight=19
//% blockId=device_set_servo_pulse block="servo set pulse|pin %value|to (µs) %micros"
export function servoSetPulse(pin: AnalogPins, micros: number): void { }
@ -132,7 +132,7 @@ namespace pins {
* @param toLow the lower bound of the value's target range
* @param toHigh the upper bound of the value's target range, eg: 4
*/
//% help=functions/map weight=15
//% help=pins/map weight=15
//% blockId=math_map block="map %value|from low %fromLow|from high %fromHigh|to low %toLow|to high %toHigh"
export function map(value: number, fromLow: number, fromHigh: number, toLow: number, toHigh: number): number {
return ((value - fromLow) * (toHigh - toLow)) / (fromHigh - fromLow) + toLow;
@ -142,7 +142,7 @@ namespace pins {
* Sets the pin used when using `pins->analog pitch`.
* @param name TODO
*/
//% shim=micro_bit::enablePitch help=functions/analog-set-pitch weight=12
//% shim=micro_bit::enablePitch help=pins/analog-set-pitch weight=12
export function analogSetPitchPin(name: AnalogPins): void { }
/**
@ -150,6 +150,6 @@ namespace pins {
* @param frequency TODO
* @param ms TODO
*/
//% shim=micro_bit::pitch help=functions/analog-pitch weight=14 async
//% shim=micro_bit::pitch help=pins/analog-pitch weight=14 async
export function analogPitch(frequency: number, ms: number): void { }
}