Compare commits
250 Commits
Author | SHA1 | Date | |
---|---|---|---|
0a746f5bbe | |||
066408c317 | |||
90f7b229d1 | |||
c54e0b0e9d | |||
ea088ac828 | |||
29cf4d3e53 | |||
6d637eefd7 | |||
6310e96ac2 | |||
dbb1e31822 | |||
5376bc2dce | |||
57bd293df8 | |||
e570d46755 | |||
d37f284fce | |||
b716226889 | |||
1bd19cc1a0 | |||
ac8c9c5e85 | |||
057260c483 | |||
568ae32f81 | |||
ae605ff829 | |||
f25ddb1085 | |||
f175f973f0 | |||
c7e5fa490e | |||
61a29f7c67 | |||
50293fc654 | |||
a9ecadaf09 | |||
6e56107eb5 | |||
1f077beb65 | |||
8fff762156 | |||
cebded2526 | |||
13f53d730a | |||
8adcab1cab | |||
8cb5f442f9 | |||
96448d5237 | |||
30f01bb0ac | |||
3d0b397de2 | |||
e0de55d689 | |||
7637a98f07 | |||
95f94e0886 | |||
9a2367cf8e | |||
15fecb77c4 | |||
4f69bbabfb | |||
8351ed0513 | |||
c34b0a1aeb | |||
9bcd44d7e4 | |||
3403da8ce8 | |||
39c146329f | |||
8d0d0a7e9a | |||
61b3783dd4 | |||
da16428842 | |||
359c456577 | |||
b3d9c167e1 | |||
78398b220f | |||
a656fbbd7b | |||
e681cc8c97 | |||
03beec9c49 | |||
1600644be5 | |||
a3dd64eb4c | |||
b865cce44e | |||
dc42900c7f | |||
dcc3bd95fe | |||
61e63831aa | |||
5651c3b9ba | |||
a562557bca | |||
d890c05229 | |||
4340e1f7ed | |||
e2e4c68f85 | |||
3f6a3089f1 | |||
84a0c0fe56 | |||
5237b86cf5 | |||
473950e491 | |||
fd33610511 | |||
47ea4e01d2 | |||
16199cfcea | |||
8a4556e70c | |||
bfc2641637 | |||
ef7fdc2ef7 | |||
a8b427fd89 | |||
79c23e2e2a | |||
4070d4e691 | |||
7048156b46 | |||
c11acce579 | |||
f79551073e | |||
232758805b | |||
211d4e5538 | |||
374d8c590d | |||
c6c133ef9e | |||
817e86f5aa | |||
19e33d029d | |||
e3671ca809 | |||
1f3a2ab6fe | |||
dad3e89577 | |||
df9d3c4444 | |||
edc489c83d | |||
fb29af8011 | |||
516def7a3f | |||
b5cb8deb93 | |||
658083b4eb | |||
1441129355 | |||
2b87b26f00 | |||
741facc769 | |||
41a5bc72a1 | |||
9d5e93b879 | |||
32e0cb0fe8 | |||
a224259e74 | |||
c144f3a15d | |||
a3fa07463f | |||
aa20f2fa4d | |||
4a1399de59 | |||
0b8e5c12c3 | |||
445066776b | |||
6cb204c548 | |||
6ed6a525fd | |||
ba6dc9f136 | |||
98bc8d2a27 | |||
58d0e238e3 | |||
ae17d4380e | |||
f79b726f87 | |||
0f3c7b8c0f | |||
dac6f5af73 | |||
99fb074952 | |||
66ba26586f | |||
e27c4de108 | |||
f19a110953 | |||
626055d3eb | |||
9085c98c7f | |||
85e3148f23 | |||
60f8dd8228 | |||
c2e37a2c6e | |||
b4ad4819a5 | |||
d9f2c7cc42 | |||
15638d2767 | |||
5ecd20583b | |||
4c27d62796 | |||
90da72a8de | |||
8f50beb938 | |||
52527dd584 | |||
fc0faf5181 | |||
cd9589e562 | |||
a34bcee7a2 | |||
d011cdb37e | |||
af7c51b954 | |||
a65e71f3b1 | |||
89e899cc79 | |||
b37e823b57 | |||
8cb31daa48 | |||
a984778dfd | |||
008cbf543f | |||
61ee841431 | |||
e856d59235 | |||
32753d3395 | |||
7b11a04727 | |||
6d6c053e4f | |||
1008fdd371 | |||
ddc2b7437b | |||
b9c95ebb1e | |||
b16d02ec66 | |||
38fb36087a | |||
5dbbc2266f | |||
2a22001e02 | |||
214ff25995 | |||
f4768d99ff | |||
8792f9fe36 | |||
3d45bef910 | |||
3de6b33163 | |||
3f1c03ea51 | |||
a4063d636d | |||
92b5b76171 | |||
51d285b0b0 | |||
4d8afdd3ae | |||
13b21ad275 | |||
d90a43a6d8 | |||
6fd14e718d | |||
c79f043529 | |||
3a676c7151 | |||
0023710209 | |||
0756091e8c | |||
8144df0023 | |||
b2137e2622 | |||
39b30c8ae1 | |||
1c5d6316cc | |||
6d4d681898 | |||
7053fd1490 | |||
e7a49acac0 | |||
d76cfb6e2e | |||
538f08052d | |||
b6fed71c58 | |||
6c86f98b66 | |||
26797545c6 | |||
3ce8aa1f47 | |||
8b46698f50 | |||
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 |
15
.vscode/settings.json
vendored
@ -1,5 +1,20 @@
|
||||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
"file.autoSave": "afterDelay",
|
||||
"files.watcherExclude": {
|
||||
"**/.git/objects/**": true,
|
||||
"**/built/**": true,
|
||||
"**/node_modules/**": true,
|
||||
"**/yotta_modules/**": true,
|
||||
"**/yotta_targets": true,
|
||||
"**/pxt_modules/**": true
|
||||
},
|
||||
"search.exclude": {
|
||||
"**/node_modules": true,
|
||||
"**/yotta_modules/**": true,
|
||||
"**/yotta_targets": true,
|
||||
"**/pxt_modules/**": true
|
||||
},
|
||||
"tslint.enable": true,
|
||||
"tslint.rulesDirectory": "node_modules/tslint-microsoft-contrib"
|
||||
}
|
@ -53,11 +53,6 @@ pxt update
|
||||
|
||||
More instructions at https://github.com/Microsoft/pxt#running-a-target-from-localhost
|
||||
|
||||
## Universal Windows App
|
||||
|
||||
The Windows 10 app is a [Universal Windows Hosted Web App](https://microsoftedge.github.io/WebAppsDocs/en-US/win10/CreateHWA.htm)
|
||||
that wraps ``codethemicrobit.com`` and provides additional features.
|
||||
|
||||
### Building
|
||||
|
||||
* Install Visual Studio 2015 Update 2 or higher. Make sure the Windows 10 templates are installed.
|
||||
|
@ -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>
|
15
cmds/cmds.ts
@ -9,16 +9,16 @@ let execAsync: (cmd: string, options?: { cwd?: string }) => Promise<Buffer> = Pr
|
||||
let readDirAsync = Promise.promisify(fs.readdir)
|
||||
|
||||
|
||||
export function deployCoreAsync(res: ts.pxt.CompileResult) {
|
||||
export function deployCoreAsync(res: ts.pxtc.CompileResult) {
|
||||
return getBitDrivesAsync()
|
||||
.then(drives => {
|
||||
if (drives.length == 0) {
|
||||
console.log("cannot find any drives to deploy to")
|
||||
} else {
|
||||
console.log(`copy ${ts.pxt.BINARY_HEX} to ` + drives.join(", "))
|
||||
console.log(`copy ${ts.pxtc.BINARY_HEX} to ` + drives.join(", "))
|
||||
}
|
||||
return Promise.map(drives, d =>
|
||||
writeFileAsync(d + ts.pxt.BINARY_HEX, res.outfiles[ts.pxt.BINARY_HEX])
|
||||
writeFileAsync(d + ts.pxtc.BINARY_HEX, res.outfiles[ts.pxtc.BINARY_HEX])
|
||||
.then(() => {
|
||||
console.log("wrote hex file to " + d)
|
||||
}))
|
||||
@ -28,7 +28,7 @@ export function deployCoreAsync(res: ts.pxt.CompileResult) {
|
||||
|
||||
function getBitDrivesAsync(): Promise<string[]> {
|
||||
if (process.platform == "win32") {
|
||||
let rx = new RegExp("^([A-Z]:).* " + pxt.appTarget.compile.deployDrives)
|
||||
const rx = new RegExp("^([A-Z]:).* " + pxt.appTarget.compile.deployDrives)
|
||||
return execAsync("wmic PATH Win32_LogicalDisk get DeviceID, VolumeName, FileSystem")
|
||||
.then(buf => {
|
||||
let res: string[] = []
|
||||
@ -42,9 +42,14 @@ function getBitDrivesAsync(): Promise<string[]> {
|
||||
})
|
||||
}
|
||||
else if (process.platform == "darwin") {
|
||||
let rx = new RegExp(pxt.appTarget.compile.deployDrives)
|
||||
const rx = new RegExp(pxt.appTarget.compile.deployDrives)
|
||||
return readDirAsync("/Volumes")
|
||||
.then(lst => lst.filter(s => rx.test(s)).map(s => "/Volumes/" + s + "/"))
|
||||
} else if (process.platform == "linux") {
|
||||
const rx = new RegExp(pxt.appTarget.compile.deployDrives)
|
||||
const user = process.env["USER"]
|
||||
return readDirAsync(`/media/${user}`)
|
||||
.then(lst => lst.filter(s => rx.test(s)).map(s => `/media/${user}/${s}/`))
|
||||
} else {
|
||||
return Promise.resolve([])
|
||||
}
|
||||
|
@ -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){}
|
||||
|
@ -1,37 +1,36 @@
|
||||
# Math
|
||||
|
||||
[Numeric](/reference/types/number) values: 0, 1, 2, ...
|
||||
### [Numeric](/reference/types/number) values: 0, 1, 2, ...
|
||||
|
||||
```blocks
|
||||
```block
|
||||
0;
|
||||
1;
|
||||
2;
|
||||
```
|
||||
|
||||
Arithmetic binary operation (+, -, *, /)
|
||||
### Arithmetic binary operation (+, -, *, /)
|
||||
|
||||
```blocks
|
||||
```block
|
||||
0+1;
|
||||
0-1;
|
||||
1*2;
|
||||
3/4;
|
||||
```
|
||||
|
||||
Absolute value
|
||||
### Absolute value
|
||||
|
||||
```blocks
|
||||
```block
|
||||
Math.abs(-5);
|
||||
```
|
||||
|
||||
Minimum/maximum of two values
|
||||
### Minimum/maximum of two values
|
||||
|
||||
```blocks
|
||||
```block
|
||||
Math.min(0, 1);
|
||||
Math.max(0, 1);
|
||||
```
|
||||
|
||||
Random value
|
||||
### Random value
|
||||
|
||||
```blocks
|
||||
```block
|
||||
Math.random(5);
|
||||
```
|
||||
|
@ -1,42 +0,0 @@
|
||||
# Math functions
|
||||
|
||||
### @parent blocks/language
|
||||
|
||||
The math library includes math related functions that you can use with [Numbers](/reference/types/number).
|
||||
|
||||
### abs
|
||||
|
||||
math `->` abs (x : [Number](/reference/types/number)) *returns* [Number](/reference/types/number)
|
||||
|
||||
returns the absolute value of input parameter `x`
|
||||
|
||||

|
||||
|
||||
### max
|
||||
|
||||
math `->` max (x : [Number](/reference/types/number), y : [Number](/reference/types/number)) *returns* [Number](/reference/types/number)
|
||||
|
||||
returns the larger of two input numbers (`x` and `y`)
|
||||
|
||||

|
||||
|
||||
### min
|
||||
|
||||
math `->` min (x : [Number](/reference/types/number), y : [Number](/reference/types/number)) *returns* [Number](/reference/types/number)
|
||||
|
||||
returns the smaller of two input numbers (`x` and `y`)
|
||||
|
||||

|
||||
|
||||
### random
|
||||
|
||||
math `->` random (limit : [Number](/reference/types/number)) *returns* [Number](/reference/types/number)
|
||||
|
||||
returns a random [Number](/reference/types/number) between 0 and the parameter *limit*
|
||||
|
||||

|
||||
|
||||
### See also
|
||||
|
||||
[Number](/reference/types/number)
|
||||
|
17
docs/cli.md
Normal file
@ -0,0 +1,17 @@
|
||||
# Command Line Interface
|
||||
|
||||
```sim
|
||||
basic.forever(() => {
|
||||
basic.showString("CLI<3")
|
||||
})
|
||||
```
|
||||
|
||||
It is possible to use the codethemicrobit tools from a command line interface (CLI). The PXT CLI allows to
|
||||
* edit, compile or deploy JavaScript programs
|
||||
* can easily be integrated in most IDEs. It comes with built-in support for [Visual Studio Code](/code)!
|
||||
* run a local web server for the web editor
|
||||
* author packages using JavaScript and/or C++
|
||||
|
||||
Using the CLI assumes that you have some experience with programming and will require to install tools on your machine as well.
|
||||
|
||||
* **[LET'S GET STARTED](https://pxt.io/cli)**
|
16
docs/code.md
Normal file
@ -0,0 +1,16 @@
|
||||
# Visual Studio Code
|
||||
|
||||
[Visual Studio Code](https://code.visualstudio.com) 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.
|
||||
|
||||
* background compilation
|
||||
* auto-completion
|
||||
* pxt command line integration
|
||||
|
||||
**Follow [these instructions](https://pxt.io/cli)** to setup your machine and edit your programs in Visual Studio Code.
|
||||
|
||||

|
||||
|
@ -7,10 +7,16 @@ Register an event that will execute whenever the user attaches one side of the c
|
||||
|
||||
This example displays a random number every time the crocodile clip holds `GND` then connects and disconnects the `P0` pin. Each time the crocodile clip is firmly connected and disconnected from pin `P0`, the micro:bit will return a random Number between 0 and the parameter limit
|
||||
|
||||

|
||||
```blocks
|
||||
input.onPinPressed(TouchPin.P0, () => {
|
||||
basic.showNumber(Math.random(10))
|
||||
})
|
||||
```
|
||||
|
||||
### Connecting Crocodile Clips
|
||||
|
||||

|
||||
|
||||
### See also
|
||||
|
||||
[micro:bit pins](/device/pins), [pin is pressed](/reference/input/pin-is-pressed), [analog read pin](/reference/pins/analog-read-pin), [analog write pin](/reference/pins/analog-write-pin), [digital read pin](/reference/pins/digital-read-pin), [digital write pin](/reference/pins/digital-write-pin)
|
||||
|
@ -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
|
||||
|
||||
|
@ -1,19 +1,24 @@
|
||||
# Run Scripts on your micro:bit
|
||||
# Running programs on your micro:bit
|
||||
|
||||
How to compile, transfer, and run a script on your micro:bit.
|
||||
How to compile, transfer, and run a program on your micro:bit.
|
||||
|
||||
While you're writing and testing your scripts, you'll mostly be running scripts in your browser by clicking the `PLay` button
|
||||
(see [run code in your browser](/device/simulator) for info about this).
|
||||
While you're writing and testing your programs, you'll mostly be [running them
|
||||
in the simulator](/device/simulator), but once you've finished your program you
|
||||
can **compile** it and run it on your micro:bit.
|
||||
|
||||
Once your masterpiece is complete, you can compile your script and run it on your micro:bit.
|
||||
The basic steps are:
|
||||
|
||||
1. Connect your micro:bit to your computer via USB
|
||||
2. Click **Download** and download the `.hex` file
|
||||
3. Copy the `.hex` file from your computer onto the micro:bit drive
|
||||
|
||||
## Requirements
|
||||
|
||||
You need the following things to transfer and run a script on your micro:bit:
|
||||
|
||||
* A-Male to Micro USB cable to connect your computer to your micro:bit. This is the same cable that is commonly used to connect a smart phone to a computer.
|
||||
* a PC running Windows 7 of later, or a Mac running OS X 10.6 or later
|
||||
* access to the Internet
|
||||
* A-Male to Micro USB cable to connect your computer to your micro:bit. This is
|
||||
the same cable that is commonly used to connect a smart phone to a computer.
|
||||
* A PC running Windows 7 or later, or a Mac running OS X 10.6 or later
|
||||
|
||||
## Step 1: Connect your micro:bit to your computer
|
||||
|
||||
@ -23,108 +28,151 @@ First, connect the micro:bit:
|
||||
|
||||
2. Connect the other end of the USB cable to a USB port on your computer.
|
||||
|
||||
Your computer should recognise your micro:bit as a new drive. On computers running Windows, MICROBIT appears as a drive under Devices and drives. On a Mac it appears as a new drive under Devices.
|
||||
Your computer should recognise your micro:bit as a new drive. On computers
|
||||
running Windows, `MICROBIT` appears as a drive under Devices and drives. On a Mac
|
||||
it appears as a new drive under Devices.
|
||||
|
||||
Windows
|
||||
**Windows**
|
||||
|
||||

|
||||

|
||||
|
||||
Mac (picture bvabdbco)
|
||||
WARN: unknown picture: bvabdbco:5x3
|
||||
**Mac**
|
||||
|
||||
## Step 2: Compile your script
|
||||

|
||||
|
||||
Next, compile your script:
|
||||
## Step 2: Download your program
|
||||
|
||||
1. Sign in to Touch Develop on your computer.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
1. Open your project on [codethemicrobit.com](https://codethemicrobit.com)
|
||||
2. Click **Download**
|
||||
3. When prompted, choose to **save** the compiled file onto your computer. The
|
||||
prompt will be different depending on which browser you are using, or
|
||||
whether you are using a Windows computer or a Mac
|
||||
|
||||
### Windows
|
||||
|
||||
** Chrome**
|
||||
#### Chrome
|
||||
|
||||
Your .hex file appears as a download at the bottom of the browser. Open up your windows file explorer. Your micro:bit appears as a drive called MICROBIT.
|
||||
Your `.hex` file appears as a download at the bottom of the browser. Click on
|
||||
the arrow next to the name of the file and then click **Show in folder**.
|
||||
|
||||
**Right click** on the download and select **show in folder**. Drag and drop the hex file from the download folder onto the MICROBIT drive.
|
||||

|
||||
|
||||
Alternatively, you can drag and drop the downloaded hex file from the bottom of the browser onto the file explorer and onto the MICROBIT drive.
|
||||
Drag and drop the `.hex` file from the download folder onto the `MICROBIT` drive.
|
||||
|
||||

|
||||
#### Firefox
|
||||
|
||||
**Firefox**
|
||||
A window will appear asking whether you want to save or open the `.hex` file.
|
||||
Select **Save File** and then select **OK**.
|
||||
|
||||
A dialogue box will appear, asking whether you would like to open or save your hex file. Select **Save**, then **OK** and the file will appear in your downloads in the top right of your browser. Select the **blue arrow**, select the relevant file and drag and drop it onto your Windows Explorer and onto your MICROBIT drive.
|
||||

|
||||
|
||||

|
||||
The file will then appear in your downloads in the top right of your browser.
|
||||
Click the **folder icon** next to the filename to open it in Windows Explorer.
|
||||
|
||||

|
||||

|
||||
|
||||
**IE10**
|
||||
Drag and drop the `.hex` file from the download folder onto the `MICROBIT` drive.
|
||||
|
||||
Click on compile. You will see a message “Do you want to save this .hex file.” Select **Save**.
|
||||
#### Microsoft Edge
|
||||
|
||||
A message will appear at the bottom of the browser asking what you want to do
|
||||
with the file. Click **Save**:
|
||||
|
||||

|
||||
|
||||
Then click **Open folder** and drag and drop the file from your Downloads to
|
||||
your `MICROBIT` drive.
|
||||
|
||||

|
||||
|
||||
#### Internet Explorer
|
||||
|
||||
A message will appear at the bottom of the browser asking what you want to do
|
||||
with the file. Click **Save**:
|
||||
|
||||

|
||||
|
||||
Then click **Open folder** and drag and drop the file from your Downloads to
|
||||
your `MICROBIT` drive.
|
||||
|
||||

|
||||
|
||||
### Mac
|
||||
|
||||
** Safari**
|
||||
#### 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 a file called `Unknown` will be
|
||||
downloaded into your Downloads folder. Open your Downloads folder and drag and
|
||||
drop the file onto your `MICROBIT` drive, under Devices:
|
||||
|
||||

|
||||

|
||||
|
||||
**Firefox**
|
||||
#### Firefox
|
||||
|
||||
A dialogue box will appear, asking whether you would like to open or save your hex file. Select **Save** and **OK** and the file will then appear in your downloads in the top right of your browser. Click on **Show in Finder** and the file will appear in your downloads folder. Select the file and drag and drop it onto your MICROBIT drive.
|
||||
A dialogue box will appear, asking whether you would like to open or save your
|
||||
hex file. Select **Save file** and click **OK** and the file will then appear in
|
||||
your downloads in the top right of your browser. Right click on the file and
|
||||
click on **Show in Finder** and the file will appear in your downloads folder.
|
||||
Select the file and drag and drop it onto your `MICROBIT` drive.
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
**Chrome**
|
||||
#### 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 appear at the bottom of
|
||||
the browser. 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.
|
||||
|
||||

|
||||

|
||||
|
||||
## Step 3: Transfer the file to your micro:bit
|
||||
|
||||
1. The file will transfer onto your micro:bit.
|
||||
|
||||
2. If you're using Windows, you can use **Send to** as described below.
|
||||
|
||||
3. The LED on the back of your micro:bit flashes during the transfer (which should only take a few seconds).
|
||||
|
||||
4. Once transferred, the code will run automatically on your micro:bit. To rerun your program, press the reset button on the back of your micro:bit. The reset button automatically runs the newest file on the micro:bit.
|
||||
* Once you've found the folder containing your `.hex` file, drag and drop it
|
||||
onto your `MICROBIT` drive
|
||||
* If you're using Windows, you can use **Send to** as described below
|
||||
* The LED on the back of your micro:bit flashes during the transfer (which
|
||||
should only take a few seconds).
|
||||
* Once transferred, the code will run automatically on your micro:bit. To rerun
|
||||
your program, press the reset button on the back of your micro:bit. The reset
|
||||
button automatically runs the newest file on the micro:bit.
|
||||
|
||||
**Send to**: If you're using Windows you use *Send to* in File Explorer:
|
||||
|
||||
- In File Explorer, right-click on the hex file (created in Step 2 above), choose **Send to**, and then **MICROBIT**.
|
||||
|
||||

|
||||

|
||||
|
||||
By copying the script onto the 'MICROBIT' drive, you have programmed it into the flash memory on the micro:bit, which means even after you unplug the micro:bit, your script will still run if the micro:bit is powered by battery.
|
||||
By copying the script onto the `MICROBIT` drive, you have programmed it into the
|
||||
flash memory on the micro:bit, which means even after you unplug the micro:bit,
|
||||
your program will still run if the micro:bit is powered by battery.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
You can’t drag and drop more than one hex file at once onto your micro:bit. If you try to drag and drop a second hex file onto your micro:bit before the first file has finished downloading, then the second file may fail in different ways.
|
||||
You can’t drag and drop more than one hex file at once onto your micro:bit. If
|
||||
you try to drag and drop a second hex file onto your micro:bit before the first
|
||||
file has finished downloading, then the second file may fail in different ways.
|
||||
|
||||
When the first program has been written to the micro:bit, the drive will disengage. If you drag and drop a second file at this point it may not find the drive and the second write will fail.
|
||||
When the first program has been written to the micro:bit, the drive will
|
||||
disengage. If you drag and drop a second file at this point it may not find the
|
||||
drive and the second write will fail.
|
||||
|
||||
The errors may look like this:
|
||||
|
||||
**Windows**
|
||||
|
||||

|
||||

|
||||
|
||||
**Mac**
|
||||
|
||||

|
||||

|
||||
|
||||
Or it may appear that there are two hex files on your micro:bit so the micro:bit won’t be able to run multiple files. To rectify this, unplug your micro:bit and plug it in again. Make sure that your micro:bit appears as MICROBIT and not MAINTENANCE.
|
||||
Or it may appear that there are two hex files on your micro:bit so the micro:bit
|
||||
won’t be able to run multiple files. To rectify this, unplug your micro:bit and
|
||||
plug it in again. Make sure that your micro:bit appears as `MICROBIT` and not
|
||||
`MAINTENANCE`.
|
||||
|
||||
### See also
|
||||
|
||||
|
@ -1,5 +1,7 @@
|
||||
# Documentation
|
||||
|
||||
### @description Links to the documentation, reference and projects.
|
||||
|
||||
### Things to do
|
||||
|
||||
* **[Getting Started](/getting-started)**
|
||||
@ -19,8 +21,10 @@
|
||||
### More questions?
|
||||
|
||||
* [Frequently Asked Question](/faq)
|
||||
* [Help Translate](/translate)
|
||||
* [Release notes](/release-notes)
|
||||
|
||||
### Developers
|
||||
|
||||
* [Command Line Interface](/cli)
|
||||
* Learn about [packages](/packages)
|
||||
|
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
|
||||
|
||||
|
BIN
docs/favicon.ico
Normal file
After Width: | Height: | Size: 1.1 KiB |
@ -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
|
||||
|
@ -4,9 +4,11 @@ An introduction to conditions for the Block Editor.
|
||||
|
||||
## Introduction to conditions
|
||||
|
||||
In the introduction to code, we made the BBC micro:bit automatically shows the message ‘hello, world!’:
|
||||
In the introduction to code, we made the BBC micro:bit automatically shows the message ‘hello world!’:
|
||||
|
||||

|
||||
```blocks
|
||||
basic.showString("hello world!")
|
||||
```
|
||||
|
||||
This statement, or code, will happen as soon as the BBC micro:bit is activated. This means it is unconditional. We can add a condition to make code function in certain ways:
|
||||
|
||||
@ -16,11 +18,13 @@ This statement, or code, will happen as soon as the BBC micro:bit is activated.
|
||||
|
||||
In programming we use an ‘if’ statement: if this condition is met, do something. Lets add an if statement to the code we had before; the BBC Micro:bit will wait for the user to press a button before showing the image.
|
||||
|
||||
### Write the code
|
||||
|
||||
Click the **if** category and drag an `if/do` block. Drag the`show string` block we wrote previously into the `do` section of the block. Next click the **input** tab and drag a `button pressed` block, connect it to the open jigsaw of the `if` block. This is our criteria: `if A button is pressed`. We can change which button (button A or B) by clicking the arrow next to ‘A’ and changing the value. This means our BBC micro:bit is waiting for button A (the left button) to be pressed. Finally go to the **basic** tab and drag a `forever` block, and attach all our code inside. We add this block to ensure the BBC micro:bit is always waiting to show us this message, not just once. Your code should look like this:
|
||||
|
||||

|
||||
```blocks
|
||||
basic.forever(() => {
|
||||
if (input.buttonIsPressed(Button.A)) {
|
||||
basic.showString("hello world!")
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
Again, test the code in the simulator. Try clicking **Button A** to display the "hello, world!" message every time the `button is pressed`.
|
||||
|
||||
@ -40,9 +44,17 @@ For example, we could make it so our BBC Micro:bit tells us to press the A butto
|
||||
|
||||
We want the message "Press A!" to scroll across the BBC micro:bit, so right-click the `show string` block and select **Duplicate**. Drag this new block into the `else` section and replace the “hello, world!” with "Press A!". Your code should look like this:
|
||||
|
||||

|
||||
```blocks
|
||||
basic.forever(() => {
|
||||
if (input.buttonIsPressed(Button.A)) {
|
||||
basic.showString("hello world!")
|
||||
} else {
|
||||
basic.showString("PRESS A")
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
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?
|
||||
|
||||
|
@ -1,88 +0,0 @@
|
||||
# blocks - challenges
|
||||
|
||||
Extra stuff for the Block Editor - an introduction to GPIO
|
||||
|
||||
## Before we get started
|
||||
|
||||
This section details challenges for the BBC micro:bit. Ensure you have completed all other sections of the Microsoft Block Editor tutorials before attempting these challenges!
|
||||
|
||||
## Quiz Challenge [1]
|
||||
|
||||
Using if statements, try to add more statements to create a simple quiz. The user will be told if the question is right or not, and will have two options (button A and button B).
|
||||
|
||||
Here is some sample code for a simple quiz:
|
||||
|
||||

|
||||
|
||||
## Timer Challenge [2]
|
||||
|
||||
Create a timer that runs out after a certain amount of time (using the *count* loop). For an extra challenge, let the user input the amount of seconds they want the timer to run for using variables and the buttons as input. The solution is below.
|
||||
|
||||

|
||||
|
||||
## Graphics Challenges [3]
|
||||
|
||||
Using the knowledge you have learnt from the [rendering graphics](/lessons/graphics) section, try creating an algorithm to draw these shapes. Before you write the code try to figure out how the BBC micro:bit will be thinking to plot these points. For example, with our diagonal line – “count up from 0 to 4 by 1, and plot points x=i and y=i”.
|
||||
|
||||
* Another diagonal line
|
||||
* A square going around the board
|
||||
* A filled square
|
||||
* A square which unplots itself after
|
||||
* A filled square which then unplots itself
|
||||
|
||||
The solutions are below.
|
||||
|
||||
### Square [3.1]
|
||||
|
||||

|
||||
|
||||
### Filled square [3.2]
|
||||
|
||||

|
||||
|
||||
### Vanishing square [3.3]
|
||||
|
||||
Use the same code and algorithm for the square solution, only use the ‘unplot’ block to make this LED turn off again. You could also reverse the algorithm.
|
||||
|
||||
### Vanishing filled square [3.4]
|
||||
|
||||
Use the same code and algorithm for the filled square solution, only use the `unplot` block to make this LED turn off again. You could also reverse the algorithm.
|
||||
|
||||
## Animation Challenge [4]
|
||||
|
||||
Use your new knowledge of animations and algorithms to program your BBC micro:bit to act human: for example, you could make your BBC micro:bit smile and wink. Remember you can display images with the `show image` and `create image` blocks. Sample code is below.
|
||||
|
||||

|
||||
|
||||
## Electronic Dice Challenge [5]
|
||||
|
||||
Using the code in the Random Numbers tutorial in Section 6, or your own algorithm, create an electronic dice that displays the values appropriate for a dice (so 1 shows a single LED on in the center, two shows two LEDs on at each corner, etc.). You may want to declare image variables to do this, then check what it is equal to using an ‘if’ statement. Sample code is below.
|
||||
|
||||

|
||||
|
||||
## Calculator Challenge [6]
|
||||
|
||||
Using your knowledge of loops, counters and math, create a calculator.
|
||||
|
||||
The calculator should:
|
||||
|
||||
* Count the amount of times the user presses the left button before pressing the right button (this is the first value, or valueOne)
|
||||
* Count the amount of times the user presses the left button before the right button again (this is the second value, or valueTwo)
|
||||
* Scroll through operations (+,-, x and divide) until the user presses the right button to make a choice
|
||||
* Perform the calculation
|
||||
* Show the entire calculation, for example: 5 + 10 = 15
|
||||
|
||||
Sample code is below.
|
||||
|
||||

|
||||
|
||||
## Smart watch Challenge [8]
|
||||
|
||||
Create a smart watch using the BBC micro:bit. Create a menu where the user presses one button to cycle through options and another button to choose this option. Add applications to this smart watch:
|
||||
|
||||
* Calculators
|
||||
* Games
|
||||
* Random number generators
|
||||
|
||||
And any other applications you can think of.
|
||||
|
@ -6,7 +6,9 @@ An introduction to graphics for the Block Editor.
|
||||
|
||||
Ensure you have completed the 'Hello, world!' and Loop tutorials and tested them on a simulator or on BBC micro:bit.
|
||||
|
||||

|
||||
```blocks
|
||||
basic.showString("HI!");
|
||||
```
|
||||
|
||||
The BBC micro:bit has a grid of 25 LEDs, so we can use these to display images.
|
||||
|
||||
@ -24,9 +26,16 @@ We can also code our bug to plot a point by giving an x (horizontal) and y (vert
|
||||
|
||||
We can also unplot a point (turn the LED off again) using the `unplot` block. So we could create a flashing LED program, using the `pause` block to create a delay.
|
||||
|
||||

|
||||
```blocks
|
||||
basic.forever(() => {
|
||||
led.plot(2,2)
|
||||
basic.pause(100)
|
||||
led.unplot(2,2)
|
||||
basic.pause(100)
|
||||
})
|
||||
```
|
||||
|
||||
We can also use the `clear screen` block to turn off all LEDs.
|
||||
We can also use the `basic.clearScreen` block to turn off all LEDs.
|
||||
|
||||
## Tip
|
||||
|
||||
@ -34,26 +43,35 @@ The pause block is in milliseconds, so setting it to 1000 will have a pause of a
|
||||
|
||||
### Devising algorithms for shapes
|
||||
|
||||
An algorithm is a set of steps to follow to solve a problem. We can begin to draw shapes on the BBC micro:bit using an algorithm. For example, we could draw a straight line with this code:
|
||||
An algorithm is a set of steps to follow to solve a problem. We can begin to draw shapes on the BBC micro:bit using an algorithm.
|
||||
For example, we could draw a straight line with this code:
|
||||
|
||||

|
||||
```blocks
|
||||
for(let i = 0; i <=4; i++) {
|
||||
led.plot(i, 0);
|
||||
basic.pause(200)
|
||||
}
|
||||
```
|
||||
|
||||
Our algorithm is: increase **i** by 1 **from 0** to **4**, and **plot** the point **x=i**, **y=0**. The pause block allows this line to be animated (drawn frame by frame).
|
||||
|
||||
Try devising an algorithm for a diagonal line using the code above and the variable **i**. Your code should look like this; as our variable increases, so does the location that the BBC micro:bit is plotting at:
|
||||
|
||||

|
||||
|
||||
We can create more complex algorithms for more complex shapes, too. See the [challenges](/lessons/challenges) section for additional graphical challenges and solutions.
|
||||
Try devising an algorithm for a diagonal line using the code above and the variable **i**.
|
||||
```sim
|
||||
basic.forever(() => {
|
||||
for(let i = 0; i <=4; i++) {
|
||||
led.plot(i, i);
|
||||
basic.pause(200)
|
||||
}
|
||||
basic.clearScreen();
|
||||
})
|
||||
```
|
||||
|
||||
### Animations
|
||||
|
||||
Animations are changes happening at a certain rate. For example, we could add the `delay` block from the **Basic** drawer with our square algorithm – this will slowly draw a square (as an animation).
|
||||
Animations are changes happening at a certain rate. For example, we could add the `pause` block from the **Basic** drawer with our square algorithm – this will slowly draw a square (as an animation).
|
||||
|
||||
We could create more complex animations, for example we could make our BBC micro:bit display an explosion or fireworks.
|
||||
|
||||
See the [challenges](/lessons/challenges) section for some animation tasks.
|
||||
|
||||
### Image variables
|
||||
|
||||
We can create image variables so we can easily display an image at a later point. For example:
|
||||
|
@ -1,59 +0,0 @@
|
||||
# blocks - loops
|
||||
|
||||
An introduction to Loops for the Block Editor.
|
||||
|
||||
We may want to handle the user’s input multiple times or remain waiting for their input for a long time. We use loops to make sure that our code runs multiple times. These can be found in the **Loops** drawer.
|
||||
|
||||
### Forever loops
|
||||
|
||||
In the Variables tutorial we utilised a forever loop to create a counter:
|
||||
|
||||

|
||||
|
||||
This allows our BBC micro:bit to wait for the user to do something forever, for example wait for the user to press the correct button as the example above shows. If you were creating a quiz, you may want to loop forever until the user presses the correct button or answers the question.
|
||||
|
||||
### Repeat Loops
|
||||
|
||||
Repeat loops allow code to happen a certain amount of times. You may want to create a quiz that only gives the user a few tries to get the correct answer, for example. The number can be changed to facilitate your code.
|
||||
|
||||

|
||||
|
||||
The code above will scroll the message, “Hello world” three times.
|
||||
|
||||
### While & Until loops
|
||||
|
||||
The ‘repeat while’ loop allows you to continue looping some code until a condition is met. The empty socket next to the while loop allows you to connect some Logic and construct a statement.
|
||||
|
||||

|
||||
|
||||
The code above will scroll the message, “Press it!”, while the user hasn’t pressed the button.
|
||||
|
||||
* Drag a `set item` block from the **Variables** drawer. Click the **down arrow** and click **New Variable**, and type "pressed". Drag a `0` block from **Maths** to set the variable **pressed** to 0.
|
||||
* Drag a `repeat while` block from the **Loops** drawer and attach an `=` block from the **Logic** drawer. Drag `item` from the **Variables** drawer and click the **down arrow**, select ‘pressed’. Drag a `0` block from Maths and connect it to the other side of the equals. This will carry out the code until ‘pressed’ does not equal 0.
|
||||
* Add a `show string` block from the **Basic** drawer and change the message to "Press it!"
|
||||
* Add an `if` block from the **Logic** drawer, connect a `button pressed` block from the **Input** drawer, and add text from the **Basic** drawer. Change this to A to show we are waiting for button A.
|
||||
* Inside the ‘do’ part of the if statement, add a `set` block from the Variables drawer, click the **down arrow** to change it to **pressed** and drag a `1` from the Maths drawer
|
||||
* Lastly underneath the while loop, add another `show string` block and fill in the gaps.
|
||||
|
||||
Test the code above on actual hardware or on the simulator window.
|
||||
|
||||
We can also change the code in subtle ways to have a completely different effect:
|
||||
|
||||

|
||||
|
||||
This time we have to press the button three times to leave the while loop.
|
||||
|
||||
## Tip
|
||||
|
||||
You can press the arrow next to a word in a block to change it. For example, you can change Math functions or change a Logic statement.
|
||||
|
||||
### Count or for loops
|
||||
|
||||
A count loop allows you to loop a certain amount of times and to change a variable as you do so. For example, we can create a simple counting program:
|
||||
|
||||

|
||||
|
||||
The count loop will repeat a certain amount of times whilst changing a variable. You can click the arrow next to **i** to replace it with any of your own variables. So this program will display numbers 1 to 10.
|
||||
|
||||
This loop allows you to repeat code for the amount of times you want to without worrying about manually changing variables. You could use this for a counting program or a timer.
|
||||
|
@ -92,9 +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.
|
||||
|
||||
## 9.
|
||||
|
||||
|
@ -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.
|
||||
|
||||
|
18
docs/offline.md
Normal file
@ -0,0 +1,18 @@
|
||||
# Offline editing
|
||||
|
||||
## Web application
|
||||
|
||||
**https://codethemicrobit.com is an HTML5 web application** that automatically gets cached locally by your browser.
|
||||
Once the web app is loaded and you have compiled at least once, you will have all the code needed to work without an internet connection.
|
||||
|
||||
## Command line interface
|
||||
|
||||
For more experience users, you can download the entire toolchain and use the [command line interface](/cli) (CLI) to compile
|
||||
and deploy your scripts locally. PXT provides a great out-of-the-box experience using [Visual Studio Code](/code),
|
||||
a lightweight cross-platform code editor.
|
||||
|
||||

|
||||
|
||||
## Native clients
|
||||
|
||||
There are no native clients available yet.
|
@ -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.
|
||||
Packages can be published from the pxt command line. Check out [the docs](https://www.pxt.io/packages).
|
||||
|
||||
## 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, () => {
|
||||
|
@ -1,9 +0,0 @@
|
||||
# String
|
||||
|
||||
```cards
|
||||
String.fromCharCode(0);
|
||||
```
|
||||
|
||||
### See Also
|
||||
|
||||
[fromCharCode](/reference//math/string-from-char-code)
|
@ -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
@ -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)
|
@ -11,11 +11,16 @@ An *Image* is a matrix of pixels to show on the [LED screen](/device/screen)
|
||||
To display an image:
|
||||
|
||||
* click `Basic` , `Show LEDs`, and tap on the LEDs`
|
||||
* when you're done, return to your code
|
||||
|
||||

|
||||
|
||||
You should see code similar to this:
|
||||
```blocks
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. # . # .
|
||||
. . . . .
|
||||
# . . . #
|
||||
. # # # .
|
||||
`)
|
||||
```
|
||||
|
||||
### Creating an image
|
||||
|
||||
|
@ -6,6 +6,7 @@ Control of the LED screen.
|
||||
led.plot(0, 0);
|
||||
led.unplot(0, 0);
|
||||
led.point(0, 0);
|
||||
led.toggle(0, 0);
|
||||
led.brightness();
|
||||
led.setBrightness(255);
|
||||
led.stopAnimation();
|
||||
@ -14,7 +15,6 @@ led.fadeIn();
|
||||
led.fadeOut();
|
||||
led.plotAll();
|
||||
led.screenshot();
|
||||
led.toggle(0, 0);
|
||||
led.toggleAll();
|
||||
led.setDisplayMode(DisplayMode.BackAndWhite);
|
||||
```
|
||||
|
@ -20,7 +20,11 @@ led.plot(2, 2)
|
||||
led.toggleAll()
|
||||
```
|
||||
|
||||

|
||||
```sim
|
||||
basic.clearScreen()
|
||||
led.plot(2, 2)
|
||||
led.toggleAll()
|
||||
```
|
||||
|
||||
### See also
|
||||
|
||||
|
@ -1,26 +0,0 @@
|
||||
# Off-line support
|
||||
|
||||
The micro:bit pins.
|
||||
|
||||
## How to work offline
|
||||
|
||||
If you have loaded the web app at some time in the past (by clicking on "my scripts" from the home page), then if you later open the same browser (whether you are online or offline) and type in [https://codethemicrobit.com/](https://codethemicrobit.com/), you will be able to access all the features of the web app. Note that it is important to end the URL with "/".
|
||||
|
||||
## Save and load code using files
|
||||
|
||||

|
||||
|
||||
The micro:bit automatically saves and synchronises scripts for signed-in users through the cloud. We also decided to also support file save/load for offline support and sharing via email and other storage providers. Users are now able to import and export scripts as files. For example, they can simply email it or submit them in their classroom portal.
|
||||
|
||||

|
||||
|
||||
## The new in-browser compiler
|
||||
|
||||
The compilation from a script to ARM machine code is now done entirely in the browser (read the [in depth story](https://www.touchdevelop.com/docs/touch-develop-in-208-bits) about building the compiler). The new compiler is used by the Block Editor, Touch Develop and Code Kingdoms to create a .hex file solely within the confines of your web browser (no Internet connection is needed). The micro:bit compilation process is shown below:
|
||||
|
||||

|
||||
|
||||
The C++ compiler is now only used to compile the micro:bit runtime - this is done offline by the micro:bit team and the pre-compiled runtime is linked with your compiled script in the browser.
|
||||
|
||||
Compiled .hex files can also be imported back into the web site. This make it easy for a teacher to review the source of a script by simply drag and dropping the file into the editor.
|
||||
|
@ -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
@ -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/antenna-0.png
vendored
Before Width: | Height: | Size: 2.7 KiB |
BIN
docs/static/mb/blocks/comment-0.png
vendored
Before Width: | Height: | Size: 23 KiB |
BIN
docs/static/mb/blocks/crocodile-clips-1.jpg
vendored
Before Width: | Height: | Size: 302 KiB |
BIN
docs/static/mb/blocks/game-library/pic0.png
vendored
Before Width: | Height: | Size: 12 KiB |
BIN
docs/static/mb/blocks/lessons-0.png
vendored
Before Width: | Height: | Size: 54 KiB |
BIN
docs/static/mb/blocks/lessons-1.png
vendored
Before Width: | Height: | Size: 80 KiB |
BIN
docs/static/mb/blocks/lessons-2.png
vendored
Before Width: | Height: | Size: 69 KiB |
BIN
docs/static/mb/blocks/lessons-3.png
vendored
Before Width: | Height: | Size: 72 KiB |
BIN
docs/static/mb/blocks/lessons-4.png
vendored
Before Width: | Height: | Size: 48 KiB |
BIN
docs/static/mb/blocks/lessons-5.png
vendored
Before Width: | Height: | Size: 138 KiB |
Before Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 26 KiB |
BIN
docs/static/mb/blocks/lessons/crocodile-clip-0.jpg
vendored
Before Width: | Height: | Size: 294 KiB |
BIN
docs/static/mb/blocks/lessons/glowing-pendulum-1.png
vendored
Before Width: | Height: | Size: 6.9 KiB |
BIN
docs/static/mb/blocks/lessons/glowing-pendulum-2.png
vendored
Before Width: | Height: | Size: 17 KiB |
BIN
docs/static/mb/blocks/lessons/glowing-pendulum-3.png
vendored
Before Width: | Height: | Size: 24 KiB |
BIN
docs/static/mb/blocks/lessons/glowing-pendulum-4.png
vendored
Before Width: | Height: | Size: 29 KiB |
BIN
docs/static/mb/blocks/lessons/glowing-pendulum-5.png
vendored
Before Width: | Height: | Size: 51 KiB |
BIN
docs/static/mb/blocks/lessons/graphics-1.png
vendored
Before Width: | Height: | Size: 43 KiB |
BIN
docs/static/mb/blocks/lessons/graphics-2.png
vendored
Before Width: | Height: | Size: 14 KiB |
BIN
docs/static/mb/blocks/lessons/graphics-3.png
vendored
Before Width: | Height: | Size: 14 KiB |
BIN
docs/static/mb/blocks/math-0.png
vendored
Before Width: | Height: | Size: 4.4 KiB |
BIN
docs/static/mb/blocks/math-1.png
vendored
Before Width: | Height: | Size: 5.7 KiB |
BIN
docs/static/mb/blocks/math-2.png
vendored
Before Width: | Height: | Size: 5.4 KiB |
BIN
docs/static/mb/blocks/math-3.png
vendored
Before Width: | Height: | Size: 4.3 KiB |
BIN
docs/static/mb/blocks/number-0.png
vendored
Before Width: | Height: | Size: 3.9 KiB |
BIN
docs/static/mb/blocks/number-1.png
vendored
Before Width: | Height: | Size: 2.6 KiB |
BIN
docs/static/mb/blocks/number-2.png
vendored
Before Width: | Height: | Size: 3.6 KiB |
BIN
docs/static/mb/blocks/number-3.png
vendored
Before Width: | Height: | Size: 4.2 KiB |
BIN
docs/static/mb/blocks/string-0.png
vendored
Before Width: | Height: | Size: 4.5 KiB |
BIN
docs/static/mb/blocks/string-1.png
vendored
Before Width: | Height: | Size: 5.7 KiB |
BIN
docs/static/mb/blocks/string-2.png
vendored
Before Width: | Height: | Size: 5.3 KiB |
BIN
docs/static/mb/blocks/to-td-0.png
vendored
Before Width: | Height: | Size: 11 KiB |
BIN
docs/static/mb/blocks/to-td-1.png
vendored
Before Width: | Height: | Size: 9.2 KiB |
BIN
docs/static/mb/blocks/to-td-2.png
vendored
Before Width: | Height: | Size: 22 KiB |
BIN
docs/static/mb/blocks/to-td-3.png
vendored
Before Width: | Height: | Size: 30 KiB |
BIN
docs/static/mb/blocks/to-td-4.png
vendored
Before Width: | Height: | Size: 7.3 KiB |
BIN
docs/static/mb/blocks/to-td-5.png
vendored
Before Width: | Height: | Size: 10 KiB |
BIN
docs/static/mb/blocks/to-td-6.png
vendored
Before Width: | Height: | Size: 24 KiB |
BIN
docs/static/mb/blocks/var-0.png
vendored
Before Width: | Height: | Size: 3.2 KiB |
BIN
docs/static/mb/blocks/var-1.png
vendored
Before Width: | Height: | Size: 5.1 KiB |
BIN
docs/static/mb/blocks/var-10.png
vendored
Before Width: | Height: | Size: 28 KiB |
BIN
docs/static/mb/blocks/var-2.png
vendored
Before Width: | Height: | Size: 3.5 KiB |
BIN
docs/static/mb/blocks/var-3.png
vendored
Before Width: | Height: | Size: 3.7 KiB |
BIN
docs/static/mb/blocks/var-4.png
vendored
Before Width: | Height: | Size: 10 KiB |
BIN
docs/static/mb/blocks/var-5.png
vendored
Before Width: | Height: | Size: 5.0 KiB |
BIN
docs/static/mb/blocks/var-6.png
vendored
Before Width: | Height: | Size: 7.2 KiB |