Compare commits
598 Commits
Author | SHA1 | Date | |
---|---|---|---|
056ec1bc96 | |||
16439bfca3 | |||
7117ba771e | |||
633522c800 | |||
3f94033c7d | |||
1bc00f476c | |||
0269ffa5ae | |||
c64225982e | |||
29eef560b0 | |||
90e191c4ca | |||
efd310f0b4 | |||
0a5c2e4df9 | |||
1d6eaf0370 | |||
b4b789422e | |||
cf982d7c52 | |||
2dafe5d253 | |||
63422bf696 | |||
56dc8571b7 | |||
d9190369b7 | |||
ea4bc7f4e8 | |||
7aa136d01c | |||
4eeae7e239 | |||
11b6ba0862 | |||
349a385f97 | |||
48afb52ef1 | |||
e5dc046fcc | |||
7f7aa1c60b | |||
584aaf8c6d | |||
029b5cda2b | |||
ed2f6d05ad | |||
26e20d75a4 | |||
31f5db32d1 | |||
107fe2aefa | |||
171f578b0b | |||
90756557f2 | |||
1e89d142ec | |||
002f08ca37 | |||
054501ace0 | |||
980fbc9c1e | |||
dab48cf42d | |||
652abe0892 | |||
781472e7ce | |||
1e4197b4fa | |||
8ec20b87d7 | |||
3a6e132c7f | |||
41c7e88928 | |||
19f757e159 | |||
fb222fd732 | |||
937bcc61ad | |||
7d61e5fe7c | |||
773dae8fc8 | |||
511f399d90 | |||
633ce491af | |||
8193c4790f | |||
21e64d01e3 | |||
641d8fcb9b | |||
84736554b9 | |||
e2c7579dd4 | |||
e0cf776591 | |||
da38ca2234 | |||
682ae92a08 | |||
f5f36d9cca | |||
19775e307a | |||
89406330cf | |||
9bc1e38345 | |||
85d5073fbb | |||
d76d92e041 | |||
6799721c9b | |||
16cf45aa7c | |||
4963bf776a | |||
237c5c019b | |||
cf37baa337 | |||
7303a1235f | |||
38ee5efdd4 | |||
474d5bb762 | |||
f045942297 | |||
7936517a03 | |||
ee60396e35 | |||
307d25ce7d | |||
ec48474231 | |||
524bcee5ed | |||
83cfd5738f | |||
83b8ba1102 | |||
2169cb044c | |||
76adc3c00a | |||
c6e38bd7a9 | |||
c60a4cb359 | |||
298382c19f | |||
ef849b645b | |||
78e8c9f176 | |||
57aadd0b27 | |||
e60c163b08 | |||
95e4c609a4 | |||
f2e1bc0168 | |||
5c818980ed | |||
172aa6a4d7 | |||
c5b9d0876a | |||
4716d06fe6 | |||
a2aaed2923 | |||
38aa6439a2 | |||
f078d59bb5 | |||
dffbe5dcb4 | |||
d0821710f6 | |||
2291f8b899 | |||
2bc5db517e | |||
f191d9033d | |||
7d912110f4 | |||
ae882a0107 | |||
367e80cb77 | |||
c3865afe8c | |||
6b9b636ae6 | |||
9a20841c6e | |||
9e95f1a442 | |||
c6ce36065e | |||
27f28032fb | |||
2dc9cffa99 | |||
376512f704 | |||
3813fba899 | |||
84816f4f39 | |||
2b095dfe21 | |||
2e3cdee2a2 | |||
ec404e5887 | |||
ba69563bf4 | |||
cc6594921f | |||
bf1269b82e | |||
79c89b832a | |||
3ccc8b7db3 | |||
7c8bae3cf0 | |||
000f784011 | |||
d85446d34d | |||
06641d4e5c | |||
a705c4882b | |||
784565b24e | |||
b59e4effff | |||
2db2741b08 | |||
66a46e4046 | |||
2f11d603e7 | |||
8089fe262e | |||
7d7d13f3ab | |||
bd1536132d | |||
fcefe1ed36 | |||
748581d76d | |||
f21f9e6e88 | |||
3f1817037e | |||
4bcba9b9e5 | |||
b3b836d77c | |||
a2cb2c2ed0 | |||
44e2ffc874 | |||
64b68c7439 | |||
198b24c6a4 | |||
a90a43d719 | |||
f9d138cb42 | |||
13089f92a8 | |||
0b1b312e76 | |||
958ff2ef40 | |||
eaf982903f | |||
cbfbcd080a | |||
9c389e290e | |||
4dd26f854c | |||
66444b886c | |||
0c01fdb30b | |||
75c2ccdea9 | |||
2dff5c1140 | |||
0ab28076f3 | |||
8030f27fb7 | |||
33c4b2b9b7 | |||
2463faf8d6 | |||
6db78761c4 | |||
a0893cdaff | |||
c6fa997f02 | |||
76d236e4d9 | |||
0f7323f2da | |||
23d30484d4 | |||
6ad59e04a6 | |||
ae5d5c74a7 | |||
75baca4a97 | |||
58ae4945cb | |||
fba37d96b2 | |||
5eb8704382 | |||
81b66664ef | |||
135aaf4855 | |||
1fbf257619 | |||
932c01f394 | |||
c3b2b99d7c | |||
ec910cb10f | |||
a19d1c848b | |||
790b9f557a | |||
0b469f69b6 | |||
1a3c31c9f3 | |||
5d4bd77bf4 | |||
c83d7e9f07 | |||
efee05c7f5 | |||
cc9ab86181 | |||
ef8d7185ee | |||
b0392da8b1 | |||
c817f9e3ff | |||
5f78f98f94 | |||
395b6184b9 | |||
3274964a11 | |||
f5e8b35df4 | |||
996073728c | |||
1e964ba1ea | |||
895a099ebf | |||
f7ed06108d | |||
0ffccdca85 | |||
9f5ebdfb78 | |||
6e64e80c05 | |||
dde16fec14 | |||
e1e8eab93f | |||
dface9083f | |||
31d4afc897 | |||
8427e89eb6 | |||
277d5a721c | |||
80131f2928 | |||
51bd8d57aa | |||
acd974b964 | |||
04e0529610 | |||
ee3f2e6470 | |||
29a4f3cf69 | |||
5649495a28 | |||
a8a9d7dcf0 | |||
09d7ebaf78 | |||
5c6b4c454b | |||
7e1408fc12 | |||
09dc67717c | |||
20dcd5ce34 | |||
e092961b5b | |||
28044af979 | |||
a9ba0a8f90 | |||
871694f99f | |||
8f6c81cd53 | |||
c819b815c4 | |||
a714970344 | |||
77df714a08 | |||
693a6ba8a9 | |||
5a8122bc8a | |||
c382fc5050 | |||
d69a82d167 | |||
a30ca46fef | |||
a56226c08d | |||
87d34ba030 | |||
091917b765 | |||
aea09c1830 | |||
5e9eec61c5 | |||
a34f765681 | |||
2ae78fe6b8 | |||
33207f33e5 | |||
a487e102ef | |||
a6ffa99ceb | |||
d2aa02c259 | |||
563d76b90a | |||
b433585403 | |||
576f37171a | |||
0bd92a433d | |||
2d5f3421ba | |||
7956c6e6a1 | |||
1f7a56a451 | |||
0ea4583b20 | |||
4bccb435f7 | |||
749c2111d2 | |||
96991447f8 | |||
22f36a623b | |||
8a47793f48 | |||
5cfedf7343 | |||
13383e6232 | |||
165cd0c67e | |||
9c8886116e | |||
fc495b928e | |||
17644d4947 | |||
068ea80a45 | |||
7a86bbd6b9 | |||
78fffe0e01 | |||
7bf1a29c83 | |||
446ef4d7b7 | |||
ca3e3a43a5 | |||
2225be7af1 | |||
1ce863df96 | |||
68ae9864a9 | |||
8cd670b22a | |||
a36038a048 | |||
9d4b31fe4d | |||
3ea6d1e6bb | |||
1698c4a012 | |||
2c39e249f9 | |||
c486a9db94 | |||
816438fa79 | |||
5edd06c9b9 | |||
a114dc32e7 | |||
019bc34d90 | |||
0676d780ab | |||
96e23d99b2 | |||
15b1f95394 | |||
552b0d8165 | |||
faed492a87 | |||
0ce1738653 | |||
f5cabe6e94 | |||
f2e7a640f1 | |||
7fb057af66 | |||
c0b9329401 | |||
c04ddbb459 | |||
4aac4ef92d | |||
979b2b892a | |||
4c3f9910f7 | |||
9aef584966 | |||
e62d15ba85 | |||
adf97d9b5c | |||
2bb6c6ae27 | |||
0919eff0c5 | |||
e31279938b | |||
2655843b74 | |||
527d323ea7 | |||
5d40a48477 | |||
850fb54f52 | |||
6bb35c1a72 | |||
6569231ba6 | |||
a3a1c8a480 | |||
c90dfaa6e7 | |||
02cd0e1da3 | |||
0f9dde0c4e | |||
1e0cd48316 | |||
d959282c68 | |||
d513ad7713 | |||
b7da28285e | |||
dbaf406703 | |||
2cb467f22b | |||
9585e2276d | |||
a591d9f072 | |||
471a30ca3d | |||
205b94afe8 | |||
18caf554e9 | |||
67cdf16fe4 | |||
bdbe8371dd | |||
21a36eb9ee | |||
376b20b035 | |||
7ce41b52aa | |||
46f7831e7c | |||
dda29a5cb6 | |||
6e4f4595a2 | |||
cdbe1e513b | |||
ae15c9a656 | |||
d993ff3a9d | |||
13785a2438 | |||
4dfb77fcd7 | |||
70deffb665 | |||
41a148de28 | |||
886e071d7f | |||
8a58d664c3 | |||
71d1155f21 | |||
167c1d8fce | |||
e59ae37954 | |||
72a621ec8b | |||
d6ff930333 | |||
54a7ac81ea | |||
e5d985dbf1 | |||
9db91d89d6 | |||
1fa9bf12d5 | |||
61bab257eb | |||
2e90b351da | |||
801bd6c7a0 | |||
777ba40899 | |||
0d11c16ecf | |||
9c1628b977 | |||
953b362b34 | |||
8b40850a94 | |||
fc3a02cc41 | |||
80f2ff6757 | |||
6f790d167c | |||
ac7502074a | |||
50473255a8 | |||
910772d54e | |||
33f12f9ecc | |||
01fa4ef53a | |||
3858b0a0a0 | |||
da30afb121 | |||
086bcf372f | |||
236e7337e2 | |||
4cf223271f | |||
10180f4729 | |||
618dd33221 | |||
7356e5e52e | |||
a59d148eb5 | |||
34ce687bbd | |||
5e241ed566 | |||
dcb2b21e66 | |||
95669e174a | |||
aca7d6113d | |||
ef4b06a087 | |||
afa69c23c4 | |||
8229e71d0a | |||
93770e5821 | |||
cb8e28beb0 | |||
8c7e6055ff | |||
8450db55ac | |||
c63e2c85f1 | |||
d8fc11a688 | |||
847a29848d | |||
39f4372ee5 | |||
a8bbbea8ed | |||
91a8d05e45 | |||
3ecedd3a32 | |||
b6390d77dd | |||
e8f9e0f023 | |||
2bacb58fdd | |||
af8babfea2 | |||
1ee6274100 | |||
7448db5b98 | |||
983645403b | |||
7a9f382bee | |||
e59fd8469b | |||
008c886de9 | |||
c87fa30738 | |||
dd9d1299fa | |||
6a7d1bd95c | |||
dfe270d259 | |||
6deb0683b6 | |||
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 | |||
8b46698f50 |
3
.gitignore
vendored
@ -16,6 +16,7 @@ clients/win10/*.opendb
|
||||
clients/**/bin/**
|
||||
clients/**/obj/**
|
||||
clients/electron/projects
|
||||
hexcache
|
||||
|
||||
*.user
|
||||
*.sw?
|
||||
@ -24,3 +25,5 @@ clients/electron/projects
|
||||
*.db
|
||||
*.suo
|
||||
*.log
|
||||
.vscode/.BROWSE.VC.DB-shm
|
||||
.vscode/.BROWSE.VC.DB-wal
|
||||
|
@ -8,8 +8,7 @@ script:
|
||||
- "(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"
|
||||
- "node node_modules/pxt-core/built/pxt.js uploaddoc"
|
||||
- "(cd libs/hello; node ../../node_modules/pxt-core/built/pxt.js testconv https://az851932.vo.msecnd.net/files/td-converter-tests-v0.json)"
|
||||
- "(cd libs/hello; node ../../node_modules/pxt-core/built/pxt.js testconv https://az851932.vo.msecnd.net/files/td-converter-tests-v1.json)"
|
||||
sudo: false
|
||||
notifications:
|
||||
email:
|
||||
|
18
.vscode/settings.json
vendored
@ -1,5 +1,21 @@
|
||||
// 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"
|
||||
"tslint.rulesDirectory": "node_modules/tslint-microsoft-contrib",
|
||||
"typescript.tsdk": "./node_modules/typescript/lib"
|
||||
}
|
14
README.md
@ -3,7 +3,7 @@
|
||||
This target allow to program a [BBC micro:bit](https://www.microbit.co.uk/) using
|
||||
PXT ([Microsoft Programming Experience Toolkit](https://github.com/Microsoft/pxt)).
|
||||
|
||||
* [Try it live](https://codethemicrobit.com)
|
||||
* [Try it live](https://pxt.microbit.org)
|
||||
|
||||
[](https://travis-ci.org/Microsoft/pxt-microbit)
|
||||
|
||||
@ -15,7 +15,7 @@ The local server allows to run the editor and the documentation from your comput
|
||||
|
||||
The following commands are a 1-time setup after synching the repo on your machine.
|
||||
|
||||
* if not yet installed, install [Node.js 4.4.5 or higher](https://nodejs.org/en/download/)
|
||||
* See requirements for [pxt](https://github.com/Microsoft/pxt)
|
||||
* [clone this repo](https://help.github.com/articles/cloning-a-repository/) to your computer and go in the project folder
|
||||
```
|
||||
git clone https://github.com/microsoft/pxt-microbit
|
||||
@ -53,16 +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.
|
||||
* open the ``win10/app.sln`` solution and launch the ``codethemicrobit`` project.
|
||||
|
||||
## Testing
|
||||
|
||||
The build automatically runs the following:
|
||||
|
@ -1,4 +1,3 @@
|
||||
///<reference path='typings/browser.d.ts'/>
|
||||
var connections = [];
|
||||
// A list of "ports", i.e. connected clients (such as web pages). Multiple web
|
||||
// pages can connect to our service: they all receive the same data.
|
||||
@ -41,7 +40,7 @@ function findNewDevices() {
|
||||
function main() {
|
||||
// Register new clients in the [ports] global variable.
|
||||
chrome.runtime.onConnectExternal.addListener(function (port) {
|
||||
if (/^(micro:bit|touchdevelop|yelm|pxt|codemicrobit|codethemicrobit)$/.test(port.name)) {
|
||||
if (/^(micro:bit|touchdevelop|yelm|pxt|codemicrobit|codethemicrobit|pxt.microbit.org)$/.test(port.name)) {
|
||||
ports.push(port);
|
||||
port.onDisconnect.addListener(function () {
|
||||
ports = ports.filter(function (x) { return x != port; });
|
||||
|
@ -61,7 +61,7 @@ function findNewDevices() {
|
||||
function main() {
|
||||
// Register new clients in the [ports] global variable.
|
||||
chrome.runtime.onConnectExternal.addListener(function (port) {
|
||||
if (/^(micro:bit|touchdevelop|yelm|pxt|codemicrobit|codethemicrobit)$/.test(port.name)) {
|
||||
if (/^(micro:bit|touchdevelop|yelm|pxt|codemicrobit|codethemicrobit|pxt.microbit.org)$/.test(port.name)) {
|
||||
ports.push(port);
|
||||
port.onDisconnect.addListener(function () {
|
||||
ports = ports.filter(function (x) { return x != port });
|
||||
|
Before Width: | Height: | Size: 5.9 KiB After Width: | Height: | Size: 2.6 KiB |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.6 KiB |
@ -6,13 +6,13 @@
|
||||
},
|
||||
|
||||
"manifest_version": 2,
|
||||
"name": "code the micro:bit",
|
||||
"version": "0.6.0",
|
||||
"name": "pxt.microbit.org",
|
||||
"version": "0.7.0",
|
||||
"author": "Microsoft Corporation",
|
||||
"short_name": "code the micro:bit",
|
||||
"short_name": "pxt.microbit.org",
|
||||
|
||||
"description": "Extension for https://codethemicrobit.com.",
|
||||
"homepage_url": "https://codethemicrobit.com",
|
||||
"description": "Extension for https://pxt.microbit.org.",
|
||||
"homepage_url": "https://pxt.microbit.org",
|
||||
"offline_enabled": "true",
|
||||
"icons": {
|
||||
"48": "logo48.png",
|
||||
@ -25,6 +25,6 @@
|
||||
],
|
||||
|
||||
"externally_connectable": {
|
||||
"matches": [ "*://localhost/*", "https://codethemicrobit.com/*", "https://*.codethemicrobit.com/*" ]
|
||||
"matches": [ "*://localhost/*", "https://pxt.microbit.org/*", "https://*.microbit.org/*" ]
|
||||
}
|
||||
}
|
||||
|
2
clients/electron/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
node_modules
|
||||
projects
|
5
clients/electron/README.md
Normal file
@ -0,0 +1,5 @@
|
||||
# PXT micro:bit Electron app
|
||||
|
||||
A very basic wrapper around the web app. To install, copy the contents of this
|
||||
directory to somewhere outside the main `pxt-microbit` repository. Then run `npm
|
||||
install && npm start`.
|
15
clients/electron/index.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>code the micro:bit</title>
|
||||
</head>
|
||||
<body>
|
||||
<webview id="webview" style="position:absolute; left:0; top:0; right:0; bottom:0"/>
|
||||
<script>
|
||||
const webview = document.getElementById("webview")
|
||||
const url = `http://localhost:3232/${window.location.hash}`
|
||||
webview.src = url
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,67 +1,39 @@
|
||||
const electron = require('electron')
|
||||
// Module to control application life.
|
||||
const app = electron.app
|
||||
// Module to create native browser window.
|
||||
const BrowserWindow = electron.BrowserWindow
|
||||
// pxt toolchain
|
||||
const {app, BrowserWindow, Menu} = require('electron')
|
||||
const pxt = require('pxt-core')
|
||||
const path = require('path')
|
||||
|
||||
// Keep a global reference of the window object, if you don't, the window will
|
||||
// be closed automatically when the JavaScript object is garbage collected.
|
||||
let mainWindow
|
||||
let win
|
||||
|
||||
function createWindow() {
|
||||
console.log('starting app...')
|
||||
// Create the browser window.
|
||||
mainWindow = new BrowserWindow({
|
||||
width: 800, height: 600,
|
||||
webPreferences: {
|
||||
nodeIntegration: false,
|
||||
}
|
||||
const cliPath = path.join(process.cwd(), "node_modules/pxt-microbit")
|
||||
|
||||
function startServerAndCreateWindow() {
|
||||
pxt.mainCli(cliPath, ["serve", "-no-browser"])
|
||||
createWindow()
|
||||
}
|
||||
|
||||
function createWindow () {
|
||||
win = new BrowserWindow({
|
||||
width: 800,
|
||||
height: 600,
|
||||
title: "code the micro:bit"
|
||||
})
|
||||
|
||||
ts.pxt.Util.debug = true;
|
||||
pxt.mainCli("C:/gh/pxt-microbit/clients/electron/node_modules/pxt-microbit", ["serve", "-just"]);
|
||||
|
||||
// no menu
|
||||
mainWindow.setMenu(null);
|
||||
|
||||
// and load the index.html of the app.
|
||||
mainWindow.loadURL(`http://localhost:3232/#local_token=08ba9b8f-6ccb-4202-296d-28fac7a553d9`)
|
||||
|
||||
// Open the DevTools.
|
||||
mainWindow.webContents.openDevTools()
|
||||
|
||||
// Emitted when the window is closed.
|
||||
mainWindow.on('closed', function () {
|
||||
// Dereference the window object, usually you would store windows
|
||||
// in an array if your app supports multi windows, this is the time
|
||||
// when you should delete the corresponding element.
|
||||
mainWindow = null
|
||||
Menu.setApplicationMenu(null)
|
||||
win.loadURL(`file://${__dirname}/index.html#local_token=${pxt.globalConfig.localToken}`)
|
||||
win.on('closed', () => {
|
||||
win = null
|
||||
})
|
||||
}
|
||||
|
||||
// This method will be called when Electron has finished
|
||||
// initialization and is ready to create browser windows.
|
||||
// Some APIs can only be used after this event occurs.
|
||||
app.on('ready', createWindow)
|
||||
app.on('ready', startServerAndCreateWindow)
|
||||
|
||||
// Quit when all windows are closed.
|
||||
app.on('window-all-closed', function () {
|
||||
// On OS X it is common for applications and their menu bar
|
||||
// to stay active until the user quits explicitly with Cmd + Q
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
app.quit()
|
||||
}
|
||||
})
|
||||
|
||||
app.on('activate', function () {
|
||||
// On OS X it's common to re-create a window in the app when the
|
||||
// dock icon is clicked and there are no other windows open.
|
||||
if (mainWindow === null) {
|
||||
app.on('activate', () => {
|
||||
if (win === null) {
|
||||
createWindow()
|
||||
}
|
||||
})
|
||||
|
||||
// In this file you can include the rest of your app's specific main process
|
||||
// code. You can also put them in separate files and require them here.
|
@ -1,19 +1,14 @@
|
||||
{
|
||||
"name": "codethemicrobit",
|
||||
"version": "0.1.0",
|
||||
"description": "A Blocks / JavaScript editor for the micro:bit",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"start": "electron ."
|
||||
},
|
||||
"name" : "code-the-microbit",
|
||||
"version" : "1.0.0",
|
||||
"description": "Blocks / Javascript editor",
|
||||
"author": "Microsoft",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"electron-prebuilt": "^1.2.0"
|
||||
"main" : "main.js",
|
||||
"scripts": {
|
||||
"start": "node_modules/.bin/electron ."
|
||||
},
|
||||
"dependencies": {
|
||||
"typescript": "1.8.7",
|
||||
"pxt-core": "*",
|
||||
"pxt-microbit": "*"
|
||||
"devDependencies": {
|
||||
"electron": "*",
|
||||
"pxt-microbit": "*"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
137
clients/macuploader/.gitignore
vendored
Normal file
@ -0,0 +1,137 @@
|
||||
|
||||
# Created by https://www.gitignore.io/api/osx,xcode,objective-c,vim
|
||||
|
||||
### OSX ###
|
||||
*.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
|
||||
|
||||
### Xcode ###
|
||||
# Xcode
|
||||
#
|
||||
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
|
||||
|
||||
## Build generated
|
||||
build/
|
||||
DerivedData/
|
||||
|
||||
## Various settings
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
!default.mode1v3
|
||||
*.mode2v3
|
||||
!default.mode2v3
|
||||
*.perspectivev3
|
||||
!default.perspectivev3
|
||||
xcuserdata/
|
||||
|
||||
## Other
|
||||
*.moved-aside
|
||||
*.xccheckout
|
||||
*.xcscmblueprint
|
||||
|
||||
|
||||
### Objective-C ###
|
||||
# Xcode
|
||||
#
|
||||
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
|
||||
|
||||
## Build generated
|
||||
build/
|
||||
DerivedData/
|
||||
|
||||
## Various settings
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
!default.mode1v3
|
||||
*.mode2v3
|
||||
!default.mode2v3
|
||||
*.perspectivev3
|
||||
!default.perspectivev3
|
||||
xcuserdata/
|
||||
|
||||
## Other
|
||||
*.moved-aside
|
||||
*.xcuserstate
|
||||
|
||||
## Obj-C/Swift specific
|
||||
*.hmap
|
||||
*.ipa
|
||||
*.dSYM.zip
|
||||
*.dSYM
|
||||
|
||||
# CocoaPods
|
||||
#
|
||||
# We recommend against adding the Pods directory to your .gitignore. However
|
||||
# you should judge for yourself, the pros and cons are mentioned at:
|
||||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
||||
#
|
||||
# Pods/
|
||||
|
||||
# Carthage
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Carthage dependencies.
|
||||
# Carthage/Checkouts
|
||||
|
||||
Carthage/Build
|
||||
|
||||
# fastlane
|
||||
#
|
||||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
|
||||
# screenshots whenever they are needed.
|
||||
# For more information about the recommended setup visit:
|
||||
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
|
||||
|
||||
fastlane/report.xml
|
||||
fastlane/Preview.html
|
||||
fastlane/screenshots
|
||||
fastlane/test_output
|
||||
|
||||
# Code Injection
|
||||
#
|
||||
# After new code Injection tools there's a generated folder /iOSInjectionProject
|
||||
# https://github.com/johnno1962/injectionforxcode
|
||||
|
||||
iOSInjectionProject/
|
||||
|
||||
### Objective-C Patch ###
|
||||
*.xcscmblueprint
|
||||
|
||||
|
||||
### Vim ###
|
||||
# swap
|
||||
[._]*.s[a-w][a-z]
|
||||
[._]s[a-w][a-z]
|
||||
# session
|
||||
Session.vim
|
||||
# temporary
|
||||
.netrwhist
|
||||
*~
|
||||
# auto-generated tag files
|
||||
tags
|
BIN
clients/macuploader/Graphics/appicon.sketch
Normal file
BIN
clients/macuploader/Graphics/export.png
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
clients/macuploader/Graphics/menubar.sketch
Normal file
307
clients/macuploader/Microbit Uploader.xcodeproj/project.pbxproj
Normal file
@ -0,0 +1,307 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
E93040071D895D1F00D931CA /* DirectoryWatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = E93040061D895D1F00D931CA /* DirectoryWatcher.m */; };
|
||||
E930400A1D89620900D931CA /* Uploader.m in Sources */ = {isa = PBXBuildFile; fileRef = E93040091D89620900D931CA /* Uploader.m */; };
|
||||
E9F4FEE21D8709980071D783 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E9F4FEE11D8709980071D783 /* AppDelegate.m */; };
|
||||
E9F4FEE51D8709980071D783 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E9F4FEE41D8709980071D783 /* main.m */; };
|
||||
E9F4FEE71D8709980071D783 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E9F4FEE61D8709980071D783 /* Assets.xcassets */; };
|
||||
E9F4FEEA1D8709980071D783 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = E9F4FEE81D8709980071D783 /* MainMenu.xib */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
E93040051D895D1F00D931CA /* DirectoryWatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectoryWatcher.h; sourceTree = "<group>"; };
|
||||
E93040061D895D1F00D931CA /* DirectoryWatcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DirectoryWatcher.m; sourceTree = "<group>"; };
|
||||
E93040081D89620900D931CA /* Uploader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Uploader.h; sourceTree = "<group>"; };
|
||||
E93040091D89620900D931CA /* Uploader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Uploader.m; sourceTree = "<group>"; };
|
||||
E9F4FEDD1D8709980071D783 /* Microbit Uploader.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Microbit Uploader.app"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E9F4FEE01D8709980071D783 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
||||
E9F4FEE11D8709980071D783 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
||||
E9F4FEE41D8709980071D783 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
E9F4FEE61D8709980071D783 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
E9F4FEE91D8709980071D783 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
||||
E9F4FEEB1D8709980071D783 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
E9F4FEDA1D8709980071D783 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
E9F4FED41D8709980071D783 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E9F4FEDF1D8709980071D783 /* Microbit Uploader */,
|
||||
E9F4FEDE1D8709980071D783 /* Products */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E9F4FEDE1D8709980071D783 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E9F4FEDD1D8709980071D783 /* Microbit Uploader.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E9F4FEDF1D8709980071D783 /* Microbit Uploader */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E9F4FEE01D8709980071D783 /* AppDelegate.h */,
|
||||
E9F4FEE11D8709980071D783 /* AppDelegate.m */,
|
||||
E9F4FEE61D8709980071D783 /* Assets.xcassets */,
|
||||
E9F4FEE81D8709980071D783 /* MainMenu.xib */,
|
||||
E9F4FEEB1D8709980071D783 /* Info.plist */,
|
||||
E9F4FEE31D8709980071D783 /* Supporting Files */,
|
||||
E93040051D895D1F00D931CA /* DirectoryWatcher.h */,
|
||||
E93040061D895D1F00D931CA /* DirectoryWatcher.m */,
|
||||
E93040081D89620900D931CA /* Uploader.h */,
|
||||
E93040091D89620900D931CA /* Uploader.m */,
|
||||
);
|
||||
path = "Microbit Uploader";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E9F4FEE31D8709980071D783 /* Supporting Files */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E9F4FEE41D8709980071D783 /* main.m */,
|
||||
);
|
||||
name = "Supporting Files";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
E9F4FEDC1D8709980071D783 /* Microbit Uploader */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = E9F4FEEE1D8709980071D783 /* Build configuration list for PBXNativeTarget "Microbit Uploader" */;
|
||||
buildPhases = (
|
||||
E9F4FED91D8709980071D783 /* Sources */,
|
||||
E9F4FEDA1D8709980071D783 /* Frameworks */,
|
||||
E9F4FEDB1D8709980071D783 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "Microbit Uploader";
|
||||
productName = "Microbit Uploader";
|
||||
productReference = E9F4FEDD1D8709980071D783 /* Microbit Uploader.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
E9F4FED51D8709980071D783 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0800;
|
||||
ORGANIZATIONNAME = thomasdenney;
|
||||
TargetAttributes = {
|
||||
E9F4FEDC1D8709980071D783 = {
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = E9F4FED81D8709980071D783 /* Build configuration list for PBXProject "Microbit Uploader" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = E9F4FED41D8709980071D783;
|
||||
productRefGroup = E9F4FEDE1D8709980071D783 /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
E9F4FEDC1D8709980071D783 /* Microbit Uploader */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
E9F4FEDB1D8709980071D783 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E9F4FEE71D8709980071D783 /* Assets.xcassets in Resources */,
|
||||
E9F4FEEA1D8709980071D783 /* MainMenu.xib in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
E9F4FED91D8709980071D783 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E9F4FEE51D8709980071D783 /* main.m in Sources */,
|
||||
E930400A1D89620900D931CA /* Uploader.m in Sources */,
|
||||
E9F4FEE21D8709980071D783 /* AppDelegate.m in Sources */,
|
||||
E93040071D895D1F00D931CA /* DirectoryWatcher.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
E9F4FEE81D8709980071D783 /* MainMenu.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
E9F4FEE91D8709980071D783 /* Base */,
|
||||
);
|
||||
name = MainMenu.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
E9F4FEEC1D8709980071D783 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
E9F4FEED1D8709980071D783 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
CODE_SIGN_IDENTITY = "-";
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
E9F4FEEF1D8709980071D783 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
INFOPLIST_FILE = "Microbit Uploader/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.thomasdenney.Microbit-Uploader";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
E9F4FEF01D8709980071D783 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
INFOPLIST_FILE = "Microbit Uploader/Info.plist";
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "org.thomasdenney.Microbit-Uploader";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
E9F4FED81D8709980071D783 /* Build configuration list for PBXProject "Microbit Uploader" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
E9F4FEEC1D8709980071D783 /* Debug */,
|
||||
E9F4FEED1D8709980071D783 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
E9F4FEEE1D8709980071D783 /* Build configuration list for PBXNativeTarget "Microbit Uploader" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
E9F4FEEF1D8709980071D783 /* Debug */,
|
||||
E9F4FEF01D8709980071D783 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = E9F4FED51D8709980071D783 /* Project object */;
|
||||
}
|
7
clients/macuploader/Microbit Uploader.xcodeproj/project.xcworkspace/contents.xcworkspacedata
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:Microbit Uploader.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
6
clients/macuploader/Microbit Uploader/AppDelegate.h
Normal file
@ -0,0 +1,6 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface AppDelegate : NSObject <NSApplicationDelegate>
|
||||
|
||||
@end
|
||||
|
130
clients/macuploader/Microbit Uploader/AppDelegate.m
Normal file
@ -0,0 +1,130 @@
|
||||
#import "AppDelegate.h"
|
||||
#import "DirectoryWatcher.h"
|
||||
#import "Uploader.h"
|
||||
|
||||
@interface AppDelegate ()<DirectoryWatcherDelegate, UploaderDelegate, NSUserNotificationCenterDelegate>
|
||||
|
||||
@property DirectoryWatcher * watcher;
|
||||
@property Uploader * uploader;
|
||||
@property NSStatusItem * menubarItem;
|
||||
|
||||
@end
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
|
||||
// Insert code here to initialize your application
|
||||
self.watcher = [[DirectoryWatcher alloc] initWithPath:[self downloadsDirectory]];
|
||||
self.watcher.delegate = self;
|
||||
[self.watcher startWatching];
|
||||
|
||||
self.uploader = [[Uploader alloc] init];
|
||||
self.uploader.delegate = self;
|
||||
|
||||
[NSUserNotificationCenter defaultUserNotificationCenter].delegate = self;
|
||||
|
||||
[self createMenuBarIcon];
|
||||
[self configureVolumeMountNotifications];
|
||||
[self showActiveMicroBits];
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(NSNotification *)aNotification {
|
||||
// Insert code here to tear down your application
|
||||
[self.watcher stopWatching];
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[[NSWorkspace sharedWorkspace].notificationCenter removeObserver:self];
|
||||
}
|
||||
|
||||
#pragma mark - Directory
|
||||
|
||||
- (void)watcher:(DirectoryWatcher *)watcher observedNewFileAtPath:(NSString *)path {
|
||||
NSString * fullPath = [watcher.path stringByAppendingPathComponent:path];
|
||||
if ([self.uploader shouldUploadFileAtPath:fullPath]) {
|
||||
[self.uploader uploadFile:fullPath];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString*)downloadsDirectory {
|
||||
NSArray * paths = NSSearchPathForDirectoriesInDomains(NSDownloadsDirectory, NSUserDomainMask, YES);
|
||||
return paths.firstObject;
|
||||
}
|
||||
|
||||
#pragma mark - Uploader delegate
|
||||
|
||||
- (void)uploader:(Uploader *)uploader transferredFile:(NSString *)file toMicroBit:(NSString *)microbit {
|
||||
[self showNotification:@"micro:bit upload" withDescription:[NSString stringWithFormat:@"%@ uploaded to %@", file.lastPathComponent, microbit]];
|
||||
}
|
||||
|
||||
- (void)uploader:(Uploader *)uploader failedToTransferFile:(NSString *)file toMicroBit:(NSString *)microbit {
|
||||
[self showNotification:@"micro:bit upload failed" withDescription:[NSString stringWithFormat:@"Couldn't transfer %@ to %@", file.lastPathComponent, microbit]];
|
||||
}
|
||||
|
||||
- (void)showNotification:(NSString*)title withDescription:(NSString*)description {
|
||||
NSUserNotification * notification = [NSUserNotification new];
|
||||
notification.title = title;
|
||||
notification.informativeText = description;
|
||||
notification.soundName = NSUserNotificationDefaultSoundName;
|
||||
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
|
||||
}
|
||||
|
||||
#pragma mark - NSUserNotificationCenterDelegate
|
||||
|
||||
- (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification {
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark - Volume mount/unmount notification
|
||||
|
||||
- (void)configureVolumeMountNotifications {
|
||||
[[NSWorkspace sharedWorkspace].notificationCenter addObserver:self selector:@selector(volumeMountNotification:) name:NSWorkspaceDidRenameVolumeNotification object:nil];
|
||||
[[NSWorkspace sharedWorkspace].notificationCenter addObserver:self selector:@selector(volumeMountNotification:) name:NSWorkspaceDidMountNotification object:nil];
|
||||
[[NSWorkspace sharedWorkspace].notificationCenter addObserver:self selector:@selector(volumeMountNotification:) name:NSWorkspaceDidUnmountNotification object:nil];
|
||||
}
|
||||
|
||||
- (void)volumeMountNotification:(NSNotification*)sender {
|
||||
//Delay upadting the menu to give the chance for the disk to fully mount or unmount
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[self showActiveMicroBits];
|
||||
});
|
||||
}
|
||||
|
||||
#pragma mark - Menu bar app
|
||||
|
||||
- (void)createMenuBarIcon {
|
||||
self.menubarItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength];
|
||||
self.menubarItem.button.image = [NSImage imageNamed:@"menubar"];
|
||||
}
|
||||
|
||||
- (void)showActiveMicroBits {
|
||||
NSMenu * menu = [NSMenu new];
|
||||
NSString * countString;
|
||||
NSUInteger count = self.uploader.microBitPaths.count;
|
||||
if (count == 0) {
|
||||
countString = @"No connect micro:bits";
|
||||
}
|
||||
else if (count == 1) {
|
||||
countString = @"1 connected micro:bit";
|
||||
}
|
||||
else {
|
||||
countString = [NSString stringWithFormat:@"%lu connected micro:bits", count];
|
||||
}
|
||||
NSMenuItem * microBitCount = [[NSMenuItem alloc] initWithTitle:countString action:nil keyEquivalent:@""];
|
||||
microBitCount.enabled = NO;
|
||||
[menu addItem:microBitCount];
|
||||
|
||||
NSMenuItem * websiteItem = [[NSMenuItem alloc] initWithTitle:@"Editor" action:@selector(launchEditor:) keyEquivalent:@"e"];
|
||||
[menu addItem:websiteItem];
|
||||
|
||||
NSMenuItem * quitItem = [[NSMenuItem alloc] initWithTitle:@"Quit" action:@selector(terminate:) keyEquivalent:@"q"];
|
||||
[menu addItem:quitItem];
|
||||
|
||||
self.menubarItem.menu = menu;
|
||||
}
|
||||
|
||||
- (void)launchEditor:(id)sender {
|
||||
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"https://pxt.microbit.org/"]];
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,68 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"size" : "16x16",
|
||||
"idiom" : "mac",
|
||||
"filename" : "icon_16x16.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "16x16",
|
||||
"idiom" : "mac",
|
||||
"filename" : "icon_16x16@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "32x32",
|
||||
"idiom" : "mac",
|
||||
"filename" : "icon_32x32.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "32x32",
|
||||
"idiom" : "mac",
|
||||
"filename" : "icon_32x32@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "128x128",
|
||||
"idiom" : "mac",
|
||||
"filename" : "icon_128x128.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "128x128",
|
||||
"idiom" : "mac",
|
||||
"filename" : "icon_128x128@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "256x256",
|
||||
"idiom" : "mac",
|
||||
"filename" : "icon_256x256.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "256x256",
|
||||
"idiom" : "mac",
|
||||
"filename" : "icon_256x256@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"size" : "512x512",
|
||||
"idiom" : "mac",
|
||||
"filename" : "icon_512x512.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"size" : "512x512",
|
||||
"idiom" : "mac",
|
||||
"filename" : "icon_512x512@2x.png",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 574 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 55 KiB |
After Width: | Height: | Size: 136 KiB |
@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
15
clients/macuploader/Microbit Uploader/Assets.xcassets/menubar.imageset/Contents.json
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"filename" : "menubar.pdf"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
},
|
||||
"properties" : {
|
||||
"template-rendering-intent" : "template"
|
||||
}
|
||||
}
|
BIN
clients/macuploader/Microbit Uploader/Assets.xcassets/menubar.imageset/menubar.pdf
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1004" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11201"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
|
||||
<connections>
|
||||
<outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<customObject id="Voe-Tx-rLC" customClass="AppDelegate"/>
|
||||
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
|
||||
</objects>
|
||||
</document>
|
24
clients/macuploader/Microbit Uploader/DirectoryWatcher.h
Normal file
@ -0,0 +1,24 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class DirectoryWatcher;
|
||||
|
||||
@protocol DirectoryWatcherDelegate <NSObject>
|
||||
|
||||
- (void)watcher:(DirectoryWatcher*)watcher observedNewFileAtPath:(NSString*)path;
|
||||
|
||||
@end
|
||||
|
||||
@interface DirectoryWatcher : NSObject
|
||||
|
||||
- (instancetype)initWithPath:(NSString*)path;
|
||||
|
||||
@property (readonly) NSString * path;
|
||||
|
||||
@property id<DirectoryWatcherDelegate> delegate;
|
||||
|
||||
- (void)startWatching;
|
||||
|
||||
//Automatically called when deallocated
|
||||
- (void)stopWatching;
|
||||
|
||||
@end
|
75
clients/macuploader/Microbit Uploader/DirectoryWatcher.m
Normal file
@ -0,0 +1,75 @@
|
||||
#import "DirectoryWatcher.h"
|
||||
#import <CoreServices/CoreServices.h>
|
||||
|
||||
void callback(ConstFSEventStreamRef streamRef, void * info, size_t numEvents, void * eventPaths, const FSEventStreamEventFlags eventFlags[], const FSEventStreamEventId eventIds[]);
|
||||
|
||||
@interface DirectoryWatcher ()
|
||||
|
||||
@property NSString * path;
|
||||
@property NSMutableSet<NSString*>* knownFiles;
|
||||
@property FSEventStreamRef stream;
|
||||
|
||||
- (void)rescanPathWithEvents:(BOOL)sendEvents;
|
||||
|
||||
@end
|
||||
|
||||
@implementation DirectoryWatcher
|
||||
|
||||
- (instancetype)initWithPath:(NSString *)path {
|
||||
if (!path) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.path = path;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[self stopWatching];
|
||||
}
|
||||
|
||||
- (void)startWatching {
|
||||
self.knownFiles = [NSMutableSet new];
|
||||
[self rescanPathWithEvents:NO];
|
||||
|
||||
CFStringRef path = (__bridge CFStringRef)(self.path);
|
||||
CFArrayRef pathsToWatch = CFArrayCreate(NULL, (const void**)&path, 1, NULL);
|
||||
CFAbsoluteTime latency = 1;
|
||||
FSEventStreamContext context = { 0, (__bridge void * _Nullable)(self), NULL, NULL, NULL };
|
||||
self.stream = FSEventStreamCreate(NULL, &callback, &context, pathsToWatch, kFSEventStreamEventIdSinceNow, latency, kFSEventStreamCreateFlagNone);
|
||||
FSEventStreamScheduleWithRunLoop(self.stream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
|
||||
FSEventStreamStart(self.stream);
|
||||
}
|
||||
|
||||
- (void)stopWatching {
|
||||
if (self.stream) {
|
||||
FSEventStreamStop(self.stream);
|
||||
FSEventStreamInvalidate(self.stream);
|
||||
FSEventStreamRelease(self.stream);
|
||||
self.stream = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)rescanPathWithEvents:(BOOL)sendEvents {
|
||||
NSArray<NSString*>* downloadFiles = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:self.path error:nil];
|
||||
NSMutableSet<NSString*>* fullSet = [NSMutableSet new];
|
||||
for (NSString * file in downloadFiles) {
|
||||
[fullSet addObject:file];
|
||||
if (![self.knownFiles containsObject:file]) {
|
||||
if (sendEvents) {
|
||||
[self.delegate watcher:self observedNewFileAtPath:file];
|
||||
}
|
||||
}
|
||||
}
|
||||
self.knownFiles = fullSet;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
void callback(ConstFSEventStreamRef streamRef, void * info, size_t numEvents, void * eventPaths, const FSEventStreamEventFlags eventFlags[], const FSEventStreamEventId eventIds[]) {
|
||||
DirectoryWatcher * watcher = (__bridge DirectoryWatcher*)info;
|
||||
[watcher rescanPathWithEvents:YES];
|
||||
}
|
36
clients/macuploader/Microbit Uploader/Info.plist
Normal file
@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string></string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.01</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>LSUIElement</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2016 Thomas Denney. All rights reserved.</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
</dict>
|
||||
</plist>
|
21
clients/macuploader/Microbit Uploader/Uploader.h
Normal file
@ -0,0 +1,21 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class Uploader;
|
||||
|
||||
@protocol UploaderDelegate <NSObject>
|
||||
|
||||
- (void)uploader:(Uploader*)uploader transferredFile:(NSString*)file toMicroBit:(NSString*)microbit;
|
||||
- (void)uploader:(Uploader*)uploader failedToTransferFile:(NSString*)file toMicroBit:(NSString*)microbit;
|
||||
|
||||
@end
|
||||
|
||||
@interface Uploader : NSObject
|
||||
|
||||
@property id<UploaderDelegate> delegate;
|
||||
|
||||
- (BOOL)shouldUploadFileAtPath:(NSString*)path;
|
||||
- (NSArray<NSString*>*)microBitPaths;
|
||||
- (void)uploadFile:(NSString*)file;
|
||||
- (void)uploadFile:(NSString*)file toMicroBit:(NSString*)path;
|
||||
|
||||
@end
|
74
clients/macuploader/Microbit Uploader/Uploader.m
Normal file
@ -0,0 +1,74 @@
|
||||
#import "Uploader.h"
|
||||
|
||||
@interface Uploader ()
|
||||
|
||||
@property NSOperationQueue * backgroundCopyQueue;
|
||||
|
||||
@end
|
||||
|
||||
@implementation Uploader
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.backgroundCopyQueue = [NSOperationQueue new];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)shouldUploadFileAtPath:(NSString *)path {
|
||||
//Whilst Safari is downloading the file it appends .download to the name
|
||||
NSRegularExpression * ignoreDownload = [NSRegularExpression regularExpressionWithPattern:@".download$" options:NSRegularExpressionCaseInsensitive error:nil];
|
||||
if ([ignoreDownload numberOfMatchesInString:path.lastPathComponent options:0 range:NSMakeRange(0, path.lastPathComponent.length)] > 0) {
|
||||
return NO;
|
||||
}
|
||||
|
||||
//Chrome and Firefox create .hex files
|
||||
NSRegularExpression * hexFiles = [NSRegularExpression regularExpressionWithPattern:@".hex$" options:NSRegularExpressionCaseInsensitive error:nil];
|
||||
if ([hexFiles numberOfMatchesInString:path.lastPathComponent options:0 range:NSMakeRange(0, path.lastPathComponent.length)] > 0) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
//Safari tends to just name files 'Unknown X'
|
||||
NSRegularExpression * unknownFiles = [NSRegularExpression regularExpressionWithPattern:@"^Unknown(( |-)[0-9]+)?" options:NSRegularExpressionCaseInsensitive error:nil];
|
||||
if ([unknownFiles numberOfMatchesInString:path.lastPathComponent options:0 range:NSMakeRange(0, path.lastPathComponent.length)]) {
|
||||
return YES;
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (NSArray<NSString*>*)microBitPaths {
|
||||
NSArray<NSURL*>* allVolumes = [[NSFileManager defaultManager] mountedVolumeURLsIncludingResourceValuesForKeys:nil options:NSVolumeEnumerationSkipHiddenVolumes];
|
||||
NSMutableArray<NSString*>* microbitPaths = [NSMutableArray new];
|
||||
NSRegularExpression * microbitRegex = [NSRegularExpression regularExpressionWithPattern:@"^MICROBIT" options:NSRegularExpressionCaseInsensitive error:nil];
|
||||
for (NSURL * volume in allVolumes) {
|
||||
NSString * lastPathComponent = volume.lastPathComponent;
|
||||
if ([microbitRegex numberOfMatchesInString:lastPathComponent options:0 range:NSMakeRange(0, lastPathComponent.length)] > 0) {
|
||||
[microbitPaths addObject:volume.path];
|
||||
}
|
||||
}
|
||||
|
||||
return microbitPaths;
|
||||
}
|
||||
|
||||
- (void)uploadFile:(NSString *)file {
|
||||
for (NSString * microbit in [self microBitPaths]) {
|
||||
[self uploadFile:file toMicroBit:microbit];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)uploadFile:(NSString *)file toMicroBit:(NSString *)path {
|
||||
[self.backgroundCopyQueue addOperationWithBlock:^{
|
||||
NSError * copyError;
|
||||
NSString * destination = [path stringByAppendingPathComponent:file.lastPathComponent];
|
||||
if (![[NSFileManager defaultManager] copyItemAtPath:file toPath:destination error:©Error]) {
|
||||
[self.delegate uploader:self failedToTransferFile:file toMicroBit:path.lastPathComponent];
|
||||
}
|
||||
else {
|
||||
[self.delegate uploader:self transferredFile:file toMicroBit:path.lastPathComponent];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
5
clients/macuploader/Microbit Uploader/main.m
Normal file
@ -0,0 +1,5 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
int main(int argc, const char * argv[]) {
|
||||
return NSApplicationMain(argc, argv);
|
||||
}
|
40
clients/macuploader/README.md
Normal file
@ -0,0 +1,40 @@
|
||||
# micro:bit uploader for OS X
|
||||
|
||||

|
||||
|
||||
This project is a clone of the [Windows
|
||||
uploader](https://pxt.microbit.org/uploader), but for OS X. Once launched,
|
||||
the app runs in your menu bar and will automatically deploy any HEX files to
|
||||
your `micro:bit`. Like the Windows version, it is compatible with any browser
|
||||
that can run [pxt.microbit.org](http://pxt.microbit.org).
|
||||
|
||||
## Install the built version
|
||||
|
||||
1. Download the latest `.zip` release from the `Release` directory
|
||||
2. Unzip it
|
||||
3. Drag `Microbit Uploader` to your Applications folder and launch it
|
||||
|
||||
## Building
|
||||
|
||||
To build the project you'll need a copy of OS X 10.11 or higher and Xcode 8 or
|
||||
higher (you may be able to build on earlier OSes or versions of Xcode, but this
|
||||
remains untested). Once you have a development environment set up, just build
|
||||
and run `Microbit Uploader.xcodeproj`.
|
||||
|
||||
## Distributing
|
||||
|
||||
1. Open the Xcode project
|
||||
2. Product > Archive
|
||||
3. Export:
|
||||
|
||||

|
||||
|
||||
4. You will then have the option of either signing or not-signing the
|
||||
application:
|
||||
|
||||
a) If you have an Apple developer account, select 'Export a Developer
|
||||
ID-signed Application'
|
||||
|
||||
b) If you don't have a developer ID, select 'Export as a macOS App'
|
||||
|
||||
5. Zip the produced app and upload to CDN or equivalent
|
BIN
clients/macuploader/Release/Microbit Uploader v1.0.zip
Normal file
BIN
clients/macuploader/Release/Microbit Uploader v1.01.zip
Normal file
@ -1,48 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25123.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{262852C6-CD72-467D-83FE-5EEB1973A190}") = "m.pxt.io", "app\m.pxt.io.jsproj", "{39122940-AB16-4CD4-A0CE-79A3EB863ECF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|ARM = Debug|ARM
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|ARM = Release|ARM
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{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
|
||||
EndGlobalSection
|
||||
EndGlobal
|
@ -1 +0,0 @@
|
||||
MainPackage=C:\gh\pxt-microbit\win10\app\bin\Debug\m.pxt.io_0.1.4.0_AnyCPU_Debug.appx
|
@ -1,85 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|AnyCPU">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>AnyCPU</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|ARM">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x86">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x86</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|AnyCPU">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>AnyCPU</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x86">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x86</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>39122940-ab16-4cd4-a0ce-79a3eb863ecf</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup Condition="'$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0'">
|
||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).Default.props" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).props" />
|
||||
<PropertyGroup>
|
||||
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
||||
<TargetPlatformVersion>10.0.10586.0</TargetPlatformVersion>
|
||||
<TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
|
||||
<MinimumVisualStudioVersion>$(VersionNumberMajor).$(VersionNumberMinor)</MinimumVisualStudioVersion>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<PackageCertificateKeyFile>pxtwinapp_TemporaryKey.pfx</PackageCertificateKeyFile>
|
||||
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
|
||||
<AppxBundle>Always</AppxBundle>
|
||||
<AppxBundlePlatforms>neutral</AppxBundlePlatforms>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="package.appxmanifest">
|
||||
<SubType>Designer</SubType>
|
||||
</AppxManifest>
|
||||
<Content Include="msapp-error.js" />
|
||||
<Content Include="msapp-error.css" />
|
||||
<Content Include="msapp-error.html" />
|
||||
<Content Include="images\LockScreenLogo.scale-200.png" />
|
||||
<Content Include="images\SplashScreen.scale-200.png" />
|
||||
<Content Include="images\Square150x150Logo.scale-200.png" />
|
||||
<Content Include="images\Square44x44Logo.scale-200.png" />
|
||||
<Content Include="images\Square44x44Logo.targetsize-24_altform-unplated.png" />
|
||||
<Content Include="images\StoreLogo.png" />
|
||||
<Content Include="images\Wide310x150Logo.scale-200.png" />
|
||||
<None Include="pxtwinapp_TemporaryKey.pfx" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\$(WMSJSProjectDirectory)\Microsoft.VisualStudio.$(WMSJSProject).targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below then uncomment
|
||||
that target and the DisableFastUpToDateCheck PropertyGroup.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
<PropertyGroup>
|
||||
<DisableFastUpToDateCheck>true</DisableFastUpToDateCheck>
|
||||
</PropertyGroup>
|
||||
-->
|
||||
</Project>
|
@ -1,48 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25123.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{262852C6-CD72-467D-83FE-5EEB1973A190}") = "codethemicrobitapp", "codethemicrobitapp.jsproj", "{39122940-AB16-4CD4-A0CE-79A3EB863ECF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|ARM = Debug|ARM
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|ARM = Release|ARM
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{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
|
||||
EndGlobalSection
|
||||
EndGlobal
|
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 8.4 KiB |
@ -1,17 +0,0 @@
|
||||
body {
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
.tip {
|
||||
font-size: 90%;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
.paramName {
|
||||
font-size: 100%;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.paramValue {
|
||||
color: black;
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Navigation Error</title>
|
||||
<link href="msapp-error.css" rel="stylesheet" type="text/css"/>
|
||||
<script src="msapp-error.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Navigation Error</h1>
|
||||
<div id="failureUrl" class="param">
|
||||
<span>-</span><span class="paramName">failureUrl</span><span>=</span>
|
||||
<span id="failureUrlValue" class="paramValue"></span>
|
||||
<span class="tip">(indicates the url where the error occurred)</span><br/>
|
||||
</div><br/>
|
||||
<div id="httpStatus" class="param">
|
||||
<span>-</span><span class="paramName">httpStatus</span><span>=</span>
|
||||
<span id="httpStatusValue" class="paramValue"></span>
|
||||
<span class="tip">(available when the error has an http status code)</span><br/>
|
||||
</div><br/>
|
||||
<div id="failureName">
|
||||
<span>-</span><span class="paramName">failureName</span><span>=</span>
|
||||
<span id="failureNameValue" class="paramValue"></span>
|
||||
<span class="tip">(available only when the error does not have a http status code)</span><br/>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,22 +0,0 @@
|
||||
(function () {
|
||||
var validParameterNames = [ "httpStatus", "failureName", "failureUrl" ];
|
||||
|
||||
function parseQueryParameters() {
|
||||
var query = location.search.slice(1);
|
||||
return query.split("&").reduce(function (queryParameters, rawPair) {
|
||||
var pair = rawPair.split("=").map(decodeURIComponent);
|
||||
queryParameters[pair[0]] = pair[1];
|
||||
return queryParameters;
|
||||
}, {});
|
||||
}
|
||||
|
||||
function initialize() {
|
||||
var queryParameters = parseQueryParameters();
|
||||
validParameterNames.forEach(function (parameterName) {
|
||||
var parameterValue = queryParameters[parameterName] || "N/A";
|
||||
document.getElementById(parameterName + "Value").textContent = parameterValue;
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", initialize);
|
||||
}());
|
@ -1,50 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="uap mp">
|
||||
<Identity Name="39122940-ab16-4cd4-a0ce-79a3eb863ecf" Version="0.1.5.0" Publisher="CN=jhalleux" />
|
||||
<mp:PhoneIdentity PhoneProductId="39122940-ab16-4cd4-a0ce-79a3eb863ecf" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
|
||||
<Properties>
|
||||
<DisplayName>codethemicrobit</DisplayName>
|
||||
<PublisherDisplayName>Microsoft</PublisherDisplayName>
|
||||
<Logo>images\storelogo.png</Logo>
|
||||
</Properties>
|
||||
<Dependencies>
|
||||
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
|
||||
</Dependencies>
|
||||
<Resources>
|
||||
<Resource Language="x-generate" />
|
||||
</Resources>
|
||||
<Applications>
|
||||
<Application Id="App" StartPage="https://codethemicrobit.com">
|
||||
<uap:ApplicationContentUriRules>
|
||||
<uap:Rule Match="https://m.pxt.io/" Type="include" WindowsRuntimeAccess="all" />
|
||||
<uap:Rule Match="https://codemicrobit.com/" Type="include" WindowsRuntimeAccess="all" />
|
||||
<uap:Rule Match="https://codethemicrobit.com/" Type="include" WindowsRuntimeAccess="all" />
|
||||
</uap:ApplicationContentUriRules>
|
||||
<uap:VisualElements DisplayName="code the micro:bit" Description="A code editor for the BBC micro:bit with Blocks or Javascript." BackgroundColor="white" Square150x150Logo="images\Square150x150Logo.png" Square44x44Logo="images\Square44x44Logo.png">
|
||||
<uap:DefaultTile Wide310x150Logo="images\Wide310x150Logo.png" ShortName="code the micro:bit">
|
||||
</uap:DefaultTile>
|
||||
<uap:SplashScreen Image="images\splashscreen.png" />
|
||||
</uap:VisualElements>
|
||||
<Extensions>
|
||||
<uap:Extension Category="windows.fileTypeAssociation">
|
||||
<uap:FileTypeAssociation Name="microbithex">
|
||||
<uap:DisplayName>BBC micro:bit binary file</uap:DisplayName>
|
||||
<uap:SupportedFileTypes>
|
||||
<uap:FileType ContentType="application/x-microbit-hex">.hex</uap:FileType>
|
||||
</uap:SupportedFileTypes>
|
||||
</uap:FileTypeAssociation>
|
||||
</uap:Extension>
|
||||
</Extensions>
|
||||
</Application>
|
||||
</Applications>
|
||||
<Capabilities>
|
||||
<Capability Name="internetClient" />
|
||||
<uap:Capability Name="removableStorage" />
|
||||
<DeviceCapability Name="bluetooth" />
|
||||
<DeviceCapability Name="serialcommunication">
|
||||
<Device Id="any">
|
||||
<Function Type="name:serialPort" />
|
||||
</Device>
|
||||
</DeviceCapability>
|
||||
</Capabilities>
|
||||
</Package>
|
Before Width: | Height: | Size: 172 KiB |
Before Width: | Height: | Size: 121 KiB |
Before Width: | Height: | Size: 54 KiB |
@ -32,7 +32,7 @@ namespace Microsoft.MicroBit
|
||||
private void openEditor()
|
||||
{
|
||||
// lanch editor
|
||||
try { Process.Start("https://codethemicrobit.com#uploader"); } catch (Exception) { }
|
||||
try { Process.Start("https://pxt.microbit.org#uploader"); } catch (Exception) { }
|
||||
}
|
||||
|
||||
private void initializeFileWatch()
|
||||
@ -236,7 +236,7 @@ namespace Microsoft.MicroBit
|
||||
{
|
||||
try
|
||||
{
|
||||
Process.Start("https://codethemicrobit.com/uploader");
|
||||
Process.Start("https://pxt.microbit.org/uploader");
|
||||
}
|
||||
catch (IOException) { }
|
||||
}
|
||||
|
34
cmds/cmds.ts
@ -9,26 +9,29 @@ 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("cannot find any drives to deploy to");
|
||||
return Promise.resolve(0);
|
||||
}
|
||||
return Promise.map(drives, d =>
|
||||
writeFileAsync(d + ts.pxt.BINARY_HEX, res.outfiles[ts.pxt.BINARY_HEX])
|
||||
.then(() => {
|
||||
console.log("wrote hex file to " + d)
|
||||
}))
|
||||
})
|
||||
.then(() => { })
|
||||
|
||||
console.log(`copy ${ts.pxtc.BINARY_HEX} to ` + drives.join(", "));
|
||||
|
||||
let writeHexFile = (filename: string) => {
|
||||
return writeFileAsync(filename + ts.pxtc.BINARY_HEX, res.outfiles[ts.pxtc.BINARY_HEX])
|
||||
.then(() => console.log("wrote hex file to " + filename));
|
||||
};
|
||||
|
||||
return Promise.map(drives, d => writeHexFile(d))
|
||||
.then(() => drives.length);
|
||||
});
|
||||
}
|
||||
|
||||
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 +45,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([])
|
||||
}
|
||||
|
@ -1,22 +0,0 @@
|
||||
{
|
||||
"name": "koduj z micro:bit",
|
||||
"title": "koduj z micro:bit",
|
||||
"docMenu": [
|
||||
{
|
||||
"name": "O nas",
|
||||
"path": "/about"
|
||||
},
|
||||
{
|
||||
"name": "Lekcje",
|
||||
"path": "/lessons"
|
||||
},
|
||||
{
|
||||
"name": "Instrukcja obsługi",
|
||||
"path": "/reference"
|
||||
},
|
||||
{
|
||||
"name": "Urządzenie",
|
||||
"path": "/device"
|
||||
}
|
||||
]
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
# Dokumentacja
|
||||
|
||||
Witamy na stronach dokumentacji!
|
||||
|
||||
* Przeglądnij [instrukcje obsługi](/reference)
|
||||
* Dowiedz się więcej o [urządzeniu](/device)
|
||||
* Wystartuj z [lekcjami](/lessons)
|
@ -1,3 +1,50 @@
|
||||

|
||||
|
||||
# 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).
|
||||
|
||||
The micro:bit provides an easy and fun introduction to programming and making – switch on, program it to do something fun – wear it, customize it.
|
||||
Just like Arduino, the micro:bit can be connected to and interact with sensors, displays, and other devices.
|
||||
|
||||
* [Read the docs](/docs)
|
||||
|
||||
## [Hardware: The Device](/device)
|
||||
|
||||
The BBC micro:bit is packaged with sensors, radio and other goodies. Learn about the [hardware components](/device) of the micro:bit to make the most of it!
|
||||
|
||||
## Programming: [Blocks](/blocks) or [JavaScript](/javascript)
|
||||
|
||||
You can program the micro:bit using [Blocks](/blocks) or [JavaScript](/javascript) in your web browser via the [micro:bit APIs](/reference):
|
||||
|
||||
```block
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
basic.showString("Hi!");
|
||||
})
|
||||
```
|
||||
```typescript
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
basic.showString("Hi!");
|
||||
})
|
||||
```
|
||||
|
||||
The editor work in [most modern browsers](/browsers), work [offline](/offline) once loaded and do not require any installation.
|
||||
|
||||
## [Compile and Flash: Your Program!](/device/usb)
|
||||
|
||||
When you have your code ready, you connect your micro:bit to a computer via a USB cable, so it appears as a mounted drive (named MICROBIT).
|
||||
|
||||
Compilation to ARM thumb machine code from [Blocks](/blocks) or [JavaScript](/javascript) happens in the browser. You save the ARM binary
|
||||
program to a file, which you then copy to the micro:bit drive, which flashes the micro:bit device with the new program.
|
||||
|
||||
## Simulator: Test Your Code
|
||||
|
||||
You can run your code using the micro:bit simulator, all within the confines of a web browser.
|
||||
The simulator has support for the LED screen, buttons, as well as compass, accelerometer, and digital I/O pins.
|
||||
|
||||
```sim
|
||||
basic.forever(() => {
|
||||
basic.showString("Hi!");
|
||||
@ -20,43 +67,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).
|
||||
|
||||
The micro:bit provides an easy and fun introduction to programming and making – switch on, program it to do something fun – wear it, customize it.
|
||||
Just like Arduino, the micro:bit can be connected to and interact with sensors, displays, and other devices.
|
||||
|
||||
## Hardware: The Device
|
||||
|
||||
Learn about the [hardware components](/device) of the micro:bit to make the most of it!
|
||||
|
||||
## Programming: Blocks or JavaScript
|
||||
|
||||
You can program the micro:bit using [Blocks](/blocks) or [JavaScript](/javascript), via the [micro:bit APIs](/reference):
|
||||
|
||||
```blocks
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
basic.showString("Hi!");
|
||||
})
|
||||
```
|
||||
|
||||
## Compile and Flash: Your Program!
|
||||
|
||||
When you have your code ready, you connect your micro:bit to a computer via a USB cable, so it appears as a mounted drive (named MICROBIT).
|
||||
|
||||
Compilation to ARM thumb machine code from [Blocks](/blocks) or [JavaScript](/javascript) happens in the browser. You save the ARM binary
|
||||
program to a file, which you then copy to the micro:bit drive, which flashes the micro:bit device with the new program.
|
||||
|
||||
## Simulator: Test Your Code
|
||||
|
||||
You can run your code using the micro:bit simulator, all within the confines of a web browser.
|
||||
The simulator has support for the LED screen, buttons, as well as compass, accelerometer, and digital I/O pins.
|
||||
|
||||
## C++ Runtime
|
||||
|
||||
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,
|
||||
@ -65,6 +77,15 @@ as well as a set of helper functions (such as displaying a number/image/string o
|
||||
The [micro:bit library](/reference) mirrors the functions of the C++ library.
|
||||
When code is compiled to ARM machine code, the calls to JavaScript micro:bit functions are replaced with calls to the corresponding C++ functions.
|
||||
|
||||
## Open Source
|
||||
## [Command Line Tools](/cli)
|
||||
|
||||
Looking to use pxt.microbit.org in your favorite editor? Install the [command line tools](/cli) and get rolling!
|
||||
|
||||
## [Packages](/packages)
|
||||
|
||||
Create, edit and distribute your own blocks and JavaScript using [packages](/packages). Packages are hosted on GitHub and may be written
|
||||
using C++, JavaScript and/or ARM thumb.
|
||||
|
||||
## [Open Source](/open-source)
|
||||
|
||||
The code for the micro:bit is [open source](/open-source) on GitHub. Contributors are welcome!
|
||||
|
3
docs/beta-ref.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"appref": "v"
|
||||
}
|
@ -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)
|
||||
|
103
docs/browsers.md
Normal file
@ -0,0 +1,103 @@
|
||||
# Unsupported configuration
|
||||
|
||||
Your browser is currently not supported. The following configurations are supported:
|
||||
|
||||
## Windows
|
||||
|
||||
You need one of these browsers running on Windows 7, Windows 8, Windows 8.1, or
|
||||
Windows 10:
|
||||
|
||||
* Internet Explorer 11
|
||||
* Microsoft Edge
|
||||
* Google Chrome
|
||||
* Mozilla Firefox
|
||||
|
||||
## Mac
|
||||
|
||||
You need one of these browsers running on OS X 10.9 Mavericks, OS X 10.10
|
||||
Yosemite, OS X 10.11 El Capitan, or macOS 10.12 Sierra:
|
||||
|
||||
* Safari
|
||||
* Google Chrome
|
||||
* Mozilla Firefox
|
||||
|
||||
## Linux
|
||||
|
||||
If you're using a Raspberry Pi, please see [the documentation
|
||||
here](/raspberry-pi).
|
||||
|
||||
You need to be running a Linux distribution recent enough to run the most recent
|
||||
version of one of the following:
|
||||
|
||||
* Google Chrome, or Chromium
|
||||
* Mozilla Firefox, Iceweasel, or Seamonkey
|
||||
|
||||
## How to check your OS or browser
|
||||
|
||||
### Windows
|
||||
|
||||
* Click on the Start menu
|
||||
* Type 'System'
|
||||
* Click on the app called 'System'
|
||||
* The version of Windows you are using will be displayed:
|
||||
|
||||

|
||||
|
||||
### Mac
|
||||
|
||||
* Click on the Apple icon in the top left
|
||||
* Click on 'About this Mac'
|
||||
* This window will be displayed:
|
||||
|
||||

|
||||
|
||||
### Internet Explorer
|
||||
|
||||
* Click on the Settings icon in the top right
|
||||
* Click 'About Internet Explorer'
|
||||
* This window will be displayed:
|
||||
|
||||

|
||||
|
||||
### Edge
|
||||
|
||||
Edge automatically updates, so you should always be using the latest version
|
||||
|
||||
* Click on the menu icon in the top right (three dots)
|
||||
* Scroll to the bottom
|
||||
* Information similar to the following will be displayed:
|
||||
|
||||

|
||||
|
||||
### Google Chrome
|
||||
|
||||
Google Chrome automatically updates, so you should always be using the latest version
|
||||
|
||||
* Click on the menu icon in the top right (three dots)
|
||||
* Click Help, and About Google Chrome
|
||||
* Information similar to the following will be displayed:
|
||||
|
||||

|
||||
|
||||
### Firefox
|
||||
|
||||
Firefox automatically updates, so you should always be using the latest version
|
||||
|
||||
* Click on the menu icon in the top right (three horizontal lines)
|
||||
* Click the question mark icon (help button)
|
||||
* Click 'About Firefox'
|
||||
|
||||

|
||||
|
||||
### Safari
|
||||
|
||||
Safari updates when your operating system updates, so if you are using the
|
||||
latest version of OS X then you'll be using the latest version of Safari.
|
||||
|
||||
* Click on the Safari menu in the top left
|
||||
* Click 'About Safari'
|
||||
|
||||

|
||||
|
||||
IT administrators should check which browser versions are supported
|
||||
[here](/browsers/technical).
|
16
docs/browsers/linux.md
Normal file
@ -0,0 +1,16 @@
|
||||
# Recommended browser for Linux
|
||||
|
||||
As you are using Linux, it is recommended that you use [Mozilla
|
||||
Firefox][firefox] or [Google Chrome][chrome].
|
||||
|
||||
Please see [here][technical] for technical information on which browsers are
|
||||
supported, or [here][versions] to check which version you are using.
|
||||
|
||||
[edge]: https://www.microsoft.com/en-us/windows/microsoft-edge
|
||||
[ie]: https://www.microsoft.com/en-us/download/internet-explorer.aspx
|
||||
[firefox]: https://www.mozilla.org/en-US/firefox/new/
|
||||
[chrome]: https://www.google.com/chrome/
|
||||
[opera]: https://www.opera.com
|
||||
[safari]: http://www.apple.com/safari/
|
||||
[technical]: /browsers/technical
|
||||
[versions]: /browsers
|
16
docs/browsers/mac.md
Normal file
@ -0,0 +1,16 @@
|
||||
# Recommended browser for Mac
|
||||
|
||||
As you are using a Mac, it is recommended that you use [Safari][]. Alternatively,
|
||||
[Google Chrome][chrome] and [Mozilla Firefox][firefox] are also supported.
|
||||
|
||||
Please see [here][technical] for technical information on which browsers are
|
||||
supported, or [here][versions] to check which version you are using.
|
||||
|
||||
[edge]: https://www.microsoft.com/en-us/windows/microsoft-edge
|
||||
[ie]: https://www.microsoft.com/en-us/download/internet-explorer.aspx
|
||||
[firefox]: https://www.mozilla.org/en-US/firefox/new/
|
||||
[chrome]: https://www.google.com/chrome/
|
||||
[opera]: https://www.opera.com
|
||||
[safari]: http://www.apple.com/safari/
|
||||
[technical]: /browsers/technical
|
||||
[versions]: /browsers
|
36
docs/browsers/technical.md
Normal file
@ -0,0 +1,36 @@
|
||||
# Technical information about browser support
|
||||
|
||||
[pxt.microbit.org][] requires that you use a recent version of a modern
|
||||
browser, such as Microsoft Edge, Google Chrome, Mozilla Firefox, Safari, Opera,
|
||||
or IE11. This is because the editor uses modern web technologies such as [web
|
||||
workers][] to enable compiling [TypeScript][] in the browser, or the using the
|
||||
same [Monaco][] editor that powers [Visual Studio Code][].
|
||||
|
||||
[pxt.microbit.org]: https://pxt.microbit.org
|
||||
[web workers]: http://www.w3.org/TR/workers/
|
||||
[typescript]: http://www.typescriptlang.org
|
||||
[monaco]: https://microsoft.github.io/monaco-editor/
|
||||
[visual studio code]: http://code.visualstudio.com
|
||||
|
||||
Most modern browsers automatically update themselves, but in some environments
|
||||
such as schools these automatic updates are disabled for security. **We
|
||||
strongly recommend that you use the most recent version of any of these
|
||||
browsers**, but if you can't then you must use at least:
|
||||
|
||||
| Browser | Minimum version | Release date | Windows | Mac |
|
||||
| ----------------- | --------------- | -------------- | ----------- | ---------- |
|
||||
| Edge | 12 | March 2015 | Windows 10+ | N/A |
|
||||
| Internet Explorer | 11 | October 2013 | Windows 7+ | N/A |
|
||||
| Mozilla Firefox | 31 ESR | July 2014 | Windows XP+ | OS X 10.6+ |
|
||||
| Google Chrome | 38 | October 2014 | Windows XP+ | OS X 10.6+ |
|
||||
| Safari | 9 | September 2015 | N/A | OS X 10.9+ |
|
||||
| Opera | 21 | May 2014 | Windows 7+ | OS X 10.9+ |
|
||||
|
||||
|
||||
Please see our information for which browsers are recommended for [Windows][],
|
||||
[Mac][], [Linux][], or [Raspberry Pi][].
|
||||
|
||||
[Windows]: /browsers/windows
|
||||
[Mac]: /browsers/mac
|
||||
[Linux]: /browsers/linux
|
||||
[Raspberry Pi]: /raspberry-pi
|
18
docs/browsers/windows.md
Normal file
@ -0,0 +1,18 @@
|
||||
# Recommended browser for Windows
|
||||
|
||||
We recommend [Microsoft Edge][edge] if you are running Windows 10, but users on
|
||||
Windows 7 or higher can use [Internet Explorer 11][ie] or recent versions of
|
||||
[Mozilla Firefox][firefox], [Google Chrome][chrome], or [Opera][opera].
|
||||
|
||||
|
||||
Please see [here][technical] for technical information on which browsers are
|
||||
supported, or [here][versions] to check which version you are using.
|
||||
|
||||
[edge]: https://www.microsoft.com/en-us/windows/microsoft-edge
|
||||
[ie]: https://www.microsoft.com/en-us/download/internet-explorer.aspx
|
||||
[firefox]: https://www.mozilla.org/en-US/firefox/new/
|
||||
[chrome]: https://www.google.com/chrome/
|
||||
[opera]: https://www.opera.com
|
||||
[safari]: http://www.apple.com/safari/
|
||||
[technical]: /browsers/technical
|
||||
[versions]: /browsers
|
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 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)**
|
50
docs/code.md
@ -1,54 +1,16 @@
|
||||
# Visual Studio Code
|
||||
|
||||
Visual Studio Code is a Free Open Source code editor that you can use to edit your programs.
|
||||
[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
|
||||
|
||||
## Setup
|
||||
**Follow [these instructions](https://pxt.io/cli)** to setup your machine and edit your programs in Visual Studio Code.
|
||||
|
||||
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.
|
@ -1,17 +1,47 @@
|
||||
# crocodile clips
|
||||
|
||||
The large holes at the bottom of the board are designed to attach alligator/crocodile clips.
|
||||
Register an event that will execute whenever the user attaches one side of the crocodile clip to the `GND` pin, then connects and disconnects the unattached side of the crocodile clip to pin `0`, `1`, or `2`.
|
||||
The large holes at the bottom of the board are designed to attach alligator/crocodile clips
|
||||
to create electrical circuit with other components.
|
||||
|
||||
### Example: on pin pressed with random numbers
|
||||
# ~hint
|
||||
|
||||
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
|
||||
**No crocodile clips!?!?!** Use wires or Aluminium foil! [Read more...](/device/foil-circuits)
|
||||
|
||||

|
||||
# ~
|
||||
|
||||
### Connecting Crocodile Clips
|
||||
|
||||
### See also
|
||||
## Connecting Crocodile Clips
|
||||
|
||||
[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)
|
||||
The hole for ``P0`` and ``GND`` allow to grab the board on the side which makes for a great grip.
|
||||
|
||||

|
||||
|
||||
Pass one jaw in the hole and grab the side of the board with the other jaw.
|
||||
|
||||

|
||||
|
||||
For the center holes, ``P1`` and ``P2``, you can also grab the bottom of the board but they are a bit harder to grip.
|
||||
|
||||
You can also grip the board between the jaws. In which case, you will want to make sure to avoid overlapping the jaws
|
||||
with the other pins as it will create short-circuit in the board.
|
||||
|
||||

|
||||
|
||||
Adding a little tape helps keeping the crocodile clips in place.
|
||||
|
||||

|
||||
|
||||
## Example: on pin pressed with random numbers
|
||||
|
||||
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))
|
||||
})
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
[micro:bit pins](/device/pins)
|
||||
|
@ -1,7 +1,5 @@
|
||||
# Error codes
|
||||
|
||||
The micro:bit error codes
|
||||
|
||||
Your micro:bit may encounter a situation that prevents it from running your code. When this happens, a frowny face will appear on your micro:bit screen (see picture) followed by an error number.
|
||||
|
||||
Below is a list of error numbers and what they mean:
|
||||
|