Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
491c5faaf6 | ||
|
|
8179e38e41 | ||
|
|
5a8a5f82c9 | ||
|
|
c43088c099 | ||
|
|
816d738390 | ||
|
|
3e133aa66e | ||
|
|
a471c2cb1a | ||
|
|
a5826540fa | ||
|
|
1768881719 | ||
|
|
365c95b33d | ||
|
|
d05fa9f4cb | ||
|
|
acb0c66e85 | ||
|
|
a705b74fab | ||
|
|
85d406661a | ||
|
|
8fa190b209 | ||
|
|
664b841b1c | ||
|
|
715de4dff9 | ||
|
|
514e7cf1db | ||
|
|
c9f927b0bf | ||
|
|
0802b509c4 | ||
|
|
383bdc491d | ||
|
|
ffbbf56c1c | ||
|
|
718ec896ab |
@@ -2,8 +2,6 @@ language: node_js
|
|||||||
node_js:
|
node_js:
|
||||||
- "5.7.0"
|
- "5.7.0"
|
||||||
script:
|
script:
|
||||||
- "npm update"
|
|
||||||
- "node node_modules/kindscript/built/kind.js buildtarget"
|
|
||||||
- "node node_modules/kindscript/built/kind.js travis"
|
- "node node_modules/kindscript/built/kind.js travis"
|
||||||
- "node node_modules/kindscript/built/kind.js uploaddoc"
|
- "node node_modules/kindscript/built/kind.js uploaddoc"
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
# About
|
# About
|
||||||
|
|
||||||
The [BBC micro:bit](https://www.microbit.co.uk) is a [pocket-size computer](/device) with 25 LEDs, Bluetooth and sensors that can be programmed by anyone.
|
The [BBC micro:bit](https://www.microbit.co.uk) is a [pocket-size computer](/device) with a 5x5 display of 25 LEDs, Bluetooth and sensors that can be programmed by anyone.
|
||||||
The BBC micro:bit was made possible by [a number of partners!](https://www.microbit.co.uk/partners)
|
The BBC micro:bit was made possible by many [partners](https://www.microbit.co.uk/partners).
|
||||||
|
|
||||||
The micro:bit provides a fun introduction to programming and making – switch on, program it to do something fun – wear it, customize it.
|
The micro:bit provides a fun introduction to programming and making – switch on, program it to do something fun – wear it, customize it.
|
||||||
Just like Arduino, the micro:bit can be connected to and interact with sensors, displays, and other devices.
|
Just like Arduino, the micro:bit can be connected to and interact with sensors, displays, and other devices.
|
||||||
|
|
||||||
## Block Editor or JavaScript
|
## Blocks or JavaScript
|
||||||
|
|
||||||
The student can program the BBC micro:bit using a Block Editor or JavaScript.
|
The student can program the BBC micro:bit using [visual blocks](http://www.github.com/Google/blockly) or JavaScript.
|
||||||
|
|
||||||
```blocks
|
```blocks
|
||||||
basic.showString("BBC micro:bit!");
|
basic.showString("BBC micro:bit!");
|
||||||
@@ -46,16 +46,9 @@ input.onGesture(Gesture.Shake, () => {
|
|||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
To run a student's project in the web browser, KindScript compiles it into JavaScript, the scripting language built into all web browsers.
|
|
||||||
|
|
||||||
C++ and Touch Develop Libraries
|
|
||||||
The C++ micro:bit library, created at Lancaster University, provides access to the hardware functions of the micro:bit, as well as a set of helper functions (such as displaying a number/image/string on the LED screen). The Touch Develop micro:bit library mirrors the functions of the C++ library. When a Touch Develop script is compiled to C++, the calls to Touch Develop micro:bit functions are replaced with calls to the corresponding C++ functions.
|
|
||||||
|
|
||||||
Above, see the mapping from the Touch Develop "show number" function to its corresponding the C++ function.
|
|
||||||
|
|
||||||
## C++ Runtime
|
## C++ Runtime
|
||||||
|
|
||||||
The C++ BBC micro:bit library, created at [Lancaster University](http://www.lancaster.ac.uk/), provides access to the hardware functions of the micro:bit,
|
The C++ BBC micro:bit library, created at [Lancaster University](http://www.lancaster.ac.uk/), provides access to the hardware functions of the micro:bit,
|
||||||
as well as a set of helper functions (such as displaying a number/image/string on the LED screen).
|
as well as a set of helper functions (such as displaying a number/image/string on the LED screen).
|
||||||
The JavaScript micro:bit library mirrors the functions of the C++ library.
|
The JavaScript micro:bit library mirrors the functions of the C++ library.
|
||||||
When code is compiled to C++, the calls to JavaScript micro:bit functions are replaced with calls to the corresponding C++ functions.
|
When code is compiled to ARM machine code, the calls to JavaScript micro:bit functions are replaced with calls to the corresponding C++ functions.
|
||||||
|
|||||||
@@ -10,7 +10,10 @@ Answers will vary. In general, plot refers to the code that turns on a specific
|
|||||||
|
|
||||||
## 2. Draw which LED is ON after running this code
|
## 2. Draw which LED is ON after running this code
|
||||||
|
|
||||||

|
```blocks
|
||||||
|
led.plot(2, 2)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -18,7 +21,10 @@ By default, the position of an LED on *Blink Tutorial* is set to the centre of t
|
|||||||
|
|
||||||
## 3. Draw which LED is ON after running this code
|
## 3. Draw which LED is ON after running this code
|
||||||
|
|
||||||

|
```blocks
|
||||||
|
led.plot(0, 0)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -29,7 +35,10 @@ This code turns on specific LED. Plot turns on the specified LED on the LED scre
|
|||||||
|
|
||||||
## 4. Draw which LED is ON after running this code
|
## 4. Draw which LED is ON after running this code
|
||||||
|
|
||||||

|
```blocks
|
||||||
|
led.plot(4, 4)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
@@ -12,23 +12,34 @@ Answer the questions while completing the tutorial. Pay attention to the dialogu
|
|||||||
|
|
||||||
## 1. Describe what `plot` does?
|
## 1. Describe what `plot` does?
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
## 2. Draw which LED is ON after running this code
|
## 2. Draw which LED is ON after running this code
|
||||||
|
|
||||||

|
```blocks
|
||||||
|
led.plot(2, 2)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 3. Draw which LED is ON after running this code
|
## 3. Draw which LED is ON after running this code
|
||||||
|
|
||||||

|
```blocks
|
||||||
|
led.plot(0, 0)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 4. Draw which LED is ON after running this code
|
## 4. Draw which LED is ON after running this code
|
||||||
|
|
||||||

|
|
||||||
|
```blocks
|
||||||
|
led.plot(4, 4)
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
@@ -10,13 +10,15 @@ Pause program execution for the specified number of milliseconds.
|
|||||||
|
|
||||||
## 2. Write the code that leaves an image on the screen for 1 second (1000 milliseconds)
|
## 2. Write the code that leaves an image on the screen for 1 second (1000 milliseconds)
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||

|
```blocks
|
||||||
|
basic.pause(1000)
|
||||||
|
```
|
||||||
|
|
||||||
## 3. Write the code that leaves an image on the screen for 1.5 seconds (1500 milliseconds)
|
## 3. Write the code that leaves an image on the screen for 1.5 seconds (1500 milliseconds)
|
||||||
|
|
||||||

|
```blocks
|
||||||
|
basic.pause(1500)
|
||||||
|
```
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,19 +12,14 @@ Answer the questions while completing the activity. Pay attention to the dialogu
|
|||||||
|
|
||||||
## 1. Describe what `pause` does?
|
## 1. Describe what `pause` does?
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
## 2. Write the code that leaves an image on the screen for 1 second (1000 milliseconds)
|
## 2. Write the code that leaves an image on the screen for 1 second (1000 milliseconds)
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
## 3. Write the code that leaves an image on the screen for 1.5 seconds (1500 milliseconds)
|
## 3. Write the code that leaves an image on the screen for 1.5 seconds (1500 milliseconds)
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,11 @@ It's a method that runs code when the user holds the GND pin with a finger of on
|
|||||||
|
|
||||||
Create a condition for `on pin pressed (P0)`.
|
Create a condition for `on pin pressed (P0)`.
|
||||||
|
|
||||||

|
```blocks
|
||||||
|
input.onPinPressed(TouchPin.P0, () => {
|
||||||
|
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
## 3. What does this line of code doing?
|
## 3. What does this line of code doing?
|
||||||
|
|
||||||
|
|||||||
@@ -12,25 +12,21 @@ Answer the questions below while completing the activity. Pay attention to the d
|
|||||||
|
|
||||||
## 1. Describe what `on pin pressed` does?
|
## 1. Describe what `on pin pressed` does?
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
## 2. Create a condition for on pin pressed (P0).
|
## 2. Create a condition for on pin pressed (P0).
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
## 3. Describe what this line of code does?
|
## 3. Describe what this line of code does?
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
## 4. Describe what adding 1 to variable x does?
|
## 4. Describe what adding 1 to variable x does?
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
## 5. Describe why you must hold ground (GND) before pressing (P0) to run a program using `on pin pressed(P0)` on the micro:bit
|
## 5. Describe why you must hold ground (GND) before pressing (P0) to run a program using `on pin pressed(P0)` on the micro:bit
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
|
|||||||
@@ -12,13 +12,31 @@ This function turns off all the LED lights on the LED screen.
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||

|
```blocks
|
||||||
|
basic.showLeds(`
|
||||||
|
. # . # .
|
||||||
|
. # . # .
|
||||||
|
. . # . .
|
||||||
|
# . . . #
|
||||||
|
. # # # .
|
||||||
|
`)
|
||||||
|
```
|
||||||
|
|
||||||
## 3. Write the condition that will detect on button A pressed
|
## 3. Write the condition that will detect on button A pressed
|
||||||
|
|
||||||

|
```blocks
|
||||||
|
|
||||||
|
input.onButtonPressed(Button.A, () => {
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
## 4. Write the code that will clear show LEDS from the screen after pressing button A
|
## 4. Write the code that will clear show LEDS from the screen after pressing button A
|
||||||
|
|
||||||

|
```blocks
|
||||||
|
input.onButtonPressed(Button.A, () => {
|
||||||
|
basic.clearScreen()
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -12,19 +12,18 @@ Answer the questions while completing the tutorial. Pay attention to the dialogu
|
|||||||
|
|
||||||
## 1. Describe what "clear screen" does?
|
## 1. Describe what "clear screen" does?
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
## 2. Write the code that clears an image from the screen
|
## 2. Write the code that clears an image from the screen
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
## 3. Write the condition that will detect on button A pressed
|
## 3. Write the condition that will detect on button A pressed
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
## 4. Write the code that will clear show LEDS from the screen after pressing button A
|
## 4. Write the code that will clear show LEDS from the screen after pressing button A
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,13 +16,36 @@ The extra empty image with show LED creates a blinking smiley, allowing the micr
|
|||||||
|
|
||||||
## 3. Draw the image created with this code
|
## 3. Draw the image created with this code
|
||||||
|
|
||||||

|
```blocks
|
||||||
|
basic.showLeds(`
|
||||||
|
. # . # .
|
||||||
|
. # . # .
|
||||||
|
. . . . .
|
||||||
|
# . . . #
|
||||||
|
. # # # .
|
||||||
|
`)
|
||||||
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
## 4. Write the code to make this image
|
## 4. Write the code to make this image
|
||||||
|
|
||||||

|
```blocks
|
||||||
|
basic.showLeds(`
|
||||||
|
. # . # .
|
||||||
|
. # . # .
|
||||||
|
. . . . .
|
||||||
|
# . . . #
|
||||||
|
. # # # .
|
||||||
|
`)
|
||||||
|
basic.showLeds(`
|
||||||
|
. . . . .
|
||||||
|
. . . . .
|
||||||
|
. . . . .
|
||||||
|
. . . . .
|
||||||
|
. . . . .
|
||||||
|
`)
|
||||||
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
@@ -10,27 +10,45 @@ Use the hints in the [Smiley](/microbit/lessons/smiley/activity) activity to ans
|
|||||||
|
|
||||||
## 1. Describe what `show LEDs` does
|
## 1. Describe what `show LEDs` does
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
## 2. Why is there an extra empty frame after the smiley face?
|
## 2. Why is there an extra empty frame after the smiley face?
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
## 3. Draw the image created with this code
|
## 3. Draw the image created with this code
|
||||||
|
|
||||||

|
```blocks
|
||||||
|
basic.showLeds(`
|
||||||
|
. # . # .
|
||||||
|
. # . # .
|
||||||
|
. . . . .
|
||||||
|
# . . . #
|
||||||
|
. # # # .
|
||||||
|
`)
|
||||||
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
## 4. Draw the images created with this code
|
## 4. Draw the images created with this code
|
||||||
|
|
||||||

|
```blocks
|
||||||
|
basic.showLeds(`
|
||||||
|
. # . # .
|
||||||
|
. # . # .
|
||||||
|
. . . . .
|
||||||
|
# . . . #
|
||||||
|
. # # # .
|
||||||
|
`)
|
||||||
|
basic.showLeds(`
|
||||||
|
. . . . .
|
||||||
|
. . . . .
|
||||||
|
. . . . .
|
||||||
|
. . . . .
|
||||||
|
. . . . .
|
||||||
|
`)
|
||||||
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,17 @@ Run code in the background forever (answers may vary).
|
|||||||
|
|
||||||
## 2. Draw the picture that will be produced with this code
|
## 2. Draw the picture that will be produced with this code
|
||||||
|
|
||||||

|
```blocks
|
||||||
|
basic.forever(() => {
|
||||||
|
basic.showLeds(`
|
||||||
|
. # . # .
|
||||||
|
# # # # #
|
||||||
|
# # # # #
|
||||||
|
. # # # .
|
||||||
|
. . # . .`);
|
||||||
|
});
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|||||||
@@ -10,21 +10,31 @@ Use the hints in the [snowflake fall activity](/microbit/lessons/snowflake-fall/
|
|||||||
|
|
||||||
## 1. What is a forever loop?
|
## 1. What is a forever loop?
|
||||||
|
|
||||||
<br />
|
|
||||||
|
|
||||||
## 2. Draw the picture that will be produced with this code
|
## 2. Draw the picture that will be produced with this code
|
||||||
|
|
||||||

|
```blocks
|
||||||
|
basic.forever(() => {
|
||||||
|
basic.showLeds(`
|
||||||
|
. # . # .
|
||||||
|
# # # # #
|
||||||
|
# # # # #
|
||||||
|
. # # # .
|
||||||
|
. . # . .`);
|
||||||
|
});
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
## 3. Write the code for a forever loop and show LEDS for these images!
|
## 3. Write the code for a forever loop and show LEDS for these images!
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
## 4. Write the code for a forever loop and show LEDS for these images!
|
## 4. Write the code for a forever loop and show LEDS for these images!
|
||||||
|
|
||||||
@@ -32,5 +42,5 @@ Use the hints in the [snowflake fall activity](/microbit/lessons/snowflake-fall/
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
<br/>
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,117 +1,117 @@
|
|||||||
enum MesCameraEvent {
|
enum MesCameraEvent {
|
||||||
//% enumval=MES_CAMERA_EVT_TAKE_PHOTO blockId="take photo"
|
//% enumval=MES_CAMERA_EVT_TAKE_PHOTO block="take photo"
|
||||||
TakePhoto,
|
TakePhoto,
|
||||||
//% enumval=MES_CAMERA_EVT_START_VIDEO_CAPTURE blockId="start video capture"
|
//% enumval=MES_CAMERA_EVT_START_VIDEO_CAPTURE block="start video capture"
|
||||||
StartVideoCapture,
|
StartVideoCapture,
|
||||||
//% enumval=MES_CAMERA_EVT_STOP_VIDEO_CAPTURE blockId="stop video capture"
|
//% enumval=MES_CAMERA_EVT_STOP_VIDEO_CAPTURE block="stop video capture"
|
||||||
StopVideoCapture,
|
StopVideoCapture,
|
||||||
//% enumval=MES_CAMERA_EVT_TOGGLE_FRONT_REAR blockId="toggle front-rear"
|
//% enumval=MES_CAMERA_EVT_TOGGLE_FRONT_REAR block="toggle front-rear"
|
||||||
ToggleFrontRear,
|
ToggleFrontRear,
|
||||||
//% enumval=MES_CAMERA_EVT_LAUNCH_PHOTO_MODE blockId="launch photo mode"
|
//% enumval=MES_CAMERA_EVT_LAUNCH_PHOTO_MODE block="launch photo mode"
|
||||||
LaunchPhotoMode,
|
LaunchPhotoMode,
|
||||||
//% enumval=MES_CAMERA_EVT_LAUNCH_VIDEO_MODE blockId="launch video mode"
|
//% enumval=MES_CAMERA_EVT_LAUNCH_VIDEO_MODE block="launch video mode"
|
||||||
LaunchVideoMode,
|
LaunchVideoMode,
|
||||||
//% enumval=MES_CAMERA_EVT_STOP_PHOTO_MODE blockId="stop photo mode"
|
//% enumval=MES_CAMERA_EVT_STOP_PHOTO_MODE block="stop photo mode"
|
||||||
StopPhotoMode,
|
StopPhotoMode,
|
||||||
//% enumval=MES_CAMERA_EVT_STOP_VIDEO_MODE blockId="stop video mode"
|
//% enumval=MES_CAMERA_EVT_STOP_VIDEO_MODE block="stop video mode"
|
||||||
StopVideoMode,
|
StopVideoMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum MesAlertEvent {
|
enum MesAlertEvent {
|
||||||
//% enumval=MES_ALERT_EVT_DISPLAY_TOAST blockId="display toast"
|
//% enumval=MES_ALERT_EVT_DISPLAY_TOAST block="display toast"
|
||||||
DisplayToast,
|
DisplayToast,
|
||||||
//% enumval=MES_ALERT_EVT_VIBRATE blockId="vibrate"
|
//% enumval=MES_ALERT_EVT_VIBRATE block="vibrate"
|
||||||
Vibrate,
|
Vibrate,
|
||||||
//% enumval=MES_ALERT_EVT_PLAY_SOUND blockId="play sound"
|
//% enumval=MES_ALERT_EVT_PLAY_SOUND block="play sound"
|
||||||
PlaySound,
|
PlaySound,
|
||||||
//% enumval=MES_ALERT_EVT_PLAY_RINGTONE blockId="play ring tone"
|
//% enumval=MES_ALERT_EVT_PLAY_RINGTONE block="play ring tone"
|
||||||
PlayRingtone,
|
PlayRingtone,
|
||||||
//% enumval=MES_ALERT_EVT_FIND_MY_PHONE blockId="find my phone"
|
//% enumval=MES_ALERT_EVT_FIND_MY_PHONE block="find my phone"
|
||||||
FindMyPhone,
|
FindMyPhone,
|
||||||
//% enumval=MES_ALERT_EVT_ALARM1 blockId="ring alarm"
|
//% enumval=MES_ALERT_EVT_ALARM1 block="ring alarm"
|
||||||
RingAlarm,
|
RingAlarm,
|
||||||
//% enumval=MES_ALERT_EVT_ALARM2 blockId="ring alarm 2"
|
//% enumval=MES_ALERT_EVT_ALARM2 block="ring alarm 2"
|
||||||
RingAlarm2,
|
RingAlarm2,
|
||||||
//% enumval=MES_ALERT_EVT_ALARM3 blockId="ring alarm 3"
|
//% enumval=MES_ALERT_EVT_ALARM3 block="ring alarm 3"
|
||||||
RingAlarm3,
|
RingAlarm3,
|
||||||
//% enumval=MES_ALERT_EVT_ALARM4 blockId="ring alarm 4"
|
//% enumval=MES_ALERT_EVT_ALARM4 block="ring alarm 4"
|
||||||
RingAlarm4,
|
RingAlarm4,
|
||||||
//% enumval=MES_ALERT_EVT_ALARM5 blockId="ring alarm 5"
|
//% enumval=MES_ALERT_EVT_ALARM5 block="ring alarm 5"
|
||||||
RingAlarm5,
|
RingAlarm5,
|
||||||
//% enumval=MES_ALERT_EVT_ALARM6 blockId="ring alarm 6"
|
//% enumval=MES_ALERT_EVT_ALARM6 block="ring alarm 6"
|
||||||
RingAlarm6,
|
RingAlarm6,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum MesDeviceInfo {
|
enum MesDeviceInfo {
|
||||||
//% enumval=MES_DEVICE_INCOMING_CALL blockId="incoming call"
|
//% enumval=MES_DEVICE_INCOMING_CALL block="incoming call"
|
||||||
IncomingCall,
|
IncomingCall,
|
||||||
//% enumval=MES_DEVICE_INCOMING_MESSAGE blockId="incoming message"
|
//% enumval=MES_DEVICE_INCOMING_MESSAGE block="incoming message"
|
||||||
IncomingMessage,
|
IncomingMessage,
|
||||||
//% enumval=MES_DEVICE_ORIENTATION_LANDSCAPE blockId="orientation landscape"
|
//% enumval=MES_DEVICE_ORIENTATION_LANDSCAPE block="orientation landscape"
|
||||||
OrientationLandscape,
|
OrientationLandscape,
|
||||||
//% enumval=MES_DEVICE_ORIENTATION_PORTRAIT blockId="orientation portrait"
|
//% enumval=MES_DEVICE_ORIENTATION_PORTRAIT block="orientation portrait"
|
||||||
OrientationPortrait,
|
OrientationPortrait,
|
||||||
//% enumval=MES_DEVICE_GESTURE_DEVICE_SHAKEN blockId="shaken"
|
//% enumval=MES_DEVICE_GESTURE_DEVICE_SHAKEN block="shaken"
|
||||||
Shaken,
|
Shaken,
|
||||||
//% enumval=MES_DEVICE_DISPLAY_OFF blockId="display off"
|
//% enumval=MES_DEVICE_DISPLAY_OFF block="display off"
|
||||||
DisplayOff,
|
DisplayOff,
|
||||||
//% enumval=MES_DEVICE_DISPLAY_ON blockId="display on"
|
//% enumval=MES_DEVICE_DISPLAY_ON block="display on"
|
||||||
DisplayOn,
|
DisplayOn,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum MesRemoteControlEvent {
|
enum MesRemoteControlEvent {
|
||||||
//% enumval=MES_REMOTE_CONTROL_EVT_PLAY blockId="play"
|
//% enumval=MES_REMOTE_CONTROL_EVT_PLAY block="play"
|
||||||
play,
|
play,
|
||||||
//% enumval=MES_REMOTE_CONTROL_EVT_PAUSE blockId="pause"
|
//% enumval=MES_REMOTE_CONTROL_EVT_PAUSE block="pause"
|
||||||
pause,
|
pause,
|
||||||
//% enumval=MES_REMOTE_CONTROL_EVT_STOP blockId="stop"
|
//% enumval=MES_REMOTE_CONTROL_EVT_STOP block="stop"
|
||||||
stop,
|
stop,
|
||||||
//% enumval=MES_REMOTE_CONTROL_EVT_NEXTTRACK blockId="next track"
|
//% enumval=MES_REMOTE_CONTROL_EVT_NEXTTRACK block="next track"
|
||||||
nextTrack,
|
nextTrack,
|
||||||
//% enumval=MES_REMOTE_CONTROL_EVT_PREVTRACK blockId="previous track"
|
//% enumval=MES_REMOTE_CONTROL_EVT_PREVTRACK block="previous track"
|
||||||
previousTrack,
|
previousTrack,
|
||||||
//% enumval=MES_REMOTE_CONTROL_EVT_FORWARD blockId="forward"
|
//% enumval=MES_REMOTE_CONTROL_EVT_FORWARD block="forward"
|
||||||
forward,
|
forward,
|
||||||
//% enumval=MES_REMOTE_CONTROL_EVT_REWIND blockId="rewind"
|
//% enumval=MES_REMOTE_CONTROL_EVT_REWIND block="rewind"
|
||||||
rewind,
|
rewind,
|
||||||
//% enumval=MES_REMOTE_CONTROL_EVT_VOLUMEUP blockId="volume up"
|
//% enumval=MES_REMOTE_CONTROL_EVT_VOLUMEUP block="volume up"
|
||||||
volumeUp,
|
volumeUp,
|
||||||
//% enumval=MES_REMOTE_CONTROL_EVT_VOLUMEDOWN blockId="volume down"
|
//% enumval=MES_REMOTE_CONTROL_EVT_VOLUMEDOWN block="volume down"
|
||||||
volumeDown,
|
volumeDown,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum MesDpadButtonInfo {
|
enum MesDpadButtonInfo {
|
||||||
//% enumval=MES_DPAD_BUTTON_A_DOWN blockId="A down"
|
//% enumval=MES_DPAD_BUTTON_A_DOWN block="A down"
|
||||||
ADown,
|
ADown,
|
||||||
//% enumval=MES_DPAD_BUTTON_A_UP blockId="A up"
|
//% enumval=MES_DPAD_BUTTON_A_UP block="A up"
|
||||||
AUp,
|
AUp,
|
||||||
//% enumval=MES_DPAD_BUTTON_B_DOWN blockId="B down"
|
//% enumval=MES_DPAD_BUTTON_B_DOWN block="B down"
|
||||||
BDown,
|
BDown,
|
||||||
//% enumval=MES_DPAD_BUTTON_B_UP blockId="B up"
|
//% enumval=MES_DPAD_BUTTON_B_UP block="B up"
|
||||||
BUp,
|
BUp,
|
||||||
//% enumval=MES_DPAD_BUTTON_C_DOWN blockId="C down"
|
//% enumval=MES_DPAD_BUTTON_C_DOWN block="C down"
|
||||||
CDown,
|
CDown,
|
||||||
//% enumval=MES_DPAD_BUTTON_C_UP blockId="C up"
|
//% enumval=MES_DPAD_BUTTON_C_UP block="C up"
|
||||||
CUp,
|
CUp,
|
||||||
//% enumval=MES_DPAD_BUTTON_D_DOWN blockId="D down"
|
//% enumval=MES_DPAD_BUTTON_D_DOWN block="D down"
|
||||||
DDown,
|
DDown,
|
||||||
//% enumval=MES_DPAD_BUTTON_D_UP blockId="D up"
|
//% enumval=MES_DPAD_BUTTON_D_UP block="D up"
|
||||||
DUp,
|
DUp,
|
||||||
//% enumval=MES_DPAD_BUTTON_1_UP blockId="1 down"
|
//% enumval=MES_DPAD_BUTTON_1_UP block="1 down"
|
||||||
_1Down,
|
_1Down,
|
||||||
//% enumval=MES_DPAD_BUTTON_1_DOWN blockId="1 up"
|
//% enumval=MES_DPAD_BUTTON_1_DOWN block="1 up"
|
||||||
_1Up,
|
_1Up,
|
||||||
//% enumval=MES_DPAD_BUTTON_2_DOWN blockId="2 down"
|
//% enumval=MES_DPAD_BUTTON_2_DOWN block="2 down"
|
||||||
_2Down,
|
_2Down,
|
||||||
//% enumval=MES_DPAD_BUTTON_2_UP blockId="2 up"
|
//% enumval=MES_DPAD_BUTTON_2_UP block="2 up"
|
||||||
_2Up,
|
_2Up,
|
||||||
//% enumval=MES_DPAD_BUTTON_3_DOWN blockId="3 down"
|
//% enumval=MES_DPAD_BUTTON_3_DOWN block="3 down"
|
||||||
_3Down,
|
_3Down,
|
||||||
//% enumval=MES_DPAD_BUTTON_3_UP blockId="3 up"
|
//% enumval=MES_DPAD_BUTTON_3_UP block="3 up"
|
||||||
_3Up,
|
_3Up,
|
||||||
//% enumval=MES_DPAD_BUTTON_4_DOWN blockId="4 down"
|
//% enumval=MES_DPAD_BUTTON_4_DOWN block="4 down"
|
||||||
_4Down,
|
_4Down,
|
||||||
//% enumval=MES_DPAD_BUTTON_4_UP blockId="4 up"
|
//% enumval=MES_DPAD_BUTTON_4_UP block="4 up"
|
||||||
_4Up,
|
_4Up,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -220,7 +220,8 @@ namespace control {
|
|||||||
* Raises an event in the event bus.
|
* Raises an event in the event bus.
|
||||||
*/
|
*/
|
||||||
// shim=micro_bit::onBusEvent
|
// shim=micro_bit::onBusEvent
|
||||||
//% weight=20 blockGap=8 blockId="control_on_event" block="on event|from %src=control_event_source|with value %value=control_event_value" blockExternalInputs=1
|
//% weight=20 blockGap=8 blockId="control_on_event" block="on event|from %src=control_event_source|with value %value=control_event_value"
|
||||||
|
//% blockExternalInputs=1 blockStatement=1
|
||||||
export function onEvent(src: number, value: number, handler: Action): void { }
|
export function onEvent(src: number, value: number, handler: Action): void { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
enum Direction {
|
enum Direction {
|
||||||
//% blockId=right
|
//% block=right
|
||||||
Right,
|
Right,
|
||||||
//% blockId=left
|
//% block=left
|
||||||
Left
|
Left
|
||||||
}
|
}
|
||||||
|
|
||||||
enum LedSpriteProperty {
|
enum LedSpriteProperty {
|
||||||
//% blockId=x
|
//% block=x
|
||||||
X,
|
X,
|
||||||
//% blockId=y
|
//% block=y
|
||||||
Y,
|
Y,
|
||||||
//% blockId=direction
|
//% block=direction
|
||||||
Direction,
|
Direction,
|
||||||
//% blockId=brightness
|
//% block=brightness
|
||||||
Brightness,
|
Brightness,
|
||||||
//% blockId=blink
|
//% block=blink
|
||||||
Blink
|
Blink
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,25 +4,25 @@ enum Button {
|
|||||||
//% enumval=MICROBIT_ID_BUTTON_B
|
//% enumval=MICROBIT_ID_BUTTON_B
|
||||||
B,
|
B,
|
||||||
//% enumval=MICROBIT_ID_BUTTON_AB
|
//% enumval=MICROBIT_ID_BUTTON_AB
|
||||||
//% blockId="A+B" block="A+B"
|
//% block="A+B"
|
||||||
AB,
|
AB,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Dimension {
|
enum Dimension {
|
||||||
//% enumval=0 blockId=x
|
//% enumval=0 block=x
|
||||||
X,
|
X,
|
||||||
//% enumval=1 blockId=y
|
//% enumval=1 block=y
|
||||||
Y,
|
Y,
|
||||||
//% enumval=2 blockId=z
|
//% enumval=2 block=z
|
||||||
Z,
|
Z,
|
||||||
//% enumval=3 blockId=strength
|
//% enumval=3 block=strength
|
||||||
Strength,
|
Strength,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Rotation {
|
enum Rotation {
|
||||||
//% enumval=0 blockId=pitch
|
//% enumval=0 block=pitch
|
||||||
Pitch,
|
Pitch,
|
||||||
//% enumval=1 blockId=roll
|
//% enumval=1 block=roll
|
||||||
Roll,
|
Roll,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,22 +39,22 @@ enum AcceleratorRange {
|
|||||||
/**
|
/**
|
||||||
* The accelerator measures forces up to 1 gravity
|
* The accelerator measures forces up to 1 gravity
|
||||||
*/
|
*/
|
||||||
//% blockId="1g" enumval=1
|
//% block="1g" enumval=1
|
||||||
OneG,
|
OneG,
|
||||||
/**
|
/**
|
||||||
* The accelerator measures forces up to 2 gravity
|
* The accelerator measures forces up to 2 gravity
|
||||||
*/
|
*/
|
||||||
//% blockId="2g" enumval=2
|
//% block="2g" enumval=2
|
||||||
TwoG,
|
TwoG,
|
||||||
/**
|
/**
|
||||||
* The accelerator measures forces up to 4 gravity
|
* The accelerator measures forces up to 4 gravity
|
||||||
*/
|
*/
|
||||||
//% blockId="4g" enumval=4
|
//% block="4g" enumval=4
|
||||||
FourG,
|
FourG,
|
||||||
/**
|
/**
|
||||||
* The accelerator measures forces up to 8 gravity
|
* The accelerator measures forces up to 8 gravity
|
||||||
*/
|
*/
|
||||||
//% blockId="8g" enumval=8
|
//% block="8g" enumval=8
|
||||||
EightG
|
EightG
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,42 +80,42 @@ enum Gesture {
|
|||||||
/**
|
/**
|
||||||
* Raised when shaken
|
* Raised when shaken
|
||||||
*/
|
*/
|
||||||
//% blockId=shake enumval=11
|
//% block=shake enumval=11
|
||||||
Shake,
|
Shake,
|
||||||
/**
|
/**
|
||||||
* Raised when the logo is upward and the screen is vertical
|
* Raised when the logo is upward and the screen is vertical
|
||||||
*/
|
*/
|
||||||
//% blockId="logo up" enumval=1
|
//% block="logo up" enumval=1
|
||||||
LogoUp,
|
LogoUp,
|
||||||
/**
|
/**
|
||||||
* Raised when the logo is downward and the screen is vertical
|
* Raised when the logo is downward and the screen is vertical
|
||||||
*/
|
*/
|
||||||
//% blockId="logo down" enumval=2
|
//% block="logo down" enumval=2
|
||||||
LogoDown,
|
LogoDown,
|
||||||
/**
|
/**
|
||||||
* Raised when the screen is pointing down and the board is horizontal
|
* Raised when the screen is pointing down and the board is horizontal
|
||||||
*/
|
*/
|
||||||
//% blockId="screen up" enumval=5
|
//% block="screen up" enumval=5
|
||||||
ScreenUp,
|
ScreenUp,
|
||||||
/**
|
/**
|
||||||
* Raised when the screen is pointing up and the board is horizontal
|
* Raised when the screen is pointing up and the board is horizontal
|
||||||
*/
|
*/
|
||||||
//% blockId="screen down" enumval=6
|
//% block="screen down" enumval=6
|
||||||
ScreenDown,
|
ScreenDown,
|
||||||
/**
|
/**
|
||||||
* Raised when the screen is pointing left
|
* Raised when the screen is pointing left
|
||||||
*/
|
*/
|
||||||
//% blockId="tilt left" enumval=3
|
//% block="tilt left" enumval=3
|
||||||
TiltLeft,
|
TiltLeft,
|
||||||
/**
|
/**
|
||||||
* Raised when the screen is pointing right
|
* Raised when the screen is pointing right
|
||||||
*/
|
*/
|
||||||
//% blockId="tilt right" enumval=4
|
//% block="tilt right" enumval=4
|
||||||
TiltRight,
|
TiltRight,
|
||||||
/**
|
/**
|
||||||
* Raised when the board is falling!
|
* Raised when the board is falling!
|
||||||
*/
|
*/
|
||||||
//% blockId="free fall" enumval=7
|
//% block="free fall" enumval=7
|
||||||
FreeFall
|
FreeFall
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
enum DisplayMode {
|
enum DisplayMode {
|
||||||
//% enumval=0 blockId="black and white"
|
//% enumval=0 block="black and white"
|
||||||
BackAndWhite,
|
BackAndWhite,
|
||||||
//% enumval=1 blockId="greyscale"
|
//% enumval=1 block="greyscale"
|
||||||
Greyscale,
|
Greyscale,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
enum Note {
|
enum Note {
|
||||||
//% enumval=262
|
//% enumval=262
|
||||||
C,
|
C,
|
||||||
//% enumval=277 blockId=C#
|
//% enumval=277 block=C#
|
||||||
CSharp,
|
CSharp,
|
||||||
//% enumval=294
|
//% enumval=294
|
||||||
D,
|
D,
|
||||||
@@ -11,11 +11,11 @@ enum Note {
|
|||||||
E,
|
E,
|
||||||
//% enumval=349
|
//% enumval=349
|
||||||
F,
|
F,
|
||||||
//% enumval=370 blockId=F#
|
//% enumval=370 block=F#
|
||||||
FSharp,
|
FSharp,
|
||||||
//% enumval=392
|
//% enumval=392
|
||||||
G,
|
G,
|
||||||
//% enumval=415 blockId=G#
|
//% enumval=415 block=G#
|
||||||
GSharp,
|
GSharp,
|
||||||
//% enumval=440
|
//% enumval=440
|
||||||
A,
|
A,
|
||||||
@@ -25,7 +25,7 @@ enum Note {
|
|||||||
B,
|
B,
|
||||||
//% enumval=131
|
//% enumval=131
|
||||||
C3,
|
C3,
|
||||||
//% enumval=139 blockId=C#3
|
//% enumval=139 block=C#3
|
||||||
CSharp3,
|
CSharp3,
|
||||||
//% enumval=147
|
//% enumval=147
|
||||||
D3,
|
D3,
|
||||||
@@ -35,11 +35,11 @@ enum Note {
|
|||||||
E3,
|
E3,
|
||||||
//% enumval=175
|
//% enumval=175
|
||||||
F3,
|
F3,
|
||||||
//% enumval=185 blockId=F#3
|
//% enumval=185 block=F#3
|
||||||
FSharp3,
|
FSharp3,
|
||||||
//% enumval=196
|
//% enumval=196
|
||||||
G3,
|
G3,
|
||||||
//% enumval=208 blockId=G#3
|
//% enumval=208 block=G#3
|
||||||
GSharp3,
|
GSharp3,
|
||||||
//% enumval=220
|
//% enumval=220
|
||||||
A3,
|
A3,
|
||||||
@@ -49,7 +49,7 @@ enum Note {
|
|||||||
B3,
|
B3,
|
||||||
//% enumval=262
|
//% enumval=262
|
||||||
C4,
|
C4,
|
||||||
//% enumval=277 blockId=C#4
|
//% enumval=277 block=C#4
|
||||||
CSharp4,
|
CSharp4,
|
||||||
//% enumval=294
|
//% enumval=294
|
||||||
D4,
|
D4,
|
||||||
@@ -59,11 +59,11 @@ enum Note {
|
|||||||
E4,
|
E4,
|
||||||
//% enumval=349
|
//% enumval=349
|
||||||
F4,
|
F4,
|
||||||
//% enumval=370 blockId=F#3
|
//% enumval=370 block=F#3
|
||||||
FSharp4,
|
FSharp4,
|
||||||
//% enumval=392
|
//% enumval=392
|
||||||
G4,
|
G4,
|
||||||
//% enumval=415 blockId=G#3
|
//% enumval=415 block=G#3
|
||||||
GSharp4,
|
GSharp4,
|
||||||
//% enumval=440
|
//% enumval=440
|
||||||
A4,
|
A4,
|
||||||
@@ -73,7 +73,7 @@ enum Note {
|
|||||||
B4,
|
B4,
|
||||||
//% enumval=523
|
//% enumval=523
|
||||||
C5,
|
C5,
|
||||||
//% enumval=555 blockId=C#5
|
//% enumval=555 block=C#5
|
||||||
CSharp5,
|
CSharp5,
|
||||||
//% enumval=587
|
//% enumval=587
|
||||||
D5,
|
D5,
|
||||||
@@ -83,11 +83,11 @@ enum Note {
|
|||||||
E5,
|
E5,
|
||||||
//% enumval=698
|
//% enumval=698
|
||||||
F5,
|
F5,
|
||||||
//% enumval=740 blockId=F#5
|
//% enumval=740 block=F#5
|
||||||
FSharp5,
|
FSharp5,
|
||||||
//% enumval=784
|
//% enumval=784
|
||||||
G5,
|
G5,
|
||||||
//% enumval=831 blockId=G#5
|
//% enumval=831 block=G#5
|
||||||
GSharp5,
|
GSharp5,
|
||||||
//% enumval=880
|
//% enumval=880
|
||||||
A5,
|
A5,
|
||||||
@@ -98,15 +98,15 @@ enum Note {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum BeatFraction {
|
enum BeatFraction {
|
||||||
//% enumval=1 blockId=1
|
//% enumval=1 block=1
|
||||||
Whole = 1,
|
Whole = 1,
|
||||||
//% enumval=2 blockId="1/2"
|
//% enumval=2 block="1/2"
|
||||||
Half = 2,
|
Half = 2,
|
||||||
//% enumval=4 blockId="1/4"
|
//% enumval=4 block="1/4"
|
||||||
Quater = 4,
|
Quater = 4,
|
||||||
//% enumval=8 blockId="1/8"
|
//% enumval=8 block="1/8"
|
||||||
Eighth = 8,
|
Eighth = 8,
|
||||||
//% enumval=16 blockId="1/16"
|
//% enumval=16 block="1/16"
|
||||||
Sixteenth = 16
|
Sixteenth = 16
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "kindscript-microbit",
|
"name": "kindscript-microbit",
|
||||||
"version": "0.0.4",
|
"version": "0.0.12",
|
||||||
"private": true,
|
|
||||||
"description": "BBC micro:bit target for KindScript",
|
"description": "BBC micro:bit target for KindScript",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"JavaScript",
|
"JavaScript",
|
||||||
@@ -31,6 +30,6 @@
|
|||||||
"typescript": "^1.8.7"
|
"typescript": "^1.8.7"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"kindscript": "0.1.110"
|
"kindscript": "0.1.118"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,9 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript" src="./bluebird.min.js"></script>
|
<script src="/cdn/bluebird.min.js"></script>
|
||||||
<script type="text/javascript" src="./kindsim.js"></script>
|
<script src="/cdn/kindsim.js"></script>
|
||||||
<script type="text/javascript" src="./sim.js"></script>
|
<script src="/sim/sim.js"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
Reference in New Issue
Block a user