Various UI fixes. Block refactoring and adding touch and color blocks.
This commit is contained in:
parent
4977358718
commit
84d80131d4
74
docs/static/lego-logo.svg
vendored
Normal file
74
docs/static/lego-logo.svg
vendored
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 16.0.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
version="1.1"
|
||||||
|
id="Layer_1"
|
||||||
|
x="0px"
|
||||||
|
y="0px"
|
||||||
|
width="141.73"
|
||||||
|
height="141.731"
|
||||||
|
viewBox="0 0 141.73 141.73101"
|
||||||
|
enable-background="new 0 0 265.365 141.732"
|
||||||
|
xml:space="preserve"
|
||||||
|
inkscape:version="0.91 r13725"
|
||||||
|
sodipodi:docname="lego-logo.svg"><metadata
|
||||||
|
id="metadata26"><rdf:RDF><cc:Work
|
||||||
|
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||||
|
id="defs24" /><sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1199"
|
||||||
|
inkscape:window-height="604"
|
||||||
|
id="namedview22"
|
||||||
|
showgrid="false"
|
||||||
|
fit-margin-top="0"
|
||||||
|
fit-margin-left="0"
|
||||||
|
fit-margin-right="0"
|
||||||
|
fit-margin-bottom="0"
|
||||||
|
inkscape:zoom="1.6520876"
|
||||||
|
inkscape:cx="101.03204"
|
||||||
|
inkscape:cy="98.819336"
|
||||||
|
inkscape:window-x="372"
|
||||||
|
inkscape:window-y="149"
|
||||||
|
inkscape:window-maximized="0"
|
||||||
|
inkscape:current-layer="g6" /><g
|
||||||
|
id="product_logo" /><g
|
||||||
|
id="guides" /><g
|
||||||
|
id="LEGO_LOGO_SMALL_RGB"><g
|
||||||
|
id="g6"><path
|
||||||
|
d="m 0.961,0.948 0,139.839 139.84,0 0,-139.839 -139.84,0 z"
|
||||||
|
id="path8"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#ffffff" /><path
|
||||||
|
d="m 0.961,0.948 0,139.839 139.84,0 0,-139.839 -139.84,0 z m 130.536,58.127 c -0.23,4.356 -1.617,9.786 -2.839,13.414 -4.917,14.609 -10.618,23.666 -23.821,23.666 -3.887,0 -10.783,-1.031 -13.324,-7.947 l -0.602,-1.641 -1.082,1.371 C 85.7,93.168 79.564,96.186 72.998,96.217 67.96,96.24 63.912,94.553 61.293,91.334 l -0.718,-0.883 -0.765,0.844 c -2.797,3.088 -7.668,4.859 -13.364,4.859 -4.473,0 -8.335,-1.521 -10.876,-4.277 l -0.692,-0.752 -0.72,0.727 c -2.825,2.852 -7.276,4.289 -12.873,4.158 -6.79,-0.162 -10.924,-3.951 -11.058,-10.141 -0.205,-9.543 9.031,-29.622 12.854,-35.727 2.482,-4.078 5.895,-6.055 10.438,-6.055 3.092,0 5.207,0.646 6.463,1.977 1.144,1.211 1.37,2.232 1.472,4.688 l 0.131,3.175 1.676,-2.7 c 4.054,-6.532 10.773,-7.434 17.43,-7.434 4.628,0 8.667,1.702 10.289,4.336 l 0.599,0.971 0.866,-0.737 c 3.431,-2.916 8.271,-4.521 13.629,-4.521 5.849,0 10.099,1.454 12.634,4.322 0.576,0.651 0.957,1.106 1.486,2.219 l 0.651,1.366 0.977,-1.155 c 3.712,-4.39 8.779,-6.615 15.067,-6.615 4.98,0 8.761,1.324 11.235,3.935 3.104,3.271 3.547,7.875 3.373,11.161 z"
|
||||||
|
id="path10"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#f6ec36" /><path
|
||||||
|
d="m 0.961,0.948 0,139.839 139.84,0 0,-139.839 -139.84,0 z M 135.435,64.44 c -0.633,5.089 -4.072,14.518 -5.899,18.286 -4.903,10.102 -11.453,17.863 -24.074,17.863 -6.742,0 -12.288,-2.15 -15.531,-6.283 -4.749,4.162 -10.627,6.342 -16.956,6.342 -4.876,0 -9.185,-1.408 -12.471,-4.012 -3.626,2.555 -8.52,3.98 -13.943,3.98 -4.53,0 -8.606,-1.244 -11.796,-3.543 -3.529,2.342 -8.154,3.506 -13.583,3.377 C 12.149,100.237 5.912,94.507 5.733,86.188 5.497,75.137 14.803,54.911 19.189,47.907 c 3.282,-5.392 8.292,-8.293 14.431,-8.293 6.663,0 9.078,1.903 10.267,4.326 5.141,-4.366 11.956,-4.617 16.808,-4.617 5.356,0 8.717,1.422 11.575,3.697 3.948,-2.368 8.477,-3.599 13.871,-3.599 6.897,0 12.021,1.604 15.595,5.137 4.168,-3.469 9.388,-5.05 15.23,-5.05 7.725,0 12.808,2.786 15.793,6.94 4.203,5.859 3.451,11.757 2.676,17.992 z"
|
||||||
|
id="path12"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:#d01012" /><path
|
||||||
|
d="m 0,0 0,141.731 141.73,0 L 141.73,0 0,0 Z m 139.781,1.952 0,137.832 -137.83,0 0,-137.832 137.83,0 z"
|
||||||
|
id="path14"
|
||||||
|
inkscape:connector-curvature="0" /><path
|
||||||
|
d="m 134.752,42.53 0,-0.965 0.655,0 c 0.479,0 0.728,0.168 0.728,0.479 0,0.247 -0.16,0.486 -0.647,0.486 l -0.736,0 z m 2.351,2.002 -0.408,-0.708 c -0.354,-0.619 -0.452,-0.717 -0.755,-0.823 l 0,-0.019 c 0.596,-0.07 0.95,-0.453 0.95,-0.983 0,-0.56 -0.354,-0.984 -1.109,-0.984 l -1.754,0 0,3.519 0.727,0 0,-1.441 0.133,0 c 0.311,0 0.435,0.035 0.576,0.176 0.142,0.144 0.354,0.443 0.479,0.69 l 0.284,0.575 0.877,-0.002 0,0 z m -1.731,-4.497 c 1.51,0 2.737,1.218 2.737,2.726 0,1.508 -1.229,2.731 -2.737,2.731 -1.506,0 -2.72,-1.225 -2.72,-2.731 0,-1.506 1.214,-2.726 2.72,-2.726 z m 0,-0.67 c -1.877,0 -3.392,1.516 -3.392,3.396 0,1.879 1.515,3.394 3.392,3.394 1.883,0 3.397,-1.515 3.397,-3.394 0.002,-1.882 -1.514,-3.396 -3.397,-3.396 z"
|
||||||
|
id="path16"
|
||||||
|
inkscape:connector-curvature="0" /><path
|
||||||
|
d="m 116.889,43.002 c -7.325,0 -12.386,2.904 -15.812,6.961 -0.579,-1.214 -1.019,-1.746 -1.638,-2.447 -2.805,-3.17 -7.313,-4.649 -13.364,-4.649 -5.912,0 -10.841,1.846 -14.263,4.754 -1.777,-2.89 -6.013,-4.803 -11.121,-4.803 -6.674,0 -13.946,0.944 -18.261,7.896 -0.104,-2.503 -0.33,-3.828 -1.737,-5.317 -1.71,-1.81 -4.477,-2.282 -7.173,-2.282 -4.912,0 -8.605,2.146 -11.266,6.515 -3.859,6.163 -13.212,26.441 -13.001,36.263 0.137,6.344 4.393,10.916 12.01,11.096 5.952,0.143 10.62,-1.449 13.59,-4.447 2.665,2.896 6.731,4.594 11.596,4.594 5.417,0 10.868,-1.627 14.088,-5.182 2.712,3.332 6.979,5.271 12.468,5.244 7.175,-0.035 13.477,-3.438 17.593,-8.652 2.259,6.148 7.985,8.59 14.241,8.59 13.709,0 19.729,-9.428 24.748,-24.332 1.13,-3.357 2.639,-8.963 2.889,-13.672 0.413,-7.839 -2.903,-16.13 -15.587,-16.13 z M 25.672,80.477 c 7.093,-1.232 8.876,1.332 8.653,3.707 -0.669,7.109 -7.191,8.699 -12.854,8.566 -4.107,-0.1 -7.8,-1.98 -7.903,-6.748 -0.18,-8.342 8.328,-27.641 12.333,-34.038 1.85,-3.037 4.104,-4.539 7.698,-4.539 3.406,0 4.25,1.749 4.2,3.844 -0.134,5.589 -9.164,22.574 -12.127,29.208 z M 48.77,73.925 c -0.469,1.27 -1.357,3.93 -2.076,6.75 2.328,-0.582 4.074,-0.986 7.065,-0.914 3.408,0.084 5.586,1.496 5.586,4.314 0,6.832 -7.551,8.838 -12.789,8.838 -5.751,0 -10.803,-3.275 -10.803,-9.564 0,-7.373 3.997,-18.553 7.748,-26.001 4.606,-9.146 9.312,-10.362 17.419,-10.362 3.562,0 7.667,1.524 7.667,4.888 0,4.662 -3.95,6.44 -7.866,6.665 -1.672,0.096 -4.246,0.188 -5.786,0.079 0,0 -1.303,1.985 -2.688,5.523 7.252,-1.021 10.327,0.625 9.103,4.82 -1.657,5.667 -6.567,6.04 -12.58,4.964 z M 84.438,56.293 c -1.961,0 -3.244,1.242 -4.198,2.583 -2.102,2.952 -6.656,14.781 -7.365,19.64 -0.486,3.328 0.951,4.006 2.522,4.006 2.52,0 5.345,-2.666 6.309,-7.064 0,0 -4.797,-0.117 -3.475,-4.371 1.285,-4.128 3.723,-5.022 7.764,-5.188 7.961,-0.325 7.175,5.553 6.538,8.688 -2.069,10.18 -9.314,18.355 -19.562,18.355 -7.016,0 -11.371,-3.881 -11.371,-11.035 0,-5.098 2.529,-13.101 4.534,-17.784 4.267,-9.968 8.742,-16.944 20.143,-16.944 6.84,0 12.235,2.458 11.444,8.866 -0.58,4.703 -2.934,7.465 -7.21,7.799 -1.196,0.093 -6.089,-0.031 -4.466,-4.66 0.565,-1.619 0.799,-2.891 -1.607,-2.891 z m 43.057,8.413 c -1.205,6.002 -3.916,13.101 -6.859,18.392 -4.801,8.633 -10.633,9.842 -15.723,9.781 -5.093,-0.061 -10.83,-1.941 -10.874,-9.795 -0.031,-5.639 2.401,-13.598 4.466,-18.815 3.599,-9.458 7.277,-17.17 18.904,-17.031 13.559,0.161 11.141,12.219 10.086,17.468 z M 115.993,56.49 c -1.164,-0.016 -2.18,0.212 -3.093,1.62 -2.051,2.657 -8.047,19.042 -7.941,22.31 0.038,1.174 0.687,2.201 2.133,2.201 1.659,0.002 2.581,-1.145 3.396,-2.529 1.887,-3.193 7.193,-17.676 7.339,-21.297 0.043,-1.055 -0.133,-2.284 -1.834,-2.305 z"
|
||||||
|
id="path18"
|
||||||
|
inkscape:connector-curvature="0" /></g></g></svg>
|
After Width: | Height: | Size: 7.7 KiB |
BIN
docs/static/lego_education_logo.png
vendored
Normal file
BIN
docs/static/lego_education_logo.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.1 KiB |
@ -122,6 +122,8 @@
|
|||||||
"loops.forever": "Repeats the code forever in the background. On each iteration, allows other codes to run.",
|
"loops.forever": "Repeats the code forever in the background. On each iteration, allows other codes to run.",
|
||||||
"loops.pause": "Pause for the specified time in milliseconds",
|
"loops.pause": "Pause for the specified time in milliseconds",
|
||||||
"loops.pause|param|ms": "how long to pause for, eg: 100, 200, 500, 1000, 2000",
|
"loops.pause|param|ms": "how long to pause for, eg: 100, 200, 500, 1000, 2000",
|
||||||
|
"loops.timePicker": "Get the time field editor",
|
||||||
|
"loops.timePicker|param|ms": "time duration in milliseconds, eg: 500, 1000",
|
||||||
"serial": "Reading and writing data over a serial connection.",
|
"serial": "Reading and writing data over a serial connection.",
|
||||||
"serial.writeBuffer": "Send a buffer across the serial connection.",
|
"serial.writeBuffer": "Send a buffer across the serial connection.",
|
||||||
"serial.writeLine": "Write a line of text to the serial port.",
|
"serial.writeLine": "Write a line of text to the serial port.",
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
"Array.unshift|block": "%list| insert %value| at beginning",
|
"Array.unshift|block": "%list| insert %value| at beginning",
|
||||||
"Array|block": "Array",
|
"Array|block": "Array",
|
||||||
"Math.constrain|block": "constrain %value|between %low|and %high",
|
"Math.constrain|block": "constrain %value|between %low|and %high",
|
||||||
"Math.map|block": "map %value|from %fromLow|%fromHigh|to %toLow|%toHigh",
|
"Math.map|block": "map %value|from low %fromLow|from high %fromHigh|to low %toLow|to high %toHigh",
|
||||||
"Math.randomRange|block": "pick random %min|to %limit",
|
"Math.randomRange|block": "pick random %min|to %limit",
|
||||||
"Math|block": "Math",
|
"Math|block": "Math",
|
||||||
"String.charAt|block": "char from %this=text|at %pos",
|
"String.charAt|block": "char from %this=text|at %pos",
|
||||||
@ -30,7 +30,8 @@
|
|||||||
"control.waitMicros|block": "wait (µs)%micros",
|
"control.waitMicros|block": "wait (µs)%micros",
|
||||||
"control|block": "control",
|
"control|block": "control",
|
||||||
"loops.forever|block": "forever",
|
"loops.forever|block": "forever",
|
||||||
"loops.pause|block": "pause (ms) %pause",
|
"loops.pause|block": "pause %ms=timePicker|ms",
|
||||||
|
"loops.timePicker|block": "%ms",
|
||||||
"loops|block": "loops",
|
"loops|block": "loops",
|
||||||
"serial.writeBuffer|block": "serial|write buffer %buffer",
|
"serial.writeBuffer|block": "serial|write buffer %buffer",
|
||||||
"serial.writeLine|block": "serial|write line %text",
|
"serial.writeLine|block": "serial|write line %text",
|
||||||
|
4
libs/base/shims.d.ts
vendored
4
libs/base/shims.d.ts
vendored
@ -79,7 +79,7 @@ declare namespace loops {
|
|||||||
* @param ms how long to pause for, eg: 100, 200, 500, 1000, 2000
|
* @param ms how long to pause for, eg: 100, 200, 500, 1000, 2000
|
||||||
*/
|
*/
|
||||||
//% help=loops/pause weight=99
|
//% help=loops/pause weight=99
|
||||||
//% async block="pause (ms) %pause"
|
//% async block="pause %ms=timePicker|ms"
|
||||||
//% blockId=device_pause shim=loops::pause
|
//% blockId=device_pause shim=loops::pause
|
||||||
function pause(ms: int32): void;
|
function pause(ms: int32): void;
|
||||||
}
|
}
|
||||||
@ -151,7 +151,7 @@ declare namespace serial {
|
|||||||
/**
|
/**
|
||||||
* Send a buffer across the serial connection.
|
* Send a buffer across the serial connection.
|
||||||
*/
|
*/
|
||||||
//% help=serial/write-buffer advanced=true weight=6
|
//% help=serial/write-buffer weight=6
|
||||||
//% blockId=serial_writebuffer block="serial|write buffer %buffer" shim=serial::writeBuffer
|
//% blockId=serial_writebuffer block="serial|write buffer %buffer" shim=serial::writeBuffer
|
||||||
function writeBuffer(buffer: Buffer): void;
|
function writeBuffer(buffer: Buffer): void;
|
||||||
}
|
}
|
||||||
|
@ -84,16 +84,15 @@ namespace input {
|
|||||||
* Check if button is currently pressed or not.
|
* Check if button is currently pressed or not.
|
||||||
* @param button the button to query the request
|
* @param button the button to query the request
|
||||||
*/
|
*/
|
||||||
//% help=input/button/is-pressed weight=79
|
//% help=input/button/is-pressed
|
||||||
//% block="%button|is pressed"
|
//% block="%button|is pressed"
|
||||||
//% blockId=buttonIsPressed
|
//% blockId=buttonIsPressed
|
||||||
//% blockGap=8
|
|
||||||
//% parts="buttonpair"
|
//% parts="buttonpair"
|
||||||
//% blockNamespace=input
|
//% blockNamespace=input
|
||||||
//% group="Brick buttons"
|
|
||||||
//% button.fieldEditor="gridpicker"
|
//% button.fieldEditor="gridpicker"
|
||||||
//% button.fieldOptions.width=220
|
//% button.fieldOptions.width=220
|
||||||
//% button.fieldOptions.columns=3
|
//% button.fieldOptions.columns=3
|
||||||
|
//% weight=81 blockGap=8
|
||||||
isPressed() {
|
isPressed() {
|
||||||
return this._isPressed
|
return this._isPressed
|
||||||
}
|
}
|
||||||
@ -102,15 +101,15 @@ namespace input {
|
|||||||
* See if the button was pressed again since the last time you checked.
|
* See if the button was pressed again since the last time you checked.
|
||||||
* @param button the button to query the request
|
* @param button the button to query the request
|
||||||
*/
|
*/
|
||||||
//% help=input/button/was-pressed weight=78
|
//% help=input/button/was-pressed
|
||||||
//% block="%button|was pressed"
|
//% block="%button|was pressed"
|
||||||
//% blockId=buttonWasPressed
|
//% blockId=buttonWasPressed
|
||||||
//% parts="buttonpair" blockGap=8
|
//% parts="buttonpair"
|
||||||
//% blockNamespace=input advanced=true
|
//% blockNamespace=input
|
||||||
//% group="Brick buttons"
|
|
||||||
//% button.fieldEditor="gridpicker"
|
//% button.fieldEditor="gridpicker"
|
||||||
//% button.fieldOptions.width=220
|
//% button.fieldOptions.width=220
|
||||||
//% button.fieldOptions.columns=3
|
//% button.fieldOptions.columns=3
|
||||||
|
//% weight=80 blockGap=8
|
||||||
wasPressed() {
|
wasPressed() {
|
||||||
const r = this._wasPressed
|
const r = this._wasPressed
|
||||||
this._wasPressed = false
|
this._wasPressed = false
|
||||||
@ -123,14 +122,15 @@ namespace input {
|
|||||||
* @param event the kind of button gesture that needs to be detected
|
* @param event the kind of button gesture that needs to be detected
|
||||||
* @param body code to run when the event is raised
|
* @param body code to run when the event is raised
|
||||||
*/
|
*/
|
||||||
//% help=input/button/on-event weight=99 blockGap=8
|
//% help=input/button/on-event
|
||||||
//% blockId=buttonEvent block="on %button|%event"
|
//% blockId=buttonEvent block="on %button|%event"
|
||||||
//% parts="buttonpair"
|
//% parts="buttonpair"
|
||||||
//% blockNamespace=input
|
//% blockNamespace=input
|
||||||
//% group="Brick buttons"
|
//% group="Buttons"
|
||||||
//% button.fieldEditor="gridpicker"
|
//% button.fieldEditor="gridpicker"
|
||||||
//% button.fieldOptions.width=220
|
//% button.fieldOptions.width=220
|
||||||
//% button.fieldOptions.columns=3
|
//% button.fieldOptions.columns=3
|
||||||
|
//% weight=99
|
||||||
onEvent(ev: ButtonEvent, body: () => void) {
|
onEvent(ev: ButtonEvent, body: () => void) {
|
||||||
control.onEvent(this._id, ev, body)
|
control.onEvent(this._id, ev, body)
|
||||||
}
|
}
|
||||||
|
@ -21,6 +21,7 @@ const enum ColorSensorColor {
|
|||||||
|
|
||||||
namespace input {
|
namespace input {
|
||||||
|
|
||||||
|
//% fixedInstances
|
||||||
export class ColorSensor extends internal.UartSensor {
|
export class ColorSensor extends internal.UartSensor {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super()
|
||||||
@ -34,22 +35,52 @@ namespace input {
|
|||||||
this._setMode(m)
|
this._setMode(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get current ambient light value from the color sensor.
|
||||||
|
* @param color the color sensor to query the request
|
||||||
|
*/
|
||||||
|
//% help=input/color/ambient-light
|
||||||
|
//% block="%color| ambient light"
|
||||||
|
//% blockId=colorGetAmbient
|
||||||
|
//% parts="colorsensor"
|
||||||
|
//% blockNamespace=input
|
||||||
|
//% weight=65 blockGap=8
|
||||||
getAmbientLight() {
|
getAmbientLight() {
|
||||||
this.setMode(ColorSensorMode.Ambient)
|
this.setMode(ColorSensorMode.Ambient)
|
||||||
return this.getNumber(NumberFormat.UInt8LE, 0)
|
return this.getNumber(NumberFormat.UInt8LE, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
getReflectedLight() {
|
/**
|
||||||
|
* Get current reflected light value from the color sensor.
|
||||||
|
* @param color the color sensor to query the request
|
||||||
|
*/
|
||||||
|
//% help=input/color/refelected-light
|
||||||
|
//% block="%color| reflected light"
|
||||||
|
//% blockId=colorGetReflected
|
||||||
|
//% parts="colorsensor"
|
||||||
|
//% blockNamespace=input
|
||||||
|
//% weight=64 blockGap=8
|
||||||
|
getReflectedLight(): number {
|
||||||
this.setMode(ColorSensorMode.Reflect)
|
this.setMode(ColorSensorMode.Reflect)
|
||||||
return this.getNumber(NumberFormat.UInt8LE, 0)
|
return this.getNumber(NumberFormat.UInt8LE, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current color from the color sensor.
|
||||||
|
* @param color the color sensor to query the request
|
||||||
|
*/
|
||||||
|
//% help=input/color/color
|
||||||
|
//% block="%color| color"
|
||||||
|
//% blockId=colorGetColor
|
||||||
|
//% parts="colorsensor"
|
||||||
|
//% blockNamespace=input
|
||||||
|
//% weight=66 blockGap=8
|
||||||
getColor(): ColorSensorColor {
|
getColor(): ColorSensorColor {
|
||||||
this.setMode(ColorSensorMode.Color)
|
this.setMode(ColorSensorMode.Color)
|
||||||
return this.getNumber(NumberFormat.UInt8LE, 0)
|
return this.getNumber(NumberFormat.UInt8LE, 0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//% whenUsed
|
//% whenUsed block="color sensor" weight=95 fixedInstance
|
||||||
export const color: ColorSensor = new ColorSensor()
|
export const color: ColorSensor = new ColorSensor()
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
namespace input {
|
namespace input {
|
||||||
|
|
||||||
|
//% fixedInstances
|
||||||
export class TouchSensor extends internal.AnalogSensor {
|
export class TouchSensor extends internal.AnalogSensor {
|
||||||
button: Button;
|
button: Button;
|
||||||
|
|
||||||
@ -23,6 +25,6 @@ namespace input {
|
|||||||
//% whenUsed
|
//% whenUsed
|
||||||
export const touchSensorImpl: TouchSensor = new TouchSensor()
|
export const touchSensorImpl: TouchSensor = new TouchSensor()
|
||||||
|
|
||||||
//% whenUsed
|
//% whenUsed block="touch sensor" weight=95 fixedInstance
|
||||||
export const touchSensor: Button = touchSensorImpl.button
|
export const touchSensor: Button = touchSensorImpl.button
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
|
|
||||||
//% color="#D42878"
|
//% color="#D42878"
|
||||||
//% groups='["Brick buttons"]'
|
|
||||||
namespace input {
|
namespace input {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,14 +29,14 @@
|
|||||||
"Sounds.Siren|block": "siren",
|
"Sounds.Siren|block": "siren",
|
||||||
"Sounds.Wawawawaa|block": "wawawawaa",
|
"Sounds.Wawawawaa|block": "wawawawaa",
|
||||||
"music.beat|block": "%fraction|beat",
|
"music.beat|block": "%fraction|beat",
|
||||||
"music.changeTempoBy|block": "change tempo by (bpm)|%value",
|
"music.changeTempoBy|block": "change tempo by %value|(bpm)",
|
||||||
"music.noteFrequency|block": "%note",
|
"music.noteFrequency|block": "%note",
|
||||||
"music.playSoundUntilDone|block": "play sound %sound=music_sounds|until done",
|
"music.playSoundUntilDone|block": "play sound %sound=music_sounds|until done",
|
||||||
"music.playSound|block": "play sound %sound=music_sounds",
|
"music.playSound|block": "play sound %sound=music_sounds",
|
||||||
"music.playTone|block": "play tone|at %note=device_note|for %duration=device_beat",
|
"music.playTone|block": "play tone|at %note=device_note|for %duration=device_beat",
|
||||||
"music.rest|block": "rest|for %duration=device_beat",
|
"music.rest|block": "rest|for %duration=device_beat",
|
||||||
"music.ringTone|block": "ring tone|at %note=device_note",
|
"music.ringTone|block": "ring tone|at %note=device_note",
|
||||||
"music.setTempo|block": "set tempo to (bpm)|%value",
|
"music.setTempo|block": "set tempo to %value|(bpm)",
|
||||||
"music.setVolume|block": "set volume %volume",
|
"music.setVolume|block": "set volume %volume",
|
||||||
"music.sounds|block": "%name",
|
"music.sounds|block": "%name",
|
||||||
"music.stopAllSounds|block": "stop all sounds",
|
"music.stopAllSounds|block": "stop all sounds",
|
||||||
|
@ -67,10 +67,11 @@ static void _playTone(uint16_t frequency, uint16_t duration, uint8_t volume)
|
|||||||
* @param frequency pitch of the tone to play in Hertz (Hz)
|
* @param frequency pitch of the tone to play in Hertz (Hz)
|
||||||
* @param ms tone duration in milliseconds (ms)
|
* @param ms tone duration in milliseconds (ms)
|
||||||
*/
|
*/
|
||||||
//% help=music/play-tone weight=90
|
//% help=music/play-tone
|
||||||
//% blockId=music_play_note block="play tone|at %note=device_note|for %duration=device_beat"
|
//% blockId=music_play_note block="play tone|at %note=device_note|for %duration=device_beat"
|
||||||
//% parts="headphone" async blockGap=8
|
//% parts="headphone" async
|
||||||
//% blockNamespace=music
|
//% blockNamespace=music
|
||||||
|
//% weight=76 blockGap=8
|
||||||
void playTone(int frequency, int ms) {
|
void playTone(int frequency, int ms) {
|
||||||
if (frequency <= 0) {
|
if (frequency <= 0) {
|
||||||
_stopSound();
|
_stopSound();
|
||||||
|
7
libs/music/shims.d.ts
vendored
7
libs/music/shims.d.ts
vendored
@ -18,10 +18,11 @@ declare namespace music {
|
|||||||
* @param frequency pitch of the tone to play in Hertz (Hz)
|
* @param frequency pitch of the tone to play in Hertz (Hz)
|
||||||
* @param ms tone duration in milliseconds (ms)
|
* @param ms tone duration in milliseconds (ms)
|
||||||
*/
|
*/
|
||||||
//% help=music/play-tone weight=90
|
//% help=music/play-tone
|
||||||
//% blockId=music_play_note block="play tone|at %note=device_note|for %duration=device_beat"
|
//% blockId=music_play_note block="play tone|at %note=device_note|for %duration=device_beat"
|
||||||
//% parts="headphone" async blockGap=8
|
//% parts="headphone" async
|
||||||
//% blockNamespace=music shim=music::playTone
|
//% blockNamespace=music
|
||||||
|
//% weight=76 blockGap=8 shim=music::playTone
|
||||||
function playTone(frequency: int32, ms: int32): void;
|
function playTone(frequency: int32, ms: int32): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,10 +68,10 @@
|
|||||||
"appTheme": {
|
"appTheme": {
|
||||||
"accentColor": "#0089BF",
|
"accentColor": "#0089BF",
|
||||||
"logoUrl": "https://lego.makecode.com",
|
"logoUrl": "https://lego.makecode.com",
|
||||||
"logo": "./static/logo.svg",
|
"logo": "./static/lego_education_logo.png",
|
||||||
"docsLogo": "./static/logo.square.svg",
|
"docsLogo": "./static/lego-logo.svg",
|
||||||
"portraitLogo": "./static/logo.square.svg",
|
"portraitLogo": "./static/lego-logo.svg",
|
||||||
"footerLogo": "./static/logo.square.svg",
|
"footerLogo": "./static/lego-logo.svg",
|
||||||
"cardLogo": "./static/icons/android-chrome-192x192.png",
|
"cardLogo": "./static/icons/android-chrome-192x192.png",
|
||||||
"appLogo": "./static/icons/android-chrome-192x192.png",
|
"appLogo": "./static/icons/android-chrome-192x192.png",
|
||||||
"organization": "Microsoft MakeCode",
|
"organization": "Microsoft MakeCode",
|
||||||
@ -111,9 +111,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"galleries": {
|
"galleries": {
|
||||||
"Make": "projects",
|
|
||||||
"Examples": "examples"
|
|
||||||
},
|
},
|
||||||
|
"useStartPage": true,
|
||||||
"sideDoc": "tutorials/getting-started",
|
"sideDoc": "tutorials/getting-started",
|
||||||
"invertedMenu": false,
|
"invertedMenu": false,
|
||||||
"invertedMonaco": false,
|
"invertedMonaco": false,
|
||||||
|
@ -62,11 +62,12 @@ namespace pxsim {
|
|||||||
this.builtinParts["buttons"] = this.buttonState = new EV3ButtonState();
|
this.builtinParts["buttons"] = this.buttonState = new EV3ButtonState();
|
||||||
this.builtinParts["light"] = this.lightState = new EV3LightState();
|
this.builtinParts["light"] = this.lightState = new EV3LightState();
|
||||||
this.builtinParts["screen"] = this.screenState = new EV3ScreenState();
|
this.builtinParts["screen"] = this.screenState = new EV3ScreenState();
|
||||||
|
this.builtinParts["audio"] = this.audioState = new AudioState();
|
||||||
|
|
||||||
/*this.builtinParts["neopixel"] = this.neopixelState = new CommonNeoPixelState();
|
/*this.builtinParts["neopixel"] = this.neopixelState = new CommonNeoPixelState();
|
||||||
this.builtinParts["buttonpair"] = this.buttonState = new CommonButtonState();
|
this.builtinParts["buttonpair"] = this.buttonState = new CommonButtonState();
|
||||||
|
|
||||||
this.builtinParts["switch"] = this.slideSwitchState = new SlideSwitchState();
|
this.builtinParts["switch"] = this.slideSwitchState = new SlideSwitchState();
|
||||||
this.builtinParts["audio"] = this.audioState = new AudioState();
|
|
||||||
this.builtinParts["lightsensor"] = this.lightSensorState = new AnalogSensorState(DAL.DEVICE_ID_LIGHT_SENSOR, 0, 255);
|
this.builtinParts["lightsensor"] = this.lightSensorState = new AnalogSensorState(DAL.DEVICE_ID_LIGHT_SENSOR, 0, 255);
|
||||||
this.builtinParts["thermometer"] = this.thermometerState = new AnalogSensorState(DAL.DEVICE_ID_THERMOMETER, -5, 50);
|
this.builtinParts["thermometer"] = this.thermometerState = new AnalogSensorState(DAL.DEVICE_ID_THERMOMETER, -5, 50);
|
||||||
this.builtinParts["soundsensor"] = this.microphoneState = new AnalogSensorState(DAL.DEVICE_ID_TOUCH_SENSOR + 1, 0, 255);
|
this.builtinParts["soundsensor"] = this.microphoneState = new AnalogSensorState(DAL.DEVICE_ID_TOUCH_SENSOR + 1, 0, 255);
|
||||||
|
@ -34,13 +34,6 @@ span.blocklyTreeLabel {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.blocklyFlyoutBackground {
|
|
||||||
fill: #282828 !important;
|
|
||||||
}
|
|
||||||
.monacoFlyout {
|
|
||||||
background: rgba(40, 40, 40, 0.9);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Search box */
|
/* Search box */
|
||||||
#blocklySearchArea {
|
#blocklySearchArea {
|
||||||
margin: 0.5rem;
|
margin: 0.5rem;
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
/* Lego colors */
|
/* Lego colors */
|
||||||
@red: @brightRed;
|
@red: @brightRed;
|
||||||
@blue: #008ad2;
|
@blue: #00a5c8; /*#008ad2;*/
|
||||||
@yellow: #fccd00;
|
@yellow: #fccd00;
|
||||||
@orange: #fa7f2a;
|
@orange: #fa7f2a;
|
||||||
@green: @brightYellowishGreen;
|
@green: @brightYellowishGreen;
|
||||||
@ -96,9 +96,11 @@
|
|||||||
Menu
|
Menu
|
||||||
--------------------*/
|
--------------------*/
|
||||||
|
|
||||||
|
@mainMenuBackground: #f4f7f9;
|
||||||
@mainMenuInvertedBackground: @yellow;
|
@mainMenuInvertedBackground: @yellow;
|
||||||
@mainMenuTutorialBackground: @orange;
|
@mainMenuTutorialBackground: @orange;
|
||||||
|
|
||||||
|
|
||||||
@tutorialSelectedMenuColor: @blue;
|
@tutorialSelectedMenuColor: @blue;
|
||||||
|
|
||||||
/*-------------------
|
/*-------------------
|
||||||
@ -117,6 +119,8 @@
|
|||||||
@editorToolsBackground: #fcfbfa;
|
@editorToolsBackground: #fcfbfa;
|
||||||
@blocklySvgColor: #ecf6ff;
|
@blocklySvgColor: #ecf6ff;
|
||||||
|
|
||||||
|
@homeScreenBackground: #f4f7f9;
|
||||||
|
|
||||||
/*-------------------
|
/*-------------------
|
||||||
Full screen
|
Full screen
|
||||||
--------------------*/
|
--------------------*/
|
||||||
@ -152,3 +156,13 @@
|
|||||||
@blocklyRowHeightComputer: 50px;
|
@blocklyRowHeightComputer: 50px;
|
||||||
@blocklyRowHeightTablet: 50px;
|
@blocklyRowHeightTablet: 50px;
|
||||||
@blocklyRowHeightMobile: 50px;
|
@blocklyRowHeightMobile: 50px;
|
||||||
|
|
||||||
|
|
||||||
|
/*-------------------
|
||||||
|
Flyout
|
||||||
|
--------------------*/
|
||||||
|
|
||||||
|
@flyoutLabelColor: white;
|
||||||
|
@blocklyFlyoutColor: #282828;
|
||||||
|
@blocklyFlyoutColorOpacity: 0.9;
|
||||||
|
@monacoFlyoutColor: rgba(40, 40, 40,0.9);
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
/* Menu bar colors */
|
/* Menu bar colors */
|
||||||
#menubar .ui.item {
|
#menubar .ui.item {
|
||||||
color: @red;
|
color: #373737;
|
||||||
}
|
}
|
||||||
.fullscreensim #menubar .ui.menu {
|
.fullscreensim #menubar .ui.menu {
|
||||||
box-shadow: none !important;
|
box-shadow: none !important;
|
||||||
@ -59,11 +59,17 @@
|
|||||||
/* Editor menu toggle */
|
/* Editor menu toggle */
|
||||||
#menubar .ui.menu.fixed .item.editor-menuitem .ui.grid {
|
#menubar .ui.menu.fixed .item.editor-menuitem .ui.grid {
|
||||||
background: @blue !important;
|
background: @blue !important;
|
||||||
|
border-radius: 0px !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#menubar .ui.menu.fixed .ui.item.editor-menuitem .item:not(.active) {
|
#menubar .ui.menu.fixed .ui.item.editor-menuitem .item:not(.active) {
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
#menubar .ui.menu.fixed .ui.item.editor-menuitem .item {
|
||||||
|
border-radius: 0px !important;
|
||||||
|
}
|
||||||
|
#menubar .ui.menu.fixed .ui.item.editor-menuitem .item.active {
|
||||||
|
color: @blue;
|
||||||
|
}
|
||||||
|
|
||||||
.sandboxfooter a:not(.thin) {
|
.sandboxfooter a:not(.thin) {
|
||||||
color:white !important;
|
color:white !important;
|
||||||
|
Loading…
Reference in New Issue
Block a user