Compare commits
73 Commits
Author | SHA1 | Date | |
---|---|---|---|
26797545c6 | |||
3ce8aa1f47 | |||
47401e947c | |||
718cc9d530 | |||
b83d777144 | |||
cfb9acea34 | |||
53189830a1 | |||
67da22c135 | |||
7c7014a25f | |||
851f395ec9 | |||
a343cbd065 | |||
a2c042f715 | |||
a4a97f31cb | |||
5bd6a384ae | |||
943393dfa3 | |||
7089aa9c54 | |||
bd9e456bc5 | |||
ea82d066c9 | |||
bb8338a0f0 | |||
b24b65abcd | |||
2cc0523f9a | |||
a78f7f9601 | |||
b1cf3246ae | |||
24eb6f64db | |||
0c99eaf7bf | |||
8eb3376cf5 | |||
b863d5663d | |||
aeb4cb6a17 | |||
fd88e0b7f0 | |||
ea0d2d4d02 | |||
adff537013 | |||
19fc284884 | |||
5d9f85828d | |||
9f31637000 | |||
8e811b913e | |||
269254796d | |||
46995cbd54 | |||
380488528f | |||
aca863f436 | |||
a1ec25fd79 | |||
3e9d6d5895 | |||
719370f6b0 | |||
2780497d4f | |||
3eeaf2eddc | |||
eb3e91420c | |||
38cd913020 | |||
9159c297a5 | |||
851687dba8 | |||
28b8006ec5 | |||
271128c075 | |||
a04ca0d715 | |||
8b89fe721d | |||
1baf04b1fd | |||
6c7f0f911c | |||
f2008f9263 | |||
62127f7269 | |||
740cedd978 | |||
4278ff2b37 | |||
e7bea34d95 | |||
825409b697 | |||
8f72ac0094 | |||
8a6bb610e3 | |||
94dc141062 | |||
286dd1e50b | |||
6451d9add9 | |||
fd1dcde86b | |||
99947a9e21 | |||
a69239abed | |||
fd06fae050 | |||
7fbb056edf | |||
06758863fb | |||
ad8af16a5a | |||
70dd6bcac5 |
@ -5,8 +5,6 @@ VisualStudioVersion = 14.0.25123.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeTheMicrobit", "Microbit.Uploader\CodeTheMicrobit.csproj", "{7DC6CA45-FD75-44BC-805E-708C812CD4BF}"
|
||||
EndProject
|
||||
Project("{262852C6-CD72-467D-83FE-5EEB1973A190}") = "codethemicrobitapp", "..\win10\app\codethemicrobitapp.jsproj", "{39122940-AB16-4CD4-A0CE-79A3EB863ECF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -35,30 +33,6 @@ Global
|
||||
{7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Release|x64.Build.0 = Release|Any CPU
|
||||
{7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Release|x86.Build.0 = Release|Any CPU
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|ARM.Deploy.0 = Debug|ARM
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|x64.Build.0 = Debug|x64
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|x64.Deploy.0 = Debug|x64
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|x86.Build.0 = Debug|x86
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|x86.Deploy.0 = Debug|x86
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|ARM.Build.0 = Release|ARM
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|ARM.Deploy.0 = Release|ARM
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|x64.ActiveCfg = Release|x64
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|x64.Build.0 = Release|x64
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|x64.Deploy.0 = Release|x64
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|x86.ActiveCfg = Release|x86
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|x86.Build.0 = Release|x86
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|x86.Deploy.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -14,7 +14,7 @@ namespace Microsoft.MicroBit
|
||||
public LicenseDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.textBox.Rtf = Resources.MSR_LA___2576;
|
||||
this.textBox.Text = Resources.MSR_LA___2576;
|
||||
}
|
||||
|
||||
private void acceptButton_Click(object sender, EventArgs e)
|
||||
|
@ -32,7 +32,7 @@ namespace Microsoft.MicroBit
|
||||
private void openEditor()
|
||||
{
|
||||
// lanch editor
|
||||
try { Process.Start("https://codethemicrobit.com"); } catch (Exception) { }
|
||||
try { Process.Start("https://codethemicrobit.com#uploader"); } catch (Exception) { }
|
||||
}
|
||||
|
||||
private void initializeFileWatch()
|
||||
|
@ -34,7 +34,7 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.9.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.9.0.0")]
|
||||
[assembly: AssemblyVersion("0.10.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.10.0.0")]
|
||||
[assembly: CLSCompliant(true)]
|
||||
[assembly: NeutralResourcesLanguage("en-US")]
|
@ -81,8 +81,7 @@ namespace Microsoft.MicroBit.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}
|
||||
///{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}{\f3\fbidi \froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}{\f10\fbidi \fnil\fcharset2\fp [rest of string was truncated]";.
|
||||
/// Looks up a localized string similar to TBD.
|
||||
/// </summary>
|
||||
internal static string MSR_LA___2576 {
|
||||
get {
|
||||
|
@ -118,13 +118,13 @@
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="MSR_LA___2576" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\MSR-LA - 2576.rtf;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<data name="microbit_red" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\microbit.red.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="MSFT_logo_png" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\MSFT_logo_png.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="microbit_red" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\microbit.red.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<data name="MSR_LA___2576" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\MSR-LA - 2576.rtf;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
|
||||
</data>
|
||||
</root>
|
@ -23,6 +23,8 @@ input.onButtonPressed(Button.B, () => {
|
||||
```
|
||||
# About
|
||||
|
||||
### @description A Blocks / Javascript code editor for the micro:bit, a pocket-size computer with 5x5 display, sensors and Bluetooth.
|
||||
|
||||
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 many [partners](https://www.microbit.co.uk/partners).
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
# Blocks language
|
||||
|
||||
### @description Langugage constructs for the Block editor.
|
||||
|
||||
```namespaces
|
||||
for (let i = 0;i<5;++i) {}
|
||||
if (true){}
|
||||
|
54
docs/code.md
Normal file
54
docs/code.md
Normal file
@ -0,0 +1,54 @@
|
||||
# Visual Studio Code
|
||||
|
||||
Visual Studio Code is a Free Open Source code editor that you can use to edit your programs.
|
||||
|
||||
Working from Visual Studio code allows you to benefit from all the features
|
||||
of a professional IDE while working with PXT: working with files,
|
||||
git integration (or source control of your choice), hundreds of extensions.
|
||||
|
||||

|
||||
|
||||
## Setup
|
||||
|
||||
Follow these instructions to setup your machine and edit your programs in Visual Studio Code.
|
||||
|
||||
* install [Visual Studio Code](https://code.visualstudio.com/)
|
||||
* install [Node.JS](https://nodejs.org/en/)
|
||||
* install the PXT Tools (on Mac or Linux, you might have to add ``sudo`` to the command).
|
||||
```
|
||||
pxt install -g pxt
|
||||
```
|
||||
* create a folder for your projects
|
||||
```
|
||||
mkdir microbit
|
||||
```
|
||||
* install the microbit target
|
||||
```
|
||||
pxt target microbit
|
||||
```
|
||||
|
||||
That's it! You are ready to create new projects in code or open existing projects.
|
||||
|
||||
## Creating a new project
|
||||
|
||||
Open a shell to your ``microbit`` folder.
|
||||
|
||||
```
|
||||
# create a new subfolder for your project
|
||||
mkdir myproject
|
||||
cd myproject
|
||||
# start the project set
|
||||
pxt init
|
||||
# open code
|
||||
code .
|
||||
```
|
||||
|
||||
## Opening an existing project
|
||||
|
||||
You can extract a project from the embedded URL or .hex file. Open a shell to your projects folder
|
||||
|
||||
```
|
||||
# extract the project from the URL
|
||||
pxt extract EMBEDURL
|
||||
```
|
||||
where ``EMBEDURL`` is the published project URL.
|
@ -9,7 +9,15 @@ Below is a list of error numbers and what they mean:
|
||||
* **10** (`MICROBIT_I2C_LOCKUP`): the micro:bit's I2C bus is not working
|
||||
* **20** (`MICROBIT_OOM`): there is no free memory on the micro:bit
|
||||
|
||||

|
||||
```sim
|
||||
basic.showLeds(`
|
||||
# . . . #
|
||||
# # . # #
|
||||
. . . . .
|
||||
. # # # .
|
||||
# . . . #
|
||||
`)
|
||||
```
|
||||
|
||||
### See also
|
||||
|
||||
|
@ -40,7 +40,7 @@ Next, compile your script:
|
||||
|
||||
2. Open your script (find the script in **My Scripts** and click `Edit`).
|
||||
|
||||
3. Click `compile`. Your script is converted into a hex file that you can transfer and run on your micro:bit.
|
||||
3. Click **Download**. Your script is converted into a hex file that you can transfer and run on your micro:bit.
|
||||
|
||||
4. When prompted, choose to save the compiled file on your computer (or anywhere other than the micro:bit). Depending on which browser you are using, the download will adopt the download behaviour of that particular browser.
|
||||
|
||||
@ -66,13 +66,13 @@ A dialogue box will appear, asking whether you would like to open or save your h
|
||||
|
||||
**IE10**
|
||||
|
||||
Click on compile. You will see a message “Do you want to save this .hex file.” Select **Save**.
|
||||
Click on **Download**. You will see a message “Do you want to save this .hex file.” Select **Save**.
|
||||
|
||||
### Mac
|
||||
|
||||
** Safari**
|
||||
|
||||
When you select **compile** in Safari on Mac, your file will be downloaded to your downloads folder. Go to your downloads folder and open the file. In Safari the file will appear as unknown.txt rather than a named .hex file. Drag and drop it onto your MICROBIT drive.
|
||||
When you select **Download** in Safari on Mac, your file will be downloaded to your downloads folder. Go to your downloads folder and open the file. In Safari the file will appear as unknown.txt rather than a named .hex file. Drag and drop it onto your MICROBIT drive.
|
||||
|
||||

|
||||
|
||||
@ -86,7 +86,7 @@ A dialogue box will appear, asking whether you would like to open or save your h
|
||||
|
||||
**Chrome**
|
||||
|
||||
When you select **compile** in Chrome, the file will be downloaded to the bottom of the browser in .hex format. Click on the small arrow and select **Show in Finder**. This will show the file in your download folder. Drag and drop the file onto your MICROBIT drive.
|
||||
When you select **Download** in Chrome, the file will be downloaded to the bottom of the browser in .hex format. Click on the small arrow and select **Show in Finder**. This will show the file in your download folder. Drag and drop the file onto your MICROBIT drive.
|
||||
|
||||

|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
# Documentation
|
||||
|
||||
### @description Links to the documentation, reference and projects.
|
||||
|
||||
### Things to do
|
||||
|
||||
* **[Getting Started](/getting-started)**
|
||||
@ -19,6 +21,7 @@
|
||||
### More questions?
|
||||
|
||||
* [Frequently Asked Question](/faq)
|
||||
* [Help Translate](/translate)
|
||||
* [Release notes](/release-notes)
|
||||
|
||||
### Developers
|
||||
|
21
docs/faq.md
21
docs/faq.md
@ -1,9 +1,30 @@
|
||||
# Frequently Asked Questions
|
||||
|
||||
### @description Frequently asked questions and answers from our users.
|
||||
|
||||
### Where can I get a BBC micro:bit?
|
||||
|
||||
More information at [http://uk.farnell.com/bbc-microbit](http://uk.farnell.com/bbc-microbit).
|
||||
|
||||
### How do I send feedback?
|
||||
|
||||
Find the small bubble icon on the bottom of the editor and
|
||||
post your feedback from there!
|
||||
|
||||
### How do I save my code?
|
||||
|
||||
The web editor automatically saves your code in the browser cache. Simply reopen the browser and navigate to the web editor
|
||||
to reopen your latest project. You can also open previous project stored locally through **More -> Open Project**.
|
||||
|
||||
The project source is also stored in each compiled ``.hex`` file. Drag and drop the ``.hex`` file into the web editor to load the project.
|
||||
|
||||
To share your project with others, you can use the **Embed** feature. It stores your project in the cloud and creates a URL that you can share with others.
|
||||
|
||||
If you are using [Visual Studio Code](/code), all your programs are stored as files on your computer and you can use your favorite source control system as needed.
|
||||
|
||||
## Is the web site available in other languages?
|
||||
|
||||
You can [help us translate](/translate) the web site, documentation and blocks via our crowd-source translations!
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
# Getting started
|
||||
|
||||
### @description An activity for beginners to get started with the micro:bit
|
||||
|
||||
## ~avatar
|
||||
|
||||
Here are some challenges for you. Arrange the blocks in the editor
|
||||
@ -33,7 +35,7 @@ When this program runs, you will see a smiley face, then a blank
|
||||
screen, then a smiley again -- it never stops! (That's because of the
|
||||
``forever`` block.)
|
||||
|
||||
Click **Compile** to move your program to the BBC micro:bit!
|
||||
Click **Download** to move your program to the BBC micro:bit!
|
||||
Make sure to follow the instructions.
|
||||
|
||||
### ~button /getting-started/screen
|
||||
|
@ -37,7 +37,7 @@ You can find the letter `B` by clicking the letter `A` on the
|
||||
|
||||
#### ~
|
||||
|
||||
Click **Compile** to move your program to the BBC micro:bit!
|
||||
Click **Download** to move your program to the BBC micro:bit!
|
||||
|
||||
#### Your turn!
|
||||
|
||||
@ -65,7 +65,7 @@ input.onPinPressed(TouchPin.P0, () => {
|
||||
. . # . .`);
|
||||
});
|
||||
```
|
||||
Click **Compile** to move your program to the BBC micro:bit!
|
||||
Click **Download** to move your program to the BBC micro:bit!
|
||||
|
||||
## ~hint
|
||||
|
||||
|
@ -152,7 +152,7 @@ That's why you can use an ``else`` instead of an ``else if``.
|
||||
|
||||
Your game is ready!
|
||||
|
||||
Click **Compile** to move your program to the BBC micro:bit!
|
||||
Click **Download** to move your program to the BBC micro:bit!
|
||||
|
||||
Have fun!
|
||||
|
||||
@ -198,7 +198,7 @@ input.onButtonPressed(Button.B, () => {
|
||||
basic.showNumber(game.score())
|
||||
})
|
||||
```
|
||||
Click **Compile** to move your program to the BBC micro:bit!
|
||||
Click **Download** to move your program to the BBC micro:bit!
|
||||
|
||||
### ~button /projects
|
||||
NEXT: PROJECTS!
|
||||
|
@ -32,7 +32,7 @@ basic.forever(() => {
|
||||
`)
|
||||
});
|
||||
```
|
||||
Click **Compile** to move your program to the BBC micro:bit!
|
||||
Click **Download** to move your program to the BBC micro:bit!
|
||||
|
||||
### Your turn!
|
||||
|
||||
@ -85,7 +85,7 @@ basic.forever(() => {
|
||||
`)
|
||||
});
|
||||
```
|
||||
Click **Compile** to move your program to the BBC micro:bit!
|
||||
Click **Download** to move your program to the BBC micro:bit!
|
||||
|
||||
#### ~hint
|
||||
|
||||
|
@ -17,7 +17,7 @@ input.onGesture(Gesture.Shake, () => {
|
||||
# . . . #`);
|
||||
});
|
||||
```
|
||||
Click **Compile** to move your program to the BBC micro:bit!
|
||||
Click **Download** to move your program to the BBC micro:bit!
|
||||
|
||||
### ~button /getting-started/coin-flipper
|
||||
NEXT: COIN FLIPPER GAME
|
||||
|
@ -1,4 +1,4 @@
|
||||
# JavaScript and TypeScript
|
||||
# JavaScript
|
||||
|
||||
Visit the cards below to starting programming JavaScript and TypeScript with the micro:bit:
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
# Lessons
|
||||
|
||||
### @description Lessons to teach computer science and coding.
|
||||
|
||||
### @short Lessons
|
||||
|
||||
### ~column
|
||||
|
@ -42,7 +42,7 @@ We want the message "Press A!" to scroll across the BBC micro:bit, so right-clic
|
||||
|
||||

|
||||
|
||||
So, to recap: the `forever` block makes sure our code runs forever. The BBC micro:bit checks if the user is pressing the left button, if the user is not then the “Press the button!” message will scroll across the LEDs. If the user is pressing the button then the “hello, world!” message will scroll across the screen. Check this in the simulator or attach the BBC micro:bit to the computer then click **compile** to send the code onto the BBC micro:bit.
|
||||
So, to recap: the `forever` block makes sure our code runs forever. The BBC micro:bit checks if the user is pressing the left button, if the user is not then the “Press the button!” message will scroll across the LEDs. If the user is pressing the button then the “hello, world!” message will scroll across the screen. Check this in the simulator or attach the BBC micro:bit to the computer then click **Download** to send the code onto the BBC micro:bit.
|
||||
|
||||
## What is a condition?
|
||||
|
||||
|
@ -92,7 +92,7 @@ Connect a micro:bit to your computer using your USB cable
|
||||
|
||||

|
||||
|
||||
Click or tap the compile button for the seismograph program to run the program on the micro:bit.
|
||||
Click or tap the **Download** button for the seismograph program to run the program on the micro:bit.
|
||||
|
||||

|
||||
|
||||
|
@ -116,7 +116,7 @@ Connect the 2nd micro:bit to your computer using your USB cable. We should have
|
||||
|
||||
## 8.
|
||||
|
||||
Click or tap the compile button for the seismograph program to run the program on the 1st micro:bit and 2nd micro:bit.
|
||||
Click or tap the **Download** button for the seismograph program to run the program on the 1st micro:bit and 2nd micro:bit.
|
||||
|
||||
## 9.
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
The editor is open source on GitHub under the MIT license. Contributions are welcome, please check our GitHub repos.
|
||||
|
||||
### Source Code
|
||||
## Source Code
|
||||
|
||||
* [microsoft/pxt-microbit](https://github.com/Microsoft/pxt-microbit), PXT target for BBC micro:bit, also includes the documentation.
|
||||
* [microbit/pxt](https://github.com/Microsoft/pxt), programming experience toolkit (PXT)
|
||||
@ -12,3 +12,8 @@ The editor is open source on GitHub under the MIT license. Contributions are wel
|
||||
|
||||
The [C++ micro:bit runtime](http://lancaster-university.github.io/microbit-docs/), 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).
|
||||
|
||||
## Packages
|
||||
|
||||
* [microsoft/pxt-neopixel](https://github.com/microsoft/pxt-neopixel), package for neopixel strips
|
||||
* [microsoft/pxt-max6675](https://github.com/microsoft/pxt-max6675), package for Temperature Probe (MAX6675)
|
@ -1,14 +1,19 @@
|
||||
# Extensions
|
||||
# Packages
|
||||
|
||||
You can publish libraries (also known as packages or extensions)
|
||||
that users can then add to their scripts. These typically
|
||||
provide a driver for a particular hardware device you can connect
|
||||
to a microbit.
|
||||
|
||||
* [pxt-max6675](https://github.com/Microsoft/pxt-max6675) -- TypeScript
|
||||
* [pxt-neopixel](https://github.com/Microsoft/pxt-neopixel) -- TypeScript + ARM Thumb assembly package
|
||||
* [pxt-sonar](https://github.com/microsoft/pxt-sonar) -- TypeScript
|
||||
* [pxt-i2c-fram](https://github.com/microsoft/pxt-i2c-fram) -- TypeScript
|
||||
|
||||
* [Sample C++ extension](https://github.com/Microsoft/pxt-microbit-cppsample)
|
||||
* [Sample TypeScript extension](https://github.com/Microsoft/pxt-microbit/tree/master/libs/i2c-fram)
|
||||
|
||||
## Finding libraries
|
||||
## Finding packages
|
||||
|
||||
From the editor, the user clicks on **More** then **Add Package** and searches for the package.
|
||||
|
||||
@ -16,11 +21,11 @@ To see the list of packages, click on **More** then **Show Files** to see the pr
|
||||
|
||||
To remove a package, click on the garbage button in the file list next to the package.
|
||||
|
||||
## Publishing libraries
|
||||
## Publishing packages
|
||||
|
||||
Packages can be published from the pxt command line. We are still sorting out the details.
|
||||
|
||||
## Localizing libraries
|
||||
## Localizing packages
|
||||
|
||||
It is possible to package localization strings for the **jsDoc** description associated to the API in the package.
|
||||
|
||||
|
@ -69,7 +69,7 @@ input.onButtonPressed(Button.A, () => {
|
||||
});
|
||||
```
|
||||
|
||||
* click *compile* and run your code on the micro:bit.
|
||||
* click **Download** and run your code on the micro:bit.
|
||||
|
||||
### ~button /projects/banana-keyboard
|
||||
NEXT: Banana Keyboard
|
||||
|
@ -29,7 +29,7 @@ radio.onDataReceived(() => {
|
||||
})
|
||||
```
|
||||
|
||||
Compile the program and **upload the same .hex file to 2 devices!**
|
||||
Download the program and **upload the same .hex file to 2 devices!**
|
||||
|
||||
## Step 3
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
# Reference
|
||||
|
||||
### @description List of API categories available in the editors
|
||||
|
||||
```namespaces
|
||||
basic.showNumber(0);
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
|
@ -7,8 +7,9 @@ control.inBackground(() => {
|
||||
|
||||
});
|
||||
control.reset();
|
||||
control.waitMicros(4);
|
||||
```
|
||||
|
||||
### See Also
|
||||
|
||||
[inBackground](/reference/control/in-background), [reset](/reference/control/reset)
|
||||
[inBackground](/reference/control/in-background), [reset](/reference/control/reset), [wait-micros](/reference/control/wait-micros)
|
||||
|
32
docs/reference/control/wait-micros.md
Normal file
32
docs/reference/control/wait-micros.md
Normal file
@ -0,0 +1,32 @@
|
||||
# WaitMicros
|
||||
|
||||
Blocks the current fiber for the given amount of micro-seconds.
|
||||
|
||||
```sig
|
||||
control.waitMicros(4)
|
||||
```
|
||||
|
||||
### Example
|
||||
|
||||
This program sends a 10 micro-second HIGH pulse through pin ``P0``.
|
||||
|
||||
```blocks
|
||||
// ensure pin is low to send a clean pulse
|
||||
pins.digitalWritePin(DigitalPin.P0, 0)
|
||||
control.waitMicros(2)
|
||||
// set pin to 1 and wait 10 micros
|
||||
pins.digitalWritePin(DigitalPin.P0, 1)
|
||||
control.waitMicros(10)
|
||||
// finish pulse
|
||||
pins.digitalWritePin(DigitalPin.P0, 0)
|
||||
```
|
||||
|
||||
#### ~hint
|
||||
|
||||
This function is not supported in the simulator.
|
||||
|
||||
#### ~
|
||||
|
||||
### See Also
|
||||
|
||||
[pause](/reference/basic/pause)
|
@ -13,6 +13,7 @@ pins.onPulsed(DigitalPin.P0, PulseValue.High, () => {
|
||||
|
||||
});
|
||||
pins.pulseDuration();
|
||||
pins.pulseIn(DigitalPin.P0, PulseValue.High);
|
||||
pins.servoWritePin(AnalogPin.P0, 180);
|
||||
pins.servoSetPulse(AnalogPin.P0, 1500);
|
||||
pins.i2cReadNumber(0, NumberFormat.Int8LE);
|
||||
@ -25,4 +26,4 @@ pins.analogSetPitchPin(AnalogPin.P0);
|
||||
|
||||
### See Also
|
||||
|
||||
[digitalReadPin](/reference/pins/digital-read-pin), [digitalWritePin](/reference/pins/digital-write-pin), [analogReadPin](/reference/pins/analog-read-pin), [analogWritePin](/reference/pins/analog-write-pin), [analogSetPeriod](/reference/pins/analog-set-period), [map](/reference/pins/map), [onPulsed](/reference/pins/on-pulsed), [pulseDuration](/reference/pins/pulse-duration), [servoWritePin](/reference/pins/servo-write-pin), [servoSetPulse](/reference/pins/servo-set-pulse), [i2cReadNumber](/reference/pins/i2c-read-number), [i2cWriteNumber](/reference/pins/i2c-write-number), [setPull](/reference/pins/set-pull), [analogPitch](/reference/pins/analog-pitch), [analogSetPitchPin](/reference/pins/analog-set-pitch), [spiWrite](/reference/pins/spi-write)
|
||||
[digitalReadPin](/reference/pins/digital-read-pin), [digitalWritePin](/reference/pins/digital-write-pin), [analogReadPin](/reference/pins/analog-read-pin), [analogWritePin](/reference/pins/analog-write-pin), [analogSetPeriod](/reference/pins/analog-set-period), [map](/reference/pins/map), [onPulsed](/reference/pins/on-pulsed), [pulseDuration](/reference/pins/pulse-duration), [pulseIn](/reference/pins/pulse-in), [servoWritePin](/reference/pins/servo-write-pin), [servoSetPulse](/reference/pins/servo-set-pulse), [i2cReadNumber](/reference/pins/i2c-read-number), [i2cWriteNumber](/reference/pins/i2c-write-number), [setPull](/reference/pins/set-pull), [analogPitch](/reference/pins/analog-pitch), [analogSetPitchPin](/reference/pins/analog-set-pitch), [spiWrite](/reference/pins/spi-write)
|
||||
|
@ -27,6 +27,12 @@ format from the 7-bit I2C address `32`.
|
||||
pins.i2cReadNumber(32, NumberFormat.UInt16BE);
|
||||
```
|
||||
|
||||
#### ~hint
|
||||
|
||||
This function is not supported in the simulator.
|
||||
|
||||
#### ~
|
||||
|
||||
### See also
|
||||
|
||||
[I2C](https://en.wikipedia.org/wiki/I%C2%B2C)
|
||||
|
@ -27,6 +27,13 @@ address `32` in big-endian 32-bit integer format.
|
||||
```blocks
|
||||
pins.i2cWriteNumber(32, 2055, NumberFormat.Int32BE);
|
||||
```
|
||||
|
||||
#### ~hint
|
||||
|
||||
This function is not supported in the simulator.
|
||||
|
||||
#### ~
|
||||
|
||||
### See also
|
||||
|
||||
[I2C](https://en.wikipedia.org/wiki/I%C2%B2C)
|
||||
|
54
docs/reference/pins/pulse-in.md
Normal file
54
docs/reference/pins/pulse-in.md
Normal file
@ -0,0 +1,54 @@
|
||||
# Pulse In
|
||||
|
||||
Returns the duration of a pulse (high or low) from a [pin](/device/pins) on
|
||||
the micro:bit board in microseconds.
|
||||
|
||||
```sig
|
||||
pins.pulseIn(DigitalPin.P0, PulseValue.High)
|
||||
```
|
||||
|
||||
### ~avatar
|
||||
|
||||
Some pins are also used by the [LED screen](/device/screen).
|
||||
Please read the [page about pins](/device/pins) carefully.
|
||||
|
||||
### ~
|
||||
|
||||
### Parameters
|
||||
|
||||
* ``name`` is a [string](/reference/types/string) that stores the name of the pin (``P0``, ``P1``, or ``P2``, up through ``P20``)
|
||||
* ``value`` is the value of the pulse, ``high`` or ``low``
|
||||
* ``maxDuration``, maximum duration in micro-seconds. If no pulse is received
|
||||
|
||||
### Returns
|
||||
|
||||
* a [number](/reference/types/number) that represents the pulse duration in micro-seconds
|
||||
|
||||
### Example: Measuring distance with a sonar
|
||||
|
||||
The following script sends a pulse on ``P0`` and reads the pulse returned by a HC-SR04 sonar to determine the distance of the object in front of the sensor.
|
||||
|
||||
```blocks
|
||||
basic.forever(() => {
|
||||
// send pulse
|
||||
pins.digitalWritePin(DigitalPin.P0, 0)
|
||||
control.waitMicros(2)
|
||||
pins.digitalWritePin(DigitalPin.P0, 1)
|
||||
control.waitMicros(10)
|
||||
pins.digitalWritePin(DigitalPin.P0, 0)
|
||||
|
||||
// read pulse
|
||||
led.plotBarGraph(pins.pulseIn(DigitalPin.P1, PulseValue.High) / 58, 0)
|
||||
basic.pause(100)
|
||||
})
|
||||
```
|
||||
|
||||
#### ~hint
|
||||
|
||||
This function is not supported in the simulator.
|
||||
|
||||
#### ~
|
||||
|
||||
### See also
|
||||
|
||||
[digital write pin](/reference/pins/digital-write-pin),
|
@ -1,9 +1,16 @@
|
||||
# Release notes
|
||||
|
||||
### @description Editor release notes
|
||||
|
||||
```sim
|
||||
basic.forever(() => { basic.showString("RELEASE NOTES"); });
|
||||
```
|
||||
|
||||
## August 2016
|
||||
|
||||
* The JavaScript editor is using Monaco
|
||||
* New [package system](/packages) based on GitHub
|
||||
|
||||
## June 2016
|
||||
|
||||
* It is now possible to stream data into the cloud (Azure) from the PXT editor. Simply click on the log view to get started.
|
||||
|
BIN
docs/static/mb/device/error-codes-0.png
vendored
BIN
docs/static/mb/device/error-codes-0.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 284 KiB |
BIN
docs/static/mb/device/reactive-2.png
vendored
BIN
docs/static/mb/device/reactive-2.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 22 KiB |
BIN
docs/static/mb/device/screen-0.png
vendored
BIN
docs/static/mb/device/screen-0.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 17 KiB |
@ -1,3 +1,5 @@
|
||||
# Support
|
||||
|
||||
Please use the [GitHub issue tracker](https://github.com/microsoft/pxt-microbit) to report bugs.
|
||||
Send us your feedback and ideas on our [User Voice Forum](https://touchdevelop.uservoice.com/forums/402381-code-the-micro-bit/).
|
||||
|
||||
You can also use our [GitHub issue tracker](https://github.com/microsoft/pxt-microbit) to report bugs.
|
28
docs/translate.md
Normal file
28
docs/translate.md
Normal file
@ -0,0 +1,28 @@
|
||||
# Help translate
|
||||
|
||||
Our translations are managed via Crowdin, a translation management platform. It is free to join
|
||||
and you can volunteer to translate parts of the web site.
|
||||
|
||||
## Translating the editor interface
|
||||
|
||||
The project below contains the resources from https://www.pxt.io and the menu items of https://codethemicrobit.com.
|
||||
|
||||
* [https://crowdin.com/project/kindscript](https://crowdin.com/project/kindscript)
|
||||
|
||||
You will find two files in that project:
|
||||
|
||||
* ``string.json``: text contained in the menu items of https://codethemicrobit.com
|
||||
* ``website.json``: text contained in the pages served by https://www.pxt.io
|
||||
|
||||
## Translating the blocks and reference documentation
|
||||
|
||||
The project below contains the resources from the blocks and functions using in the https://codethemicrobit.com.
|
||||
|
||||
* [https://crowdin.com/project/pxt-microbit](https://crowdin.com/project/pxt-microbit)
|
||||
|
||||
You will find two files for each package available in the micro:bit, one for the block definition and one for the descriptions:
|
||||
|
||||
* ``microbit-strings.json``: contains the block definitions
|
||||
* ``microbit-jsdoc-strings.json``: contains the descriptions
|
||||
|
||||
The block definition should be carefully translated using the [block definition syntax](https://www.pxt.io/defining-blocks).
|
@ -1,5 +1,7 @@
|
||||
# Uploader
|
||||
|
||||
### @description A Windows application that automatically deploys .hex files to connected micro:bit boards
|
||||
|
||||
### ~avatar avatar
|
||||
|
||||
The Uploader **automatically** deploys .hex files to all micro:bits connected to your computer.
|
||||
|
@ -22,6 +22,7 @@ console.log("Starting...")
|
||||
basic.showNumber(0);
|
||||
|
||||
testBuffer()
|
||||
testBufferShiftRotate()
|
||||
|
||||
basic.showNumber(2);
|
||||
console.log("ALL TESTS OK")
|
||||
@ -75,3 +76,63 @@ function testBuffer() {
|
||||
b.shift(-1)
|
||||
bufferIs(b, [0, 4, 13]);
|
||||
}
|
||||
|
||||
|
||||
function testBufferShiftRotate() {
|
||||
let b = pins.createBuffer(5);
|
||||
|
||||
function initb() {
|
||||
for (let i = 0; i < b.length; ++i) {
|
||||
b[i] = i;
|
||||
}
|
||||
}
|
||||
function assertb(ex: number[]) {
|
||||
bufferIs(b, ex)
|
||||
}
|
||||
|
||||
initb()
|
||||
assertb([0, 1, 2, 3, 4])
|
||||
|
||||
//shifting
|
||||
initb()
|
||||
b.shift(-1);
|
||||
assertb([0, 0, 1, 2, 3])
|
||||
|
||||
initb()
|
||||
b.shift(-1, 0, 3);
|
||||
assertb([0, 0, 1, 3, 4])
|
||||
|
||||
initb()
|
||||
b.shift(-1, 1, 3);
|
||||
assertb([0, 0, 1, 2, 4])
|
||||
|
||||
initb()
|
||||
b.shift(1)
|
||||
assertb([1, 2, 3, 4, 0])
|
||||
|
||||
initb()
|
||||
b.shift(1, 1, 3)
|
||||
assertb([0, 2, 3, 0, 4])
|
||||
|
||||
//rotating
|
||||
initb()
|
||||
b.rotate(-1);
|
||||
assertb([4, 0, 1, 2, 3])
|
||||
|
||||
initb()
|
||||
b.rotate(-1, 0, 3);
|
||||
assertb([2, 0, 1, 3, 4])
|
||||
|
||||
initb()
|
||||
b.rotate(-1, 1, 3);
|
||||
assertb([0, 3, 1, 2, 4])
|
||||
|
||||
initb()
|
||||
b.rotate(2)
|
||||
assertb([2, 3, 4, 0, 1])
|
||||
|
||||
initb()
|
||||
b.rotate(1, 1, 3)
|
||||
assertb([0, 2, 3, 1, 4])
|
||||
|
||||
}
|
||||
|
@ -129,12 +129,22 @@ namespace control {
|
||||
/**
|
||||
* Resets the BBC micro:bit.
|
||||
*/
|
||||
//% weight=30 async help=control/reset
|
||||
//% weight=30 async help=control/reset blockGap=8
|
||||
//% blockId="control_reset" block="reset"
|
||||
void reset() {
|
||||
microbit_reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* Blocks the current fiber for the given microseconds
|
||||
* @param micros number of micro-seconds to wait. eg: 4
|
||||
*/
|
||||
//% help=control/wait-micros weight=29
|
||||
//% blockId="control_wait_us" block="wait (µs)%micros"
|
||||
void waitMicros(int micros) {
|
||||
wait_us(micros);
|
||||
}
|
||||
|
||||
/**
|
||||
* Raises an event in the event bus.
|
||||
* @param src ID of the MicroBit Component that generated the event e.g. MICROBIT_ID_BUTTON_A.
|
||||
|
@ -171,9 +171,13 @@ namespace pxt {
|
||||
//%
|
||||
void registerWithDal(int id, int event, Action a);
|
||||
//%
|
||||
void runAction0(Action a);
|
||||
uint32_t runAction3(Action a, int arg0, int arg1, int arg2);
|
||||
//%
|
||||
void runAction1(Action a, int arg);
|
||||
uint32_t runAction2(Action a, int arg0, int arg1);
|
||||
//%
|
||||
uint32_t runAction1(Action a, int arg0);
|
||||
//%
|
||||
uint32_t runAction0(Action a);
|
||||
//%
|
||||
Action mkAction(int reflen, int totallen, int startptr);
|
||||
//%
|
||||
|
@ -162,7 +162,8 @@ namespace music {
|
||||
//% help=music/change-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);
|
||||
init();
|
||||
setTempo(beatsPerMinute + bpm);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -160,11 +160,40 @@ namespace pins {
|
||||
*/
|
||||
//% help=pins/pulse-duration
|
||||
//% blockId=pins_pulse_duration block="pulse duration (µs)"
|
||||
//% weight=21
|
||||
//% weight=21 blockGap=8
|
||||
int pulseDuration() {
|
||||
return pxt::lastEvent.timestamp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the duration of a pulse in microseconds
|
||||
* @param name the pin which measures the pulse
|
||||
* @param value the value of the pulse (default high)
|
||||
* @param maximum duration in micro-seconds
|
||||
*/
|
||||
//% blockId="pins_pulse_in" block="pulse in (µs)|pin %name|pulsed %value"
|
||||
//% weight=20
|
||||
int pulseIn(DigitalPin name, PulseValue value, int maxDuration = 2000000) {
|
||||
MicroBitPin* pin = getPin((int)name);
|
||||
if (!pin) return 0;
|
||||
|
||||
int pulse = value == PulseValue::High ? 1 : 0;
|
||||
uint64_t tick = system_timer_current_time_us();
|
||||
uint64_t maxd = (uint64_t)maxDuration;
|
||||
while(pin->getDigitalValue() != pulse) {
|
||||
if(system_timer_current_time_us() - tick > maxd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t start = system_timer_current_time_us();
|
||||
while(pin->getDigitalValue() == pulse) {
|
||||
if(system_timer_current_time_us() - tick > maxd)
|
||||
return 0;
|
||||
}
|
||||
uint64_t end = system_timer_current_time_us();
|
||||
return end - start;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).
|
||||
* @param name pin to write to
|
||||
|
@ -11,7 +11,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=pins/map weight=22
|
||||
//% help=pins/map weight=23
|
||||
//% 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;
|
||||
|
22
libs/microbit/shims.d.ts
vendored
22
libs/microbit/shims.d.ts
vendored
@ -333,10 +333,18 @@ declare namespace control {
|
||||
/**
|
||||
* Resets the BBC micro:bit.
|
||||
*/
|
||||
//% weight=30 async help=control/reset
|
||||
//% weight=30 async help=control/reset blockGap=8
|
||||
//% blockId="control_reset" block="reset" shim=control::reset
|
||||
function reset(): void;
|
||||
|
||||
/**
|
||||
* Blocks the current fiber for the given microseconds
|
||||
* @param micros number of micro-seconds to wait. eg: 4
|
||||
*/
|
||||
//% help=control/wait-micros weight=29
|
||||
//% blockId="control_wait_us" block="wait (µs)%micros" shim=control::waitMicros
|
||||
function waitMicros(micros: number): void;
|
||||
|
||||
/**
|
||||
* Raises an event in the event bus.
|
||||
* @param src ID of the MicroBit Component that generated the event e.g. MICROBIT_ID_BUTTON_A.
|
||||
@ -506,9 +514,19 @@ declare namespace pins {
|
||||
*/
|
||||
//% help=pins/pulse-duration
|
||||
//% blockId=pins_pulse_duration block="pulse duration (µs)"
|
||||
//% weight=21 shim=pins::pulseDuration
|
||||
//% weight=21 blockGap=8 shim=pins::pulseDuration
|
||||
function pulseDuration(): number;
|
||||
|
||||
/**
|
||||
* Returns the duration of a pulse in microseconds
|
||||
* @param name the pin which measures the pulse
|
||||
* @param value the value of the pulse (default high)
|
||||
* @param maximum duration in micro-seconds
|
||||
*/
|
||||
//% blockId="pins_pulse_in" block="pulse in (µs)|pin %name|pulsed %value"
|
||||
//% weight=20 maxDuration.defl=2000000 shim=pins::pulseIn
|
||||
function pulseIn(name: DigitalPin, value: PulseValue, maxDuration?: number): number;
|
||||
|
||||
/**
|
||||
* Writes a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).
|
||||
* @param name pin to write to
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "pxt-microbit",
|
||||
"version": "0.3.20",
|
||||
"description": "BBC micro:bit target for PXT",
|
||||
"version": "0.3.43",
|
||||
"description": "micro:bit target for PXT",
|
||||
"keywords": [
|
||||
"JavaScript",
|
||||
"education",
|
||||
@ -29,6 +29,6 @@
|
||||
"typescript": "^1.8.7"
|
||||
},
|
||||
"dependencies": {
|
||||
"pxt-core": "0.3.23"
|
||||
"pxt-core": "0.3.47"
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
"id": "microbit",
|
||||
"name": "code the micro:bit",
|
||||
"title": "code the micro:bit - Blocks / Javascript editor",
|
||||
"description": "A Blocks / JavaScript code editor for the micro:bit.",
|
||||
"corepkg": "microbit",
|
||||
"bundleddirs": [
|
||||
"libs/microbit",
|
||||
@ -13,7 +14,10 @@
|
||||
"workspace": false,
|
||||
"packages": true,
|
||||
"preferredPackages": [
|
||||
"Microsoft/pxt-neopixel"
|
||||
"Microsoft/pxt-neopixel",
|
||||
"Microsoft/pxt-sonar",
|
||||
"Microsoft/pxt-max6675",
|
||||
"Microsoft/pxt-i2c-fram"
|
||||
]
|
||||
},
|
||||
"blocksprj": {
|
||||
@ -32,7 +36,7 @@
|
||||
},
|
||||
"files": {
|
||||
"main.blocks": "<xml xmlns=\"http://www.w3.org/1999/xhtml\">\n<block type=\"device_forever\">\n<statement name=\"HANDLER\">\n<block type=\"device_show_leds\">\n<field name=\"LED00\">FALSE</field>\n<field name=\"LED10\">FALSE</field>\n<field name=\"LED20\">FALSE</field>\n<field name=\"LED30\">FALSE</field>\n<field name=\"LED40\">FALSE</field>\n<field name=\"LED01\">FALSE</field>\n<field name=\"LED11\">TRUE</field>\n<field name=\"LED21\">FALSE</field>\n<field name=\"LED31\">TRUE</field>\n<field name=\"LED41\">FALSE</field>\n<field name=\"LED02\">FALSE</field>\n<field name=\"LED12\">FALSE</field>\n<field name=\"LED22\">FALSE</field>\n<field name=\"LED32\">FALSE</field>\n<field name=\"LED42\">FALSE</field>\n<field name=\"LED03\">TRUE</field>\n<field name=\"LED13\">FALSE</field>\n<field name=\"LED23\">FALSE</field>\n<field name=\"LED33\">FALSE</field>\n<field name=\"LED43\">TRUE</field>\n<field name=\"LED04\">FALSE</field>\n<field name=\"LED14\">TRUE</field>\n<field name=\"LED24\">TRUE</field>\n<field name=\"LED34\">TRUE</field>\n<field name=\"LED44\">FALSE</field>\n<next>\n<block type=\"device_show_leds\">\n<field name=\"LED00\">FALSE</field>\n<field name=\"LED10\">FALSE</field>\n<field name=\"LED20\">FALSE</field>\n<field name=\"LED30\">FALSE</field>\n<field name=\"LED40\">FALSE</field>\n<field name=\"LED01\">FALSE</field>\n<field name=\"LED11\">FALSE</field>\n<field name=\"LED21\">FALSE</field>\n<field name=\"LED31\">FALSE</field>\n<field name=\"LED41\">FALSE</field>\n<field name=\"LED02\">FALSE</field>\n<field name=\"LED12\">FALSE</field>\n<field name=\"LED22\">FALSE</field>\n<field name=\"LED32\">FALSE</field>\n<field name=\"LED42\">FALSE</field>\n<field name=\"LED03\">FALSE</field>\n<field name=\"LED13\">FALSE</field>\n<field name=\"LED23\">FALSE</field>\n<field name=\"LED33\">FALSE</field>\n<field name=\"LED43\">FALSE</field>\n<field name=\"LED04\">FALSE</field>\n<field name=\"LED14\">FALSE</field>\n<field name=\"LED24\">FALSE</field>\n<field name=\"LED34\">FALSE</field>\n<field name=\"LED44\">FALSE</field>\n</block>\n</next>\n</block>\n</statement>\n</block>\n</xml>",
|
||||
"main.ts": "\r\n"
|
||||
"main.ts": "basic.forever(() => {\r\n basic.showLeds(`\r\n . # . # .\r\n # . # . #\r\n # . . . #\r\n . # . # .\r\n . . # . .\r\n `)\r\n basic.showLeds(`\r\n . . . . .\r\n . . . . .\r\n . . . . .\r\n . . . . .\r\n . . . . .\r\n `)\r\n})\r\n"
|
||||
}
|
||||
},
|
||||
"tsprj": {
|
||||
@ -73,7 +77,7 @@
|
||||
"yottaTarget": "bbc-microbit-classic-gcc",
|
||||
"yottaCorePackage": "pxt-microbit-core",
|
||||
"githubCorePackage": "microsoft/pxt-microbit-core",
|
||||
"gittag": "v0.2.2",
|
||||
"gittag": "v0.3.1",
|
||||
"serviceId": "ws"
|
||||
},
|
||||
"serial": {
|
||||
|
@ -227,6 +227,10 @@ namespace pxsim.control {
|
||||
U.userError("reset not implemented in simulator yet")
|
||||
}
|
||||
|
||||
export function waitMicros(micros: number) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
export function deviceName(): string {
|
||||
let b = board();
|
||||
return b && b.id
|
||||
@ -588,6 +592,13 @@ namespace pxsim.pins {
|
||||
// TODO
|
||||
}
|
||||
|
||||
export function pulseIn(name: number, value: number, maxDuration: number): number {
|
||||
let pin = getPin(name);
|
||||
if (!pin) return 0;
|
||||
|
||||
return 5000;
|
||||
}
|
||||
|
||||
export function spiWrite(value: number): number {
|
||||
// TODO
|
||||
return 0;
|
||||
|
@ -551,7 +551,6 @@ namespace pxsim {
|
||||
default: theme = pxsim.micro_bit.randomTheme();
|
||||
}
|
||||
|
||||
console.log("setting up microbit simulator")
|
||||
let view = new pxsim.micro_bit.MicrobitBoardSvg({
|
||||
theme: theme,
|
||||
runtime: runtime
|
||||
|
10
travis-tests.sh
Executable file
10
travis-tests.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
set -x
|
||||
export KS_FORCE_CLOUD=yes
|
||||
(cd libs/lang-test0; node ../../node_modules/pxt-core/built/pxt.js run)
|
||||
(cd libs/lang-test1; node ../../node_modules/pxt-core/built/pxt.js run)
|
||||
(cd libs/lang-test0; node ../../node_modules/pxt-core/built/pxt.js test)
|
||||
(cd libs/lang-test1; node ../../node_modules/pxt-core/built/pxt.js test)
|
||||
node node_modules/pxt-core/built/pxt.js testdir tests
|
||||
(cd libs/hello; node ../../node_modules/pxt-core/built/pxt.js testconv https://az851932.vo.msecnd.net/files/td-converter-tests-v0.json)
|
Reference in New Issue
Block a user