Compare commits
665 Commits
Author | SHA1 | Date | |
---|---|---|---|
f4727f12c9 | |||
a36cb65aa5 | |||
3b16e59ee1 | |||
f2c43c74ac | |||
1c4c93dc60 | |||
d73847bfba | |||
4e46682489 | |||
ab7aa00747 | |||
2bebb6056d | |||
22046c417c | |||
dc8afa6d45 | |||
22e2ab5ad9 | |||
f365726a8e | |||
e329b3bd2e | |||
d7b709e97b | |||
9714ec46e9 | |||
20ef54f565 | |||
554df0bce9 | |||
6c89dddef6 | |||
23f91895f7 | |||
3f83cda087 | |||
7e79635413 | |||
56e1cf91ac | |||
f9f96f33f0 | |||
0b33073be1 | |||
65594842fc | |||
c6ed665f84 | |||
79462deb24 | |||
5c05f3e241 | |||
4f7dd75fbe | |||
338e507b51 | |||
601231a5dc | |||
f0850336e5 | |||
a6b2187ec5 | |||
28ae4f4230 | |||
09933b6a8d | |||
45bb6e7cb3 | |||
33c234a87e | |||
e9aa343d67 | |||
d83039430c | |||
5b2e877aef | |||
c5b28f5b8e | |||
e765021bf9 | |||
dbcd9e535c | |||
cff88d67ad | |||
3f241e8bc9 | |||
69c3d2d249 | |||
bc04d30595 | |||
63a26835b1 | |||
79113115e0 | |||
573ed7f6f2 | |||
61da1032d6 | |||
36d455c693 | |||
42c766b6d7 | |||
6f00384891 | |||
8440f7c763 | |||
8a8e864f99 | |||
7a3402b782 | |||
5e9a5b29f4 | |||
aff9d1ee60 | |||
8add7e8efb | |||
e7dfd0531b | |||
d2b1f70ce2 | |||
fbf7513c44 | |||
e9bdc26d15 | |||
52fafe9359 | |||
971dca6c96 | |||
a761c27b19 | |||
a062a85c7f | |||
a9865a731a | |||
ba4095ac9c | |||
8606a00701 | |||
bf57ba2902 | |||
4cd61cd96a | |||
c4139a862f | |||
ca3cd1de22 | |||
d7f22bc8e6 | |||
28b28d0b52 | |||
0ee2b285c0 | |||
d5cb085264 | |||
c055a5d329 | |||
8fe8b78f4c | |||
f627f125c0 | |||
7d3254477a | |||
3149ed4c1d | |||
baeafcdebe | |||
12754acc54 | |||
329baaf9a4 | |||
47efcfb41f | |||
e2d1b8a55c | |||
579eb29ce3 | |||
ada9560642 | |||
7b352b3a58 | |||
a5d5836ea2 | |||
57dc26a127 | |||
3e37b03808 | |||
d035713786 | |||
6e4a71b2f4 | |||
0b4dd534ab | |||
ed07f0baad | |||
004d34b5df | |||
aa380baf1c | |||
5123a962d9 | |||
7dcd770508 | |||
ead4d32446 | |||
a51a14022a | |||
05098252ed | |||
8e74965964 | |||
63913c2182 | |||
c55716e148 | |||
dd94442555 | |||
56f6a2fa56 | |||
4ca9df141c | |||
a29e06abce | |||
43e4d06fd9 | |||
3c8027425a | |||
3f66870688 | |||
1f32a4851e | |||
478b1c84de | |||
20ac14fdf6 | |||
c805d67cf6 | |||
943c2e7716 | |||
298a37e576 | |||
327d52014c | |||
6a5cfae5ff | |||
64ebb5c8c3 | |||
bb97b57b01 | |||
534e3723d2 | |||
ad6ef04b1f | |||
2c09b7794f | |||
4941ce1694 | |||
aa6a965f59 | |||
1831c30050 | |||
df5989760c | |||
6a7f65894c | |||
f56e9369dd | |||
e23c5e019f | |||
1aa08f63fe | |||
8ef94d2854 | |||
797474063d | |||
b76622542b | |||
6a1415b3e1 | |||
2d09aef287 | |||
3ce1fa9b6e | |||
155bbb25f7 | |||
5fb3da5a77 | |||
5b682cd8d9 | |||
4755f0953c | |||
bdcd299805 | |||
3e23fe4814 | |||
3782d26e64 | |||
84a29eec65 | |||
299efaf0f2 | |||
33c60b467b | |||
81f74f07b2 | |||
583b08df28 | |||
01f80b67bc | |||
a890d2a357 | |||
0d1b91afc3 | |||
5c0d37d718 | |||
c81e56613e | |||
4cc7215d35 | |||
8751d2aaa1 | |||
af91622dda | |||
45d4caf595 | |||
a8e1d2a86c | |||
5099b11823 | |||
37e0307698 | |||
1b15eefa5a | |||
a4eccaf4f9 | |||
5981863e3f | |||
9ac7a4c522 | |||
9f1c3ee13c | |||
8b9c3d71d5 | |||
6d726b7499 | |||
b5da5afd1d | |||
420898e98c | |||
f6b392356c | |||
f4896f8d7c | |||
4dbd691146 | |||
2742dba0c4 | |||
5bea47a094 | |||
835a4b5cf0 | |||
055704b3ef | |||
60107aa7ce | |||
787ab021a7 | |||
f56a70f502 | |||
4ec6749ee6 | |||
8413b61397 | |||
ecbb970983 | |||
36e6570296 | |||
92c63b615a | |||
f71267c988 | |||
38fc0f8099 | |||
8c7238eab3 | |||
2baca30184 | |||
ac56979142 | |||
ff72858c42 | |||
deac587164 | |||
7a0a2fbd0a | |||
79c32097b5 | |||
26c20d9fc3 | |||
fe826a508a | |||
62d2140d24 | |||
499d619faf | |||
c178e58260 | |||
d242501fe6 | |||
37a438735d | |||
b862cfc4ec | |||
31002ae1a8 | |||
e8a3a2f676 | |||
e6baf8c35e | |||
b72ff9fe4f | |||
58f79ea617 | |||
ed6d343992 | |||
92b46d5c7b | |||
9cf7f08ae2 | |||
3b05b8f2f6 | |||
774d614d79 | |||
545f715eeb | |||
45b480c6dd | |||
7cc93507d9 | |||
80d3f67e6c | |||
dfbea2719b | |||
ce5da6bf80 | |||
d8d2129685 | |||
5dd37a1494 | |||
6cfe39dac3 | |||
660b22b398 | |||
b9a24a4542 | |||
af5bf6e04e | |||
ecc71a3295 | |||
0834402b18 | |||
8edd8ac73a | |||
1207a91a7f | |||
727490668c | |||
f068b3d204 | |||
205a486e58 | |||
f3bfd41a75 | |||
8d5c5daaaf | |||
83cfe8f534 | |||
9378e5e90c | |||
8617f0f3b4 | |||
0ecf3dc2b4 | |||
76005841fa | |||
7bf00ff139 | |||
82e34d852c | |||
7cd8ee1e23 | |||
a91a87b628 | |||
9d71f46e78 | |||
ccf405e64c | |||
c0a75d1845 | |||
e65a521bd4 | |||
1f203269ff | |||
18feea45bb | |||
597f0c895b | |||
5f21789d90 | |||
64826db4aa | |||
b150ee873f | |||
34effcefc6 | |||
68be2384d9 | |||
2629192bdb | |||
67b5afd73a | |||
5d8193301c | |||
adf21fee6f | |||
20f3e1d24e | |||
bf8f38fe38 | |||
3e3b8ebec5 | |||
8faeeffecf | |||
343968cf09 | |||
ca92f787e8 | |||
49a67e73be | |||
11af897c3d | |||
08cd04b2c8 | |||
c1656cf441 | |||
8f3c585588 | |||
dd181e4178 | |||
ff3689e92d | |||
fffcf0f809 | |||
240162370e | |||
98238caffb | |||
f55977a51d | |||
91938f156a | |||
eb01245cce | |||
17cbea9989 | |||
22c03dfd7a | |||
cf3e8684d5 | |||
cd0b2a646f | |||
d7528c09e3 | |||
e055484492 | |||
947d69da48 | |||
07822c47a3 | |||
25d6746b7e | |||
7cb85ff459 | |||
73d18c8d39 | |||
74b6d99ab1 | |||
491ff29e40 | |||
d1db619c8d | |||
733996f83e | |||
4a624cb365 | |||
637ea17f8e | |||
f8d6bd280e | |||
b91de5bad2 | |||
d7c3433bb2 | |||
43456e9a53 | |||
081244218f | |||
6ae39f192b | |||
ed5263f248 | |||
f1ee861eb4 | |||
2ce2fd95ba | |||
741f94ce6c | |||
4b7e415ae7 | |||
3efbb4fbde | |||
4d9450dd06 | |||
910870e46f | |||
b664df4208 | |||
c660277a23 | |||
0416d88d59 | |||
4f822e3cda | |||
20d4e473ff | |||
e45190922e | |||
1df118fa19 | |||
8ba27ccc2d | |||
ff646d32b5 | |||
75d99b324c | |||
ece91d980a | |||
a6a9f25e86 | |||
cc5330bf3d | |||
4a9e1466e6 | |||
fa947036f0 | |||
0b0884a7eb | |||
d5b2a21d16 | |||
fe28dd9b92 | |||
cfcbe8fb41 | |||
d86f820a57 | |||
ace1ddb00b | |||
96be411ba2 | |||
f24f7c2279 | |||
0130a7753e | |||
54b72ba312 | |||
7bced60466 | |||
041b10ef04 | |||
0e08b58f84 | |||
dd14489f47 | |||
6d6c2b5e99 | |||
251f382e8e | |||
887a652a06 | |||
bbbb1ea6bc | |||
2c399f198a | |||
54213cf554 | |||
0c67cd8e8b | |||
a0a23a261c | |||
20c7a16524 | |||
0a722b2196 | |||
4a537b1ce8 | |||
cf0372aeaa | |||
918d2f1a3a | |||
c1a6c1c66a | |||
7a2c4f0056 | |||
23eefb28d2 | |||
2ab2535966 | |||
bb20c1780b | |||
764505d2ca | |||
62b6b8e9eb | |||
beac252620 | |||
6e62acb384 | |||
b5afe25387 | |||
ebea6b29f3 | |||
f4eca66648 | |||
a6e6dd8287 | |||
d94c7e0157 | |||
4657263abb | |||
a6c2b24e8d | |||
31651f9a11 | |||
43c7692a8f | |||
7f05de734c | |||
fe39eec686 | |||
655fa0fde8 | |||
2841df6950 | |||
713dfec949 | |||
23c4087830 | |||
de293be4fc | |||
4e54649ce7 | |||
caeef2f1e1 | |||
f3d7693a26 | |||
2ceece6cdf | |||
c2913aea82 | |||
bf90e01e7e | |||
bbee53607b | |||
e94e2e7dc4 | |||
02a0839a4e | |||
67ea6c01f2 | |||
5b5cac878b | |||
56301d2d6f | |||
f8e80e6a9d | |||
d1f314d790 | |||
27f39b4458 | |||
0c40f79dec | |||
346ec3d1a6 | |||
5a2896808e | |||
4a34edeab0 | |||
5c2833978b | |||
edfc2274a2 | |||
899c9fd8d6 | |||
13f63c2f46 | |||
8841c47638 | |||
c6f5a8dcc6 | |||
786c5f9733 | |||
0cdedd02b4 | |||
aba028b1e8 | |||
3049c88d5b | |||
8239329c2e | |||
c9d4807f25 | |||
5f4ff08c09 | |||
b99be68ea5 | |||
c639cc3f83 | |||
cd56181703 | |||
5b1a807443 | |||
e604b27c4f | |||
4727b105c4 | |||
4063b5aac8 | |||
ee8505b4f1 | |||
ab4e2c458a | |||
126c236b14 | |||
532abadb6b | |||
eea179e07c | |||
f94015803f | |||
f085253306 | |||
6de2f22542 | |||
3051e09bcf | |||
bd835a8a6e | |||
f75a034a3f | |||
71b3b6bb22 | |||
b868bd1e09 | |||
02e48f196c | |||
742eb7ea2f | |||
f1904143b6 | |||
e621252f3b | |||
3633d39f57 | |||
21bbf8fc86 | |||
dd5124f660 | |||
966ad1f503 | |||
d94f394d24 | |||
40ddd896cf | |||
5a8815c4fc | |||
9a04eb1790 | |||
906e2a2fff | |||
781339026e | |||
bd23de14e1 | |||
e6ca366d20 | |||
e2ce49d94b | |||
e3b6350785 | |||
66aba696dc | |||
5206f1f8e8 | |||
f9a7ec89e4 | |||
97894511dd | |||
e785ece9bd | |||
63035b3d5c | |||
1f8ea7ad30 | |||
899ca47a77 | |||
84f14182bf | |||
ca3702b4fe | |||
94f1b6c785 | |||
c749c8b644 | |||
b108f1538d | |||
45690215dd | |||
af42dbf30a | |||
45ecd883bb | |||
641a714f74 | |||
d1cd0a23a2 | |||
54331eb113 | |||
d4c53f1fb3 | |||
40305c3ccd | |||
e6761699d3 | |||
b15f140181 | |||
00e38e202b | |||
4cbabcd112 | |||
5def3518cf | |||
2c6f76e1a5 | |||
3eb529852b | |||
3b0cb40ea9 | |||
5cb3467194 | |||
d5628c08c8 | |||
c5c0103573 | |||
b89d6477c7 | |||
f3a6b00734 | |||
091fbb9db8 | |||
3de977c98f | |||
d262dc3704 | |||
b2e59eb676 | |||
f2d5237d5c | |||
0c701a6809 | |||
d571ce85c1 | |||
6fa316ff0e | |||
1e436f4e71 | |||
d54aa41fc9 | |||
0d90aec229 | |||
98ee6899a1 | |||
c3e9ec2dc4 | |||
4cba801d78 | |||
a3d559c7af | |||
985ed56984 | |||
be284c5e52 | |||
d59d7cb19f | |||
28d522175b | |||
7b74428275 | |||
c5571c20c7 | |||
fc97b59d0e | |||
8417d10ad3 | |||
1a6d47a1c9 | |||
d74702353f | |||
53922986b1 | |||
230de475d1 | |||
9b1d2085ba | |||
246d81ffd5 | |||
3b2729d9d8 | |||
571ae8337f | |||
cc2d18b969 | |||
fd02bd9407 | |||
6429b57081 | |||
5650f7dc35 | |||
a9cfe83bdf | |||
f9409b5fb5 | |||
7f9f14df18 | |||
a383060b4d | |||
04c8221b41 | |||
facea7d27d | |||
cfe65569ad | |||
7a0ad8e3ed | |||
4fb10faec2 | |||
f3463b5961 | |||
f39703e6f7 | |||
74b333dee4 | |||
466bda468f | |||
f4afa773ad | |||
21280f41bc | |||
41c7053f3f | |||
1a00fded98 | |||
304ef89a1d | |||
433b2bb08d | |||
273e23095b | |||
8af6d640d3 | |||
5553fb93bb | |||
493f76eba7 | |||
91b90bf70e | |||
43adfa198f | |||
59f7d0b537 | |||
f3bfe3d94e | |||
ed54ace797 | |||
0648e80131 | |||
ce9a83ff28 | |||
54439bba4d | |||
23a581c899 | |||
3f8fa4b05b | |||
53ab8651bd | |||
87300be648 | |||
d0a7df7f36 | |||
1c8fa5eab6 | |||
d8c2d697b1 | |||
2ede815535 | |||
a67f16a860 | |||
819ab9aa9a | |||
318ffde27f | |||
525e59ae4f | |||
ab087b4afa | |||
3b8ae69a6c | |||
d4a55bd53d | |||
2b8d8f7b44 | |||
8b2037f51d | |||
1477fc4bed | |||
e4badc18b8 | |||
625d4de530 | |||
a3cf104185 | |||
608f2d8f82 | |||
8f9ac35d70 | |||
ce18ddbb70 | |||
ac64cbb8c5 | |||
706c51c99c | |||
7fa88249d6 | |||
5c735e839e | |||
19752b01b6 | |||
4192eeb413 | |||
87c63959cf | |||
79ee825926 | |||
20dbcfd203 | |||
993952cbe9 | |||
90a8bdcea1 | |||
b9cff5a5e9 | |||
638594bb5e | |||
d3b5809fe7 | |||
365f5dcecf | |||
4c9982051e | |||
655c9c4431 | |||
e328c22a2d | |||
dc9eb26038 | |||
3971bb5fc1 | |||
acfdfd3668 | |||
35edde573e | |||
6d21e28360 | |||
f636a7e37f | |||
c15c3255ef | |||
7f64328079 | |||
b19d7a5b7b | |||
8322310640 | |||
8f6577f029 | |||
a64b3e2b09 | |||
95ed3f419b | |||
8fcc59c9c3 | |||
a83a7f7135 | |||
2f1a7e3896 | |||
b32c14937c | |||
a5e1f84975 | |||
6d0beb1aa3 | |||
26d92f993b | |||
d4c0dddb62 | |||
fa17ce43f7 | |||
b9a9abb478 | |||
ae925da409 | |||
b82c3c0277 | |||
b4ce65cdf3 | |||
db7e8b6fd4 | |||
7532cc01a2 | |||
6725f8ef90 | |||
dea8054fbe | |||
f9cc3d2ee1 | |||
220ada6cd8 | |||
b68b12e6f1 | |||
5838c4d740 | |||
68d25e3814 | |||
06be2019a6 | |||
6a742f5348 | |||
73cf802300 | |||
2b71e2b834 | |||
0442c33808 | |||
2975e6acc9 | |||
df38904ba1 | |||
d744e21975 | |||
81c86f544c | |||
fa145ecd5c | |||
cdfc99ad3f | |||
f77e7b8850 | |||
d71186b083 | |||
852067c641 | |||
7445db5707 | |||
e4fd00c827 | |||
5ccecc1195 | |||
cdfcd30c3c | |||
25b4f46440 | |||
9f9cd6b766 | |||
4dafa4d42c | |||
fdff0a7f19 | |||
a63daed690 | |||
3eeaf2ca46 | |||
005e002fd8 | |||
b1db17fc27 | |||
a51791414c | |||
265dd660ef | |||
7517776492 | |||
29b901b856 | |||
20637aeb29 | |||
90dbc6dd08 | |||
8f99ee3608 | |||
15bbc13595 | |||
cac5df56eb | |||
0c7f9058a7 |
18
.gitignore
vendored
@ -1,12 +1,20 @@
|
||||
node_modules
|
||||
yotta_modules
|
||||
yotta_targets
|
||||
pxt_modules
|
||||
built
|
||||
typings
|
||||
tmp
|
||||
temp
|
||||
projects
|
||||
win10/app/bin
|
||||
win10/app/bld
|
||||
win10/*.opendb
|
||||
projects/**
|
||||
clients/win10/app/AppPackages
|
||||
clients/win10/app/BundlePackages
|
||||
clients/win10/app/BundleArtifacts
|
||||
clients/win10/app/bin
|
||||
clients/win10/app/bld
|
||||
clients/win10/*.opendb
|
||||
clients/**/bin/**
|
||||
clients/**/obj/**
|
||||
|
||||
*.user
|
||||
*.sw?
|
||||
@ -14,4 +22,4 @@ win10/*.opendb
|
||||
*.tgz
|
||||
*.db
|
||||
*.suo
|
||||
*.log
|
||||
*.log
|
||||
|
@ -4,8 +4,12 @@ node_js:
|
||||
script:
|
||||
- "node node_modules/pxt-core/built/pxt.js travis"
|
||||
- "(cd libs/lang-test0; node ../../node_modules/pxt-core/built/pxt.js run)"
|
||||
- "(cd libs/lang-test1; node ../../node_modules/pxt-core/built/pxt.js run)"
|
||||
- "(cd libs/lang-test0; node ../../node_modules/pxt-core/built/pxt.js test)"
|
||||
- "(cd libs/lang-test1; node ../../node_modules/pxt-core/built/pxt.js test)"
|
||||
- "node node_modules/pxt-core/built/pxt.js testdir tests"
|
||||
- "node node_modules/pxt-core/built/pxt.js uploaddoc"
|
||||
- "(cd libs/hello; node ../../node_modules/pxt-core/built/pxt.js testconv ../../testconv.json)"
|
||||
- "(cd libs/hello; node ../../node_modules/pxt-core/built/pxt.js testconv https://az851932.vo.msecnd.net/files/td-converter-tests-v0.json)"
|
||||
sudo: false
|
||||
notifications:
|
||||
email:
|
||||
@ -14,4 +18,5 @@ cache:
|
||||
directories:
|
||||
- node_modules
|
||||
- built/cache
|
||||
- libs/hello/built/cache
|
||||
|
||||
|
55
README.md
@ -1,19 +1,27 @@
|
||||
# micro:bit target for PXT
|
||||
|
||||
This target allow to program a [BBC micro:bit](https://www.microbit.co.uk/) using
|
||||
[Microsoft Programming Experience Toolkit](https://github.com/Microsoft/pxt).
|
||||
PXT ([Microsoft Programming Experience Toolkit](https://github.com/Microsoft/pxt)).
|
||||
|
||||
* [Try it live](https://m.pxt.io)
|
||||
* [Try it live](https://codethemicrobit.com)
|
||||
|
||||
[](https://travis-ci.org/Microsoft/pxt-microbit)
|
||||
|
||||
## Local server
|
||||
|
||||
The local server allows to run the editor and the documentation from your computer.
|
||||
|
||||
### Setup
|
||||
|
||||
The following commands are a 1-time setup after synching the repo on your machine.
|
||||
|
||||
* install the PXT command line
|
||||
* if not yet installed, install [Node.js 4.4.5 or higher](https://nodejs.org/en/download/)
|
||||
* [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
|
||||
cd pxt-microbit
|
||||
```
|
||||
* install the PXT command line (add ``sudo`` for Mac/Linux shells).
|
||||
```
|
||||
npm install -g pxt
|
||||
```
|
||||
@ -24,13 +32,23 @@ npm install
|
||||
|
||||
### Running
|
||||
|
||||
Run this command to open a local web server:
|
||||
Run this command to open a local web server (add ``sudo`` for Mac/Linux shells)
|
||||
```
|
||||
pxt serve
|
||||
```
|
||||
To make sure you're running the latest tools, run
|
||||
If the local server opens in the wrong browser, make sure to copy the URL containing the local token.
|
||||
Otherwise, the editor will not be able to load the projects.
|
||||
|
||||
If you need modify the `.cpp` files, turn on yotta compilation with the ``-yt`` flag (add ``sudo`` for Mac/Linux shells):
|
||||
```
|
||||
npm update
|
||||
pxt serve -yt
|
||||
```
|
||||
|
||||
## Updates
|
||||
|
||||
To update your PXT version and make sure you're running the latest tools, run (add ``sudo`` for Mac/Linux shells)
|
||||
```
|
||||
pxt update
|
||||
```
|
||||
|
||||
More instructions at https://github.com/Microsoft/pxt#running-a-target-from-localhost
|
||||
@ -38,9 +56,30 @@ More instructions at https://github.com/Microsoft/pxt#running-a-target-from-loca
|
||||
## 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 m.pxt.io and provides additional features.
|
||||
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 ``m.pxt.io`` project.
|
||||
* open the ``win10/app.sln`` solution and launch the ``codethemicrobit`` project.
|
||||
|
||||
## Testing
|
||||
|
||||
The build automatically runs the following:
|
||||
|
||||
* make sure the built-in packages compile
|
||||
* `pxt run` in `libs/lang-test*` - this will run the test in command line runner;
|
||||
there is a number of asserts in both of these
|
||||
* `pxt testdir` in `tests` - this makes sure all the files compile and generates .hex files
|
||||
* run the TD->TS converter on a number of test scripts from `microbit.co.uk` and make sure the results compile
|
||||
|
||||
To test something on the device:
|
||||
|
||||
* do a `pxt deploy` in `libs/lang-test*` - they should show `1` or `2` on the screen (and not unhappy face)
|
||||
* run `pxt testdir` in `tests` and deploy some of the hex files from `tests/built`
|
||||
|
||||
The `lang-test0` source comes from the `pxt-core` package. It's also tested with `pxt run` there.
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
||||
|
26
clients/chrome/README.md
Normal file
@ -0,0 +1,26 @@
|
||||
# microbit-chrome
|
||||
Prototype chrome addon that exposes the micro:bit's serial output to webpages.
|
||||
* watch the [demo video](https://vimeo.com/146207766)
|
||||
|
||||
# Installation
|
||||
See [developer.chrome.com](https://developer.chrome.com/extensions/getstarted#unpacked)
|
||||
for instructions on how to install the local version into your chrome browser.
|
||||
|
||||
# Requirements
|
||||
* Chrome 48 or later.
|
||||
|
||||
# Sample page
|
||||
The `demo.html` webpage goes along with the
|
||||
https://github.com/Microsoft/microbit-touchdevelop/blob/master/examples/tcs34725.cpp
|
||||
program. Run `http-server` from this directory, then visit
|
||||
http://localhost:8080/demo.html
|
||||
(keep in mind that pages served from `file://` cannot open ports).
|
||||
|
||||
# Building
|
||||
|
||||
Open a command prompt and run the following commands.
|
||||
|
||||
````
|
||||
npm install
|
||||
typings update
|
||||
````
|
68
clients/chrome/background.js
Normal file
@ -0,0 +1,68 @@
|
||||
///<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.
|
||||
var ports = [];
|
||||
function byPath(path) {
|
||||
return connections.filter(function (x) { return x.path == path; });
|
||||
}
|
||||
function byId(id) {
|
||||
return connections.filter(function (x) { return x.id == id; });
|
||||
}
|
||||
function onReceive(data, id) {
|
||||
if (ports.length == 0)
|
||||
return;
|
||||
var view = new DataView(data);
|
||||
var decoder = new TextDecoder("utf-8");
|
||||
var decodedString = decoder.decode(view);
|
||||
ports.forEach(function (port) { return port.postMessage({
|
||||
type: "serial",
|
||||
data: decodedString,
|
||||
id: id
|
||||
}); });
|
||||
}
|
||||
function findNewDevices() {
|
||||
chrome.serial.getDevices(function (serialPorts) {
|
||||
serialPorts.forEach(function (serialPort) {
|
||||
if (byPath(serialPort.path).length == 0 &&
|
||||
serialPort.displayName == "mbed Serial Port") {
|
||||
chrome.serial.connect(serialPort.path, { bitrate: 115200 }, function (info) {
|
||||
// In case the [connect] operation takes more than five seconds...
|
||||
if (info && byPath(serialPort.path).length == 0)
|
||||
connections.push({
|
||||
id: info.connectionId,
|
||||
path: serialPort.path
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
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)) {
|
||||
ports.push(port);
|
||||
port.onDisconnect.addListener(function () {
|
||||
ports = ports.filter(function (x) { return x != port; });
|
||||
});
|
||||
}
|
||||
});
|
||||
// When receiving data for one of the connections that we're tracking, forward
|
||||
// it to all connected clients.
|
||||
chrome.serial.onReceive.addListener(function (info) {
|
||||
if (byId(info.connectionId).length > 0)
|
||||
onReceive(info.data, info.connectionId);
|
||||
});
|
||||
// When it looks like we've been disconnected, drop the corresponding
|
||||
// connection object from the [connections] global variable.
|
||||
chrome.serial.onReceiveError.addListener(function (info) {
|
||||
if (info.error == "system_error" || info.error == "disconnected" || info.error == "device_lost")
|
||||
connections = connections.filter(function (x) { return x.id != info.connectionId; });
|
||||
});
|
||||
// Probe serial connections at regular intervals. In case we find an mbed port
|
||||
// we haven't yet connected to, connect to it.
|
||||
setInterval(findNewDevices, 5000);
|
||||
findNewDevices();
|
||||
}
|
||||
document.addEventListener("DOMContentLoaded", main);
|
92
clients/chrome/background.ts
Normal file
@ -0,0 +1,92 @@
|
||||
// A list of: {
|
||||
// id: number;
|
||||
// path: string;
|
||||
// } where [id] is the [connectionId] (internal to Chrome) and [path] is the
|
||||
// OS' name for the device (e.g. "COM4").
|
||||
interface Connection {
|
||||
id: string;
|
||||
path: string;
|
||||
}
|
||||
let connections: Connection[] = [];
|
||||
|
||||
// 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.
|
||||
let ports = [];
|
||||
|
||||
interface Message {
|
||||
type: string;
|
||||
data: string;
|
||||
id: string;
|
||||
}
|
||||
|
||||
function byPath(path: string): Connection[] {
|
||||
return connections.filter((x) => x.path == path);
|
||||
}
|
||||
|
||||
function byId(id: string): Connection[] {
|
||||
return connections.filter((x) => x.id == id);
|
||||
}
|
||||
|
||||
function onReceive(data, id: string) {
|
||||
if (ports.length == 0) return;
|
||||
|
||||
let view = new DataView(data);
|
||||
let decoder = new TextDecoder("utf-8");
|
||||
let decodedString = decoder.decode(view);
|
||||
ports.forEach(port => port.postMessage(<Message>{
|
||||
type: "serial",
|
||||
data: decodedString,
|
||||
id: id,
|
||||
}));
|
||||
}
|
||||
|
||||
function findNewDevices() {
|
||||
chrome.serial.getDevices(function (serialPorts) {
|
||||
serialPorts.forEach(function (serialPort) {
|
||||
if (byPath(serialPort.path).length == 0 &&
|
||||
serialPort.displayName == "mbed Serial Port") {
|
||||
chrome.serial.connect(serialPort.path, { bitrate: 115200 }, function (info) {
|
||||
// In case the [connect] operation takes more than five seconds...
|
||||
if (info && byPath(serialPort.path).length == 0)
|
||||
connections.push({
|
||||
id: info.connectionId,
|
||||
path: serialPort.path
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
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)) {
|
||||
ports.push(port);
|
||||
port.onDisconnect.addListener(function () {
|
||||
ports = ports.filter(function (x) { return x != port });
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// When receiving data for one of the connections that we're tracking, forward
|
||||
// it to all connected clients.
|
||||
chrome.serial.onReceive.addListener(function (info) {
|
||||
if (byId(info.connectionId).length > 0)
|
||||
onReceive(info.data, info.connectionId);
|
||||
});
|
||||
|
||||
// When it looks like we've been disconnected, drop the corresponding
|
||||
// connection object from the [connections] global variable.
|
||||
chrome.serial.onReceiveError.addListener(function (info) {
|
||||
if (info.error == "system_error" || info.error == "disconnected" || info.error == "device_lost")
|
||||
connections = connections.filter((x) => x.id != info.connectionId);
|
||||
});
|
||||
|
||||
// Probe serial connections at regular intervals. In case we find an mbed port
|
||||
// we haven't yet connected to, connect to it.
|
||||
setInterval(findNewDevices, 5000);
|
||||
findNewDevices();
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", main);
|
BIN
clients/chrome/logo128.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
clients/chrome/logo48.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
30
clients/chrome/manifest.json
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"app": {
|
||||
"background": {
|
||||
"scripts": [ "background.js" ]
|
||||
}
|
||||
},
|
||||
|
||||
"manifest_version": 2,
|
||||
"name": "code the micro:bit",
|
||||
"version": "0.6.0",
|
||||
"author": "Microsoft Corporation",
|
||||
"short_name": "code the micro:bit",
|
||||
|
||||
"description": "Extension for https://codethemicrobit.com.",
|
||||
"homepage_url": "https://codethemicrobit.com",
|
||||
"offline_enabled": "true",
|
||||
"icons": {
|
||||
"48": "logo48.png",
|
||||
"128": "logo128.png"
|
||||
},
|
||||
|
||||
"permissions": [
|
||||
"serial",
|
||||
"usb"
|
||||
],
|
||||
|
||||
"externally_connectable": {
|
||||
"matches": [ "*://localhost/*", "https://codethemicrobit.com/*", "https://*.codethemicrobit.com/*" ]
|
||||
}
|
||||
}
|
BIN
clients/chrome/screenshot.png
Normal file
After Width: | Height: | Size: 138 KiB |
7
clients/chrome/tsconfig.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"compiler-options": {
|
||||
"target": "ES5",
|
||||
"module": "amd",
|
||||
"sourceMap": false
|
||||
}
|
||||
}
|
@ -20,22 +20,18 @@
|
||||
<ProjectConfiguration Include="Release|AnyCPU">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>AnyCPU</Platform>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|ARM">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>ARM</Platform>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x86">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x86</Platform>
|
||||
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
48
clients/win10/app/codethemicrobitapp.sln
Normal file
@ -0,0 +1,48 @@
|
||||
|
||||
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 After Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 7.4 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
@ -1,9 +1,9 @@
|
||||
<?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.4.0" Publisher="CN=jhalleux" />
|
||||
<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>codemicrobitapp</DisplayName>
|
||||
<DisplayName>codethemicrobit</DisplayName>
|
||||
<PublisherDisplayName>Microsoft</PublisherDisplayName>
|
||||
<Logo>images\storelogo.png</Logo>
|
||||
</Properties>
|
||||
@ -14,12 +14,14 @@
|
||||
<Resource Language="x-generate" />
|
||||
</Resources>
|
||||
<Applications>
|
||||
<Application Id="App" StartPage="https://m.pxt.io/">
|
||||
<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="m.pxt.io" Description="Code editors for the BBC micro:bit" BackgroundColor="white" Square150x150Logo="images\Square150x150Logo.png" Square44x44Logo="images\Square44x44Logo.png">
|
||||
<uap:DefaultTile Wide310x150Logo="images\Wide310x150Logo.png" ShortName="m.pxt.io">
|
||||
<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>
|
||||
@ -27,7 +29,6 @@
|
||||
<uap:Extension Category="windows.fileTypeAssociation">
|
||||
<uap:FileTypeAssociation Name="microbithex">
|
||||
<uap:DisplayName>BBC micro:bit binary file</uap:DisplayName>
|
||||
<uap:InfoTip>.hex file created with m.pxt.io or microbit.co.uk</uap:InfoTip>
|
||||
<uap:SupportedFileTypes>
|
||||
<uap:FileType ContentType="application/x-microbit-hex">.hex</uap:FileType>
|
||||
</uap:SupportedFileTypes>
|
BIN
clients/win10/store/desktopblocks1366x768.png
Normal file
After Width: | Height: | Size: 172 KiB |
BIN
clients/win10/store/desktopjavascript1366x768.png
Normal file
After Width: | Height: | Size: 121 KiB |
BIN
clients/win10/store/mobileblocks480x800.png
Normal file
After Width: | Height: | Size: 54 KiB |
66
clients/winuploader/CodeTheMicroBit.sln
Normal file
@ -0,0 +1,66 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25123.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeTheMicrobit", "Microbit.Uploader\CodeTheMicrobit.csproj", "{7DC6CA45-FD75-44BC-805E-708C812CD4BF}"
|
||||
EndProject
|
||||
Project("{262852C6-CD72-467D-83FE-5EEB1973A190}") = "codethemicrobitapp", "..\win10\app\codethemicrobitapp.jsproj", "{39122940-AB16-4CD4-A0CE-79A3EB863ECF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
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
|
||||
{7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
{7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Debug|ARM.Build.0 = Debug|Any CPU
|
||||
{7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Release|ARM.Build.0 = Release|Any CPU
|
||||
{7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Release|x64.Build.0 = Release|Any CPU
|
||||
{7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{7DC6CA45-FD75-44BC-805E-708C812CD4BF}.Release|x86.Build.0 = Release|Any CPU
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|ARM.Deploy.0 = Debug|ARM
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|x64.Build.0 = Debug|x64
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|x64.Deploy.0 = Debug|x64
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|x86.Build.0 = Debug|x86
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Debug|x86.Deploy.0 = Debug|x86
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|ARM.Build.0 = Release|ARM
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|ARM.Deploy.0 = Release|ARM
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|x64.ActiveCfg = Release|x64
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|x64.Build.0 = Release|x64
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|x64.Deploy.0 = Release|x64
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|x86.ActiveCfg = Release|x86
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|x86.Build.0 = Release|x86
|
||||
{39122940-AB16-4CD4-A0CE-79A3EB863ECF}.Release|x86.Deploy.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
7
clients/winuploader/Microbit.Uploader/App.config
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0"/>
|
||||
<supportedRuntime version="v2.0.50727"/>
|
||||
</startup>
|
||||
</configuration>
|
123
clients/winuploader/Microbit.Uploader/CodeTheMicrobit.csproj
Normal file
@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{7DC6CA45-FD75-44BC-805E-708C812CD4BF}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Microsoft.MicroBit</RootNamespace>
|
||||
<AssemblyName>CodeTheMicrobit</AssemblyName>
|
||||
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>
|
||||
</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<DelaySign>false</DelaySign>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Settings.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Settings.Designer.cs">
|
||||
<DependentUpon>Settings.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GlobalSuppressions.cs" />
|
||||
<Compile Include="KnownFolders.cs" />
|
||||
<Compile Include="LicenseDialog.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="LicenseDialog.Designer.cs">
|
||||
<DependentUpon>LicenseDialog.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainForm.Designer.cs">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SingleInstanceAppHelper.cs" />
|
||||
<Compile Include="SingleInstanceAppStarter.cs" />
|
||||
<EmbeddedResource Include="LicenseDialog.resx">
|
||||
<DependentUpon>LicenseDialog.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MainForm.resx">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Settings.resx">
|
||||
<DependentUpon>Settings.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="MSFT_logo_png.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="Resources\MSR-LA - 2576.rtf" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="favicon.ico" />
|
||||
<EmbeddedResource Include="microbit.red.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
BIN
clients/winuploader/Microbit.Uploader/GlobalSuppressions.cs
Normal file
33
clients/winuploader/Microbit.Uploader/KnownFolders.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Management;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
namespace Microsoft.MicroBit
|
||||
{
|
||||
/// <summary>
|
||||
/// Class containing methods to retrieve specific file system paths.
|
||||
/// </summary>
|
||||
internal static class KnownFoldersNativeMethods
|
||||
{
|
||||
[SecurityCritical]
|
||||
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
|
||||
public static string GetDownloadPath()
|
||||
{
|
||||
IntPtr outPath;
|
||||
int result = SHGetKnownFolderPath(new Guid("{374DE290-123F-4565-9164-39C4925E467B}"), 0x00004000, new IntPtr(0), out outPath);
|
||||
if (result >= 0)
|
||||
return Marshal.PtrToStringUni(outPath);
|
||||
else return null;
|
||||
}
|
||||
|
||||
[SuppressMessage("Microsoft.Security", "CA5122:PInvokesShouldNotBeSafeCriticalFxCopRule")]
|
||||
[DllImport("Shell32.dll")]
|
||||
[SecurityCritical]
|
||||
private static extern int SHGetKnownFolderPath(
|
||||
[MarshalAs(UnmanagedType.LPStruct)]Guid rfid, uint dwFlags, IntPtr hToken,
|
||||
out IntPtr ppszPath);
|
||||
}
|
||||
|
||||
}
|
93
clients/winuploader/Microbit.Uploader/LicenseDialog.Designer.cs
generated
Normal file
@ -0,0 +1,93 @@
|
||||
namespace Microsoft.MicroBit
|
||||
{
|
||||
partial class LicenseDialog
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.textBox = new System.Windows.Forms.RichTextBox();
|
||||
this.acceptButton = new System.Windows.Forms.Button();
|
||||
this.exitButton = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// textBox
|
||||
//
|
||||
this.textBox.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.textBox.Location = new System.Drawing.Point(13, 13);
|
||||
this.textBox.Name = "textBox";
|
||||
this.textBox.ReadOnly = true;
|
||||
this.textBox.Size = new System.Drawing.Size(465, 438);
|
||||
this.textBox.TabIndex = 0;
|
||||
this.textBox.Text = "";
|
||||
//
|
||||
// acceptButton
|
||||
//
|
||||
this.acceptButton.Location = new System.Drawing.Point(322, 457);
|
||||
this.acceptButton.Name = "acceptButton";
|
||||
this.acceptButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.acceptButton.TabIndex = 1;
|
||||
this.acceptButton.Text = "Accept";
|
||||
this.acceptButton.UseVisualStyleBackColor = true;
|
||||
this.acceptButton.Click += new System.EventHandler(this.acceptButton_Click);
|
||||
//
|
||||
// exitButton
|
||||
//
|
||||
this.exitButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.exitButton.Location = new System.Drawing.Point(403, 457);
|
||||
this.exitButton.Name = "exitButton";
|
||||
this.exitButton.Size = new System.Drawing.Size(75, 23);
|
||||
this.exitButton.TabIndex = 2;
|
||||
this.exitButton.Text = "Exit";
|
||||
this.exitButton.UseVisualStyleBackColor = true;
|
||||
this.exitButton.Click += new System.EventHandler(this.exitButton_Click);
|
||||
//
|
||||
// LicenseDialog
|
||||
//
|
||||
this.AcceptButton = this.acceptButton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.exitButton;
|
||||
this.ClientSize = new System.Drawing.Size(490, 492);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.exitButton);
|
||||
this.Controls.Add(this.acceptButton);
|
||||
this.Controls.Add(this.textBox);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "LicenseDialog";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "code the micro:bit terms of use";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.RichTextBox textBox;
|
||||
private System.Windows.Forms.Button acceptButton;
|
||||
private System.Windows.Forms.Button exitButton;
|
||||
}
|
||||
}
|
32
clients/winuploader/Microbit.Uploader/LicenseDialog.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using Microsoft.MicroBit.Properties;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Microsoft.MicroBit
|
||||
{
|
||||
public partial class LicenseDialog : Form
|
||||
{
|
||||
public LicenseDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.textBox.Rtf = Resources.MSR_LA___2576;
|
||||
}
|
||||
|
||||
private void acceptButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.DialogResult = DialogResult.Yes;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void exitButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.DialogResult = DialogResult.No;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
120
clients/winuploader/Microbit.Uploader/LicenseDialog.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
BIN
clients/winuploader/Microbit.Uploader/MSFT_logo_png.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
173
clients/winuploader/Microbit.Uploader/MainForm.Designer.cs
generated
Normal file
@ -0,0 +1,173 @@
|
||||
namespace Microsoft.MicroBit
|
||||
{
|
||||
partial class MainForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||
this.statusLabel = new System.Windows.Forms.Label();
|
||||
this.backgroundPictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.trayIcon = new System.Windows.Forms.NotifyIcon(this.components);
|
||||
this.versionLabel = new System.Windows.Forms.LinkLabel();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.SettingsLabel = new System.Windows.Forms.LinkLabel();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.linkLabel1 = new System.Windows.Forms.LinkLabel();
|
||||
((System.ComponentModel.ISupportInitialize)(this.backgroundPictureBox)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// statusLabel
|
||||
//
|
||||
this.statusLabel.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.statusLabel.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.statusLabel.Location = new System.Drawing.Point(11, 30);
|
||||
this.statusLabel.Name = "statusLabel";
|
||||
this.statusLabel.Size = new System.Drawing.Size(364, 23);
|
||||
this.statusLabel.TabIndex = 1;
|
||||
this.statusLabel.Text = "loading...";
|
||||
//
|
||||
// backgroundPictureBox
|
||||
//
|
||||
this.backgroundPictureBox.BackColor = System.Drawing.Color.White;
|
||||
this.backgroundPictureBox.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.backgroundPictureBox.Image = global::Microsoft.MicroBit.Properties.Resources.MSFT_logo_png;
|
||||
this.backgroundPictureBox.InitialImage = null;
|
||||
this.backgroundPictureBox.Location = new System.Drawing.Point(226, 91);
|
||||
this.backgroundPictureBox.Name = "backgroundPictureBox";
|
||||
this.backgroundPictureBox.Size = new System.Drawing.Size(149, 52);
|
||||
this.backgroundPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||
this.backgroundPictureBox.TabIndex = 0;
|
||||
this.backgroundPictureBox.TabStop = false;
|
||||
this.backgroundPictureBox.Click += new System.EventHandler(this.backgroundPictureBox_Click);
|
||||
//
|
||||
// trayIcon
|
||||
//
|
||||
this.trayIcon.Icon = ((System.Drawing.Icon)(resources.GetObject("trayIcon.Icon")));
|
||||
this.trayIcon.Visible = true;
|
||||
this.trayIcon.Click += new System.EventHandler(this.trayIcon_Click);
|
||||
//
|
||||
// versionLabel
|
||||
//
|
||||
this.versionLabel.AutoSize = true;
|
||||
this.versionLabel.Location = new System.Drawing.Point(12, 121);
|
||||
this.versionLabel.Name = "versionLabel";
|
||||
this.versionLabel.Size = new System.Drawing.Size(28, 13);
|
||||
this.versionLabel.TabIndex = 2;
|
||||
this.versionLabel.TabStop = true;
|
||||
this.versionLabel.Text = "v0.9";
|
||||
this.versionLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.versionLabel_LinkClicked);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label1.Location = new System.Drawing.Point(12, 103);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(169, 15);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "Automatic upload of .hex files.";
|
||||
//
|
||||
// SettingsLabel
|
||||
//
|
||||
this.SettingsLabel.AutoSize = true;
|
||||
this.SettingsLabel.Location = new System.Drawing.Point(151, 121);
|
||||
this.SettingsLabel.Name = "SettingsLabel";
|
||||
this.SettingsLabel.Size = new System.Drawing.Size(43, 13);
|
||||
this.SettingsLabel.TabIndex = 4;
|
||||
this.SettingsLabel.TabStop = true;
|
||||
this.SettingsLabel.Text = "settings";
|
||||
this.SettingsLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.SettingsLabel_LinkClicked);
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
this.pictureBox1.BackColor = System.Drawing.Color.White;
|
||||
this.pictureBox1.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.pictureBox1.Image = global::Microsoft.MicroBit.Properties.Resources.microbit_red;
|
||||
this.pictureBox1.InitialImage = null;
|
||||
this.pictureBox1.Location = new System.Drawing.Point(226, 6);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(149, 79);
|
||||
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||
this.pictureBox1.TabIndex = 5;
|
||||
this.pictureBox1.TabStop = false;
|
||||
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
|
||||
//
|
||||
// linkLabel1
|
||||
//
|
||||
this.linkLabel1.AutoSize = true;
|
||||
this.linkLabel1.Location = new System.Drawing.Point(62, 121);
|
||||
this.linkLabel1.Name = "linkLabel1";
|
||||
this.linkLabel1.Size = new System.Drawing.Size(60, 13);
|
||||
this.linkLabel1.TabIndex = 6;
|
||||
this.linkLabel1.TabStop = true;
|
||||
this.linkLabel1.Text = "open editor";
|
||||
this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.ClientSize = new System.Drawing.Size(388, 143);
|
||||
this.Controls.Add(this.linkLabel1);
|
||||
this.Controls.Add(this.pictureBox1);
|
||||
this.Controls.Add(this.SettingsLabel);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.versionLabel);
|
||||
this.Controls.Add(this.statusLabel);
|
||||
this.Controls.Add(this.backgroundPictureBox);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "MainForm";
|
||||
this.ShowInTaskbar = false;
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "code the micro:bit";
|
||||
this.Load += new System.EventHandler(this.MainForm_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.backgroundPictureBox)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.PictureBox backgroundPictureBox;
|
||||
private System.Windows.Forms.Label statusLabel;
|
||||
private System.Windows.Forms.NotifyIcon trayIcon;
|
||||
private System.Windows.Forms.LinkLabel versionLabel;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.LinkLabel SettingsLabel;
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private System.Windows.Forms.LinkLabel linkLabel1;
|
||||
}
|
||||
}
|
||||
|
267
clients/winuploader/Microbit.Uploader/MainForm.cs
Normal file
@ -0,0 +1,267 @@
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Security;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Microsoft.MicroBit
|
||||
{
|
||||
internal partial class MainForm : Form
|
||||
{
|
||||
FileSystemWatcher watcher;
|
||||
private string customcopypath = "";
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
var v = typeof(MainForm).Assembly.GetName().Version;
|
||||
this.versionLabel.Text = "v" + v.Major + "." + v.Minor;
|
||||
}
|
||||
|
||||
private void MainForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.initializeFileWatch();
|
||||
customcopypath = (string)Application.UserAppDataRegistry.GetValue("CustomDirectory", "");
|
||||
this.openEditor();
|
||||
}
|
||||
|
||||
private void openEditor()
|
||||
{
|
||||
// lanch editor
|
||||
try { Process.Start("https://codethemicrobit.com"); } catch (Exception) { }
|
||||
}
|
||||
|
||||
private void initializeFileWatch()
|
||||
{
|
||||
if (!checkTOU()) return;
|
||||
|
||||
var downloads = KnownFoldersNativeMethods.GetDownloadPath();
|
||||
if (downloads == null)
|
||||
{
|
||||
this.updateStatus("oops, can't find the `Downloads` folder");
|
||||
return;
|
||||
}
|
||||
|
||||
this.watcher = new FileSystemWatcher(downloads);
|
||||
this.watcher.Renamed += (sender, e) => this.handleFileEvent(e);
|
||||
this.watcher.Created += (sender, e) => this.handleFileEvent(e);
|
||||
this.watcher.EnableRaisingEvents = true;
|
||||
|
||||
this.waitingForHexFileStatus();
|
||||
}
|
||||
|
||||
private void waitingForHexFileStatus()
|
||||
{
|
||||
this.updateStatus("waiting for .hex file...");
|
||||
this.trayIcon.ShowBalloonTip(3000, "ready...", "waiting for .hex file...", ToolTipIcon.None);
|
||||
}
|
||||
|
||||
static bool checkTOU()
|
||||
{
|
||||
var v = (int)Application.UserAppDataRegistry.GetValue("TermOfUse", 0);
|
||||
if (v != 1)
|
||||
{
|
||||
using (var f = new LicenseDialog())
|
||||
{
|
||||
var r = f.ShowDialog();
|
||||
if (r != DialogResult.Yes)
|
||||
{
|
||||
Application.Exit();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Application.UserAppDataRegistry.SetValue("TermOfUse", 1, RegistryValueKind.DWord);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
delegate void Callback();
|
||||
|
||||
private void updateStatus(string value)
|
||||
{
|
||||
Callback a = (Callback)(() =>
|
||||
{
|
||||
this.statusLabel.Text = value;
|
||||
this.trayIcon.Text = value;
|
||||
});
|
||||
this.Invoke(a);
|
||||
}
|
||||
|
||||
void handleFileEvent(FileSystemEventArgs e)
|
||||
{
|
||||
this.handleFile(e.FullPath);
|
||||
}
|
||||
|
||||
volatile int copying;
|
||||
void handleFile(string fullPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
// In case this is data-url download, at least Chrome will not rename file, but instead write to it
|
||||
// directly. This mean we may catch it in the act. Let's leave it some time to finish writing.
|
||||
Thread.Sleep(500);
|
||||
|
||||
var info = new System.IO.FileInfo(fullPath);
|
||||
Trace.WriteLine("download: " + info.FullName);
|
||||
|
||||
if (info.Extension != ".hex") return;
|
||||
|
||||
var infoName = info.Name;
|
||||
Trace.WriteLine("download name: " + info.Name);
|
||||
if (!infoName.StartsWith("microbit-", StringComparison.OrdinalIgnoreCase)) return;
|
||||
if (info.Name.EndsWith(".uploaded.hex", StringComparison.OrdinalIgnoreCase)) return;
|
||||
if (info.Length > 1000000) return; // make sure we don't try to copy large files
|
||||
|
||||
|
||||
// already copying?
|
||||
if (Interlocked.Exchange(ref this.copying, 1) == 1)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
var driveletters = getMicrobitDrives();
|
||||
List<String> drives = new List<String>();
|
||||
foreach (var d in driveletters)
|
||||
{
|
||||
drives.Add(d.RootDirectory.FullName);
|
||||
}
|
||||
if (!String.IsNullOrEmpty(customcopypath) && Directory.Exists(customcopypath))
|
||||
{
|
||||
drives.Add(customcopypath);
|
||||
}
|
||||
if (drives.Count == 0)
|
||||
{
|
||||
this.updateStatus("no board found");
|
||||
this.trayIcon.ShowBalloonTip(3000, "cancelled uploading...", "no board found", ToolTipIcon.None);
|
||||
return;
|
||||
}
|
||||
|
||||
this.updateStatus("uploading .hex file");
|
||||
this.trayIcon.ShowBalloonTip(3000, "uploading...", "uploading .hex file", ToolTipIcon.None);
|
||||
|
||||
// copy to all boards
|
||||
copyFirmware(info.FullName, drives);
|
||||
|
||||
// move away hex file
|
||||
var temp = System.IO.Path.ChangeExtension(info.FullName, ".uploaded.hex");
|
||||
try
|
||||
{
|
||||
File.Copy(info.FullName, temp, true);
|
||||
File.Delete(info.FullName);
|
||||
}
|
||||
catch (IOException) { }
|
||||
catch (NotSupportedException) { }
|
||||
catch (UnauthorizedAccessException) { }
|
||||
catch (ArgumentException) { }
|
||||
|
||||
// update ui
|
||||
this.updateStatus("uploading done");
|
||||
this.waitingForHexFileStatus();
|
||||
}
|
||||
finally
|
||||
{
|
||||
Interlocked.Exchange(ref this.copying, 0);
|
||||
}
|
||||
}
|
||||
catch (IOException) { }
|
||||
catch (NotSupportedException) { }
|
||||
catch (UnauthorizedAccessException) { }
|
||||
catch (ArgumentException) { }
|
||||
}
|
||||
|
||||
static void copyFirmware(string file, List<string> drives)
|
||||
{
|
||||
var waitHandles = new List<WaitHandle>();
|
||||
foreach (var drive in drives)
|
||||
{
|
||||
var ev = new AutoResetEvent(false);
|
||||
waitHandles.Add(ev);
|
||||
ThreadPool.QueueUserWorkItem((state) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var trg = System.IO.Path.Combine(drive, "firmware.hex");
|
||||
File.Copy(file, trg, true);
|
||||
}
|
||||
catch (IOException) { }
|
||||
catch (NotSupportedException) { }
|
||||
catch (UnauthorizedAccessException) { }
|
||||
catch (ArgumentException) { }
|
||||
ev.Set();
|
||||
}, ev);
|
||||
}
|
||||
|
||||
//waits for all the threads (waitHandles) to call the .Set() method
|
||||
//and inform that the execution has finished.
|
||||
WaitHandle.WaitAll(waitHandles.ToArray());
|
||||
}
|
||||
|
||||
static DriveInfo[] getMicrobitDrives()
|
||||
{
|
||||
var drives = System.IO.DriveInfo.GetDrives();
|
||||
var r = new System.Collections.Generic.List<DriveInfo>();
|
||||
foreach (var di in drives)
|
||||
{
|
||||
var label = getVolumeLabel(di);
|
||||
if (label.StartsWith("MICROBIT", StringComparison.Ordinal))
|
||||
r.Add(di);
|
||||
}
|
||||
return r.ToArray();
|
||||
}
|
||||
|
||||
static string getVolumeLabel(DriveInfo di)
|
||||
{
|
||||
try { return di.VolumeLabel; }
|
||||
catch (IOException) { }
|
||||
catch (SecurityException) { }
|
||||
catch (UnauthorizedAccessException) { }
|
||||
return "";
|
||||
}
|
||||
|
||||
private void trayIcon_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.WindowState = FormWindowState.Minimized;
|
||||
this.WindowState = FormWindowState.Normal;
|
||||
this.Show();
|
||||
this.Activate();
|
||||
}
|
||||
|
||||
private void versionLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
Process.Start("https://codethemicrobit.com/uploader");
|
||||
}
|
||||
catch (IOException) { }
|
||||
}
|
||||
|
||||
private void backgroundPictureBox_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.openEditor();
|
||||
}
|
||||
|
||||
private void SettingsLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
{
|
||||
var settings = new Settings(customcopypath);
|
||||
settings.ShowDialog();
|
||||
customcopypath = settings.CustomCopyPath;
|
||||
Application.UserAppDataRegistry.SetValue("CustomDirectory", customcopypath, RegistryValueKind.String);
|
||||
}
|
||||
|
||||
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
|
||||
{
|
||||
this.openEditor();
|
||||
}
|
||||
|
||||
private void pictureBox1_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.openEditor();
|
||||
}
|
||||
}
|
||||
}
|
172
clients/winuploader/Microbit.Uploader/MainForm.resx
Normal file
@ -0,0 +1,172 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="trayIcon.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="trayIcon.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAABAAEAEBAAAAAAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAMIOAADCDgAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAN6bIZTOkxoUtj62FL5W1hTWpzYUvlbWFLY+thTKgwoUxnb+FLY6shS6TsoUzpMaFL5a1hS2P
|
||||
rYUxnb6FNZ2+ZTCTsvkriaf/KYKe/yuIpf8uk7L/K4il/ymBnP8tjqz/K4qn/yiBnP8qhaL/KoWh/yqG
|
||||
o/8ogJv/JXeQ/yqDnvkRMjz/Di02/wofJv8MJS3/Di02/wskLP8HGB3/Di43/w0qM/8HFxz/CyMr/w4s
|
||||
Nv8MJi7/CiAm/w4sNv8RMTv/BQsN/wUQE/8BAgL/AQQF/wYRFP8EBgf/AgIA/xAYJv8TGy3/AgIA/wMF
|
||||
Bv8HEhX/AQUG/wECAv8FEBT/BQsN/wYFD/8LByT/AQAC/wAAAP8CAgL/AwMD/woKEv8LCxT/DAwY/woK
|
||||
Ev8DAwT/AgIC/wAAAP8AAAD/AAAA/wICAv8JCA//IBs//wwMEP8AAAD/AgIC/wQEBv8bGzf/BgYK/wQE
|
||||
Bf8bGzj/BgYJ/wMDA/8AAAD/CgoK/xEREf8HBwf/Li4u/1FRUf9ERET/AQEA/wwMGf8UFCj/BAQE/wMD
|
||||
Av8DAwL/BAQE/xAQIP8RESL/AAAA/z8/P/9SUlH/NTU1/y4uLv9QUFD/QUFB/wEBAP8LCxf/EhIk/wIC
|
||||
Af8JCRH/CwsV/wICAf8PDx3/Dw8f/wAAAP89PT3/UVFQ/zQ0M/8FBQX/DAwM/wgICP8AAAD/CwsW/xIS
|
||||
JP8FBQb/Dg4b/xERIv8FBQb/Dw8d/w8PHv8AAAD/CAgK/xwXO/8KCRT/BAMI/wAAAP8AAAD/AAAA/wIC
|
||||
Av8EBAX/HR06/wgIEP8GBgv/HR07/wYGCf8DAwL/AAAA/wAAAP8JBh3/BwUS/y0fhf8FBBD/AAAA/wAA
|
||||
AP8AAAD/AAAA/xIOMv8fFVz/HhVa/xQPOP8AAQD/AAAA/wAAAP8AAAD/AAAA/wICAv9UO/v/MiKX/wUD
|
||||
D/8FAw7/AwIK/wAAAP8RCzP/IBZi/yAWYP8TDTr/AAAA/wAAAP8AAAD/AAAA/wAAAP8CAgL/VTz/+FQ6
|
||||
/P8yI5j/IBZg/ywehf8MCCX/BAMN/wUEEP8GBBH/AQED/wAAAP8AAAD/AAAA/wAAAP8AAAD/AgIC9Vc+
|
||||
/2BVOv9+Ujj0fTwptH5ONul9OCapfRUOPn4AAAB+AAAAfQAAAH4AAAB+AAAAfQAAAH4AAAB+AAAAfgQE
|
||||
BFkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAA//8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAA//8AAA==
|
||||
</value>
|
||||
</data>
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAABAAEAEBAAAAAAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAMIOAADCDgAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAN6bIZTOkxoUtj62FL5W1hTWpzYUvlbWFLY+thTKgwoUxnb+FLY6shS6TsoUzpMaFL5a1hS2P
|
||||
rYUxnb6FNZ2+ZTCTsvkriaf/KYKe/yuIpf8uk7L/K4il/ymBnP8tjqz/K4qn/yiBnP8qhaL/KoWh/yqG
|
||||
o/8ogJv/JXeQ/yqDnvkRMjz/Di02/wofJv8MJS3/Di02/wskLP8HGB3/Di43/w0qM/8HFxz/CyMr/w4s
|
||||
Nv8MJi7/CiAm/w4sNv8RMTv/BQsN/wUQE/8BAgL/AQQF/wYRFP8EBgf/AgIA/xAYJv8TGy3/AgIA/wMF
|
||||
Bv8HEhX/AQUG/wECAv8FEBT/BQsN/wYFD/8LByT/AQAC/wAAAP8CAgL/AwMD/woKEv8LCxT/DAwY/woK
|
||||
Ev8DAwT/AgIC/wAAAP8AAAD/AAAA/wICAv8JCA//IBs//wwMEP8AAAD/AgIC/wQEBv8bGzf/BgYK/wQE
|
||||
Bf8bGzj/BgYJ/wMDA/8AAAD/CgoK/xEREf8HBwf/Li4u/1FRUf9ERET/AQEA/wwMGf8UFCj/BAQE/wMD
|
||||
Av8DAwL/BAQE/xAQIP8RESL/AAAA/z8/P/9SUlH/NTU1/y4uLv9QUFD/QUFB/wEBAP8LCxf/EhIk/wIC
|
||||
Af8JCRH/CwsV/wICAf8PDx3/Dw8f/wAAAP89PT3/UVFQ/zQ0M/8FBQX/DAwM/wgICP8AAAD/CwsW/xIS
|
||||
JP8FBQb/Dg4b/xERIv8FBQb/Dw8d/w8PHv8AAAD/CAgK/xwXO/8KCRT/BAMI/wAAAP8AAAD/AAAA/wIC
|
||||
Av8EBAX/HR06/wgIEP8GBgv/HR07/wYGCf8DAwL/AAAA/wAAAP8JBh3/BwUS/y0fhf8FBBD/AAAA/wAA
|
||||
AP8AAAD/AAAA/xIOMv8fFVz/HhVa/xQPOP8AAQD/AAAA/wAAAP8AAAD/AAAA/wICAv9UO/v/MiKX/wUD
|
||||
D/8FAw7/AwIK/wAAAP8RCzP/IBZi/yAWYP8TDTr/AAAA/wAAAP8AAAD/AAAA/wAAAP8CAgL/VTz/+FQ6
|
||||
/P8yI5j/IBZg/ywehf8MCCX/BAMN/wUEEP8GBBH/AQED/wAAAP8AAAD/AAAA/wAAAP8AAAD/AgIC9Vc+
|
||||
/2BVOv9+Ujj0fTwptH5ONul9OCapfRUOPn4AAAB+AAAAfQAAAH4AAAB+AAAAfQAAAH4AAAB+AAAAfgQE
|
||||
BFkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAA//8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAA//8AAA==
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
30
clients/winuploader/Microbit.Uploader/Program.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using Microsoft.VisualBasic.ApplicationServices;
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Microsoft.MicroBit
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
SingleInstanceAppStarter.Start(new MainForm(), StartNewInstance);
|
||||
}
|
||||
|
||||
// The handler when attempting to start another instance of this application
|
||||
// We can customize the logic here for which form to activate in different
|
||||
// conditions. Like in this sample, we will be selectively activate the LoginForm
|
||||
// or MainForm based on the login state of the user.
|
||||
static void StartNewInstance(object sender, StartupNextInstanceEventArgs e)
|
||||
{
|
||||
e.BringToForeground = true;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Code The micro:bit Uploader")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("MicrosoftMicrobitUploader")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2016")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("7dc6ca45-fd75-44bc-805e-708c812cd4bf")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("0.9.0.0")]
|
||||
[assembly: AssemblyFileVersion("0.9.0.0")]
|
||||
[assembly: CLSCompliant(true)]
|
||||
[assembly: NeutralResourcesLanguage("en-US")]
|
93
clients/winuploader/Microbit.Uploader/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,93 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Microsoft.MicroBit.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.MicroBit.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap microbit_red {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("microbit_red", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap MSFT_logo_png {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("MSFT_logo_png", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {\rtf1\adeflang1025\ansi\ansicpg1252\uc1\adeff0\deff0\stshfdbch0\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe1033\themelang1033\themelangfe0\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fbidi \fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}
|
||||
///{\f2\fbidi \fmodern\fcharset0\fprq1{\*\panose 02070309020205020404}Courier New;}{\f3\fbidi \froman\fcharset2\fprq2{\*\panose 05050102010706020507}Symbol;}{\f10\fbidi \fnil\fcharset2\fp [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string MSR_LA___2576 {
|
||||
get {
|
||||
return ResourceManager.GetString("MSR_LA___2576", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
130
clients/winuploader/Microbit.Uploader/Properties/Resources.resx
Normal file
@ -0,0 +1,130 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="MSR_LA___2576" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\MSR-LA - 2576.rtf;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="MSFT_logo_png" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\MSFT_logo_png.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="microbit_red" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\microbit.red.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
@ -0,0 +1 @@
|
||||
TBD
|
76
clients/winuploader/Microbit.Uploader/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,76 @@
|
||||
namespace Microsoft.MicroBit
|
||||
{
|
||||
partial class Settings
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(107, 12);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(100, 20);
|
||||
this.textBox1.TabIndex = 0;
|
||||
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(34, 15);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(67, 13);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "Custom Path";
|
||||
//
|
||||
// Settings
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(246, 48);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "Settings";
|
||||
this.ShowIcon = false;
|
||||
this.Text = "Settings";
|
||||
this.Load += new System.EventHandler(this.Settings_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
}
|
||||
}
|
37
clients/winuploader/Microbit.Uploader/Settings.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Security.AccessControl;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Microsoft.MicroBit
|
||||
{
|
||||
public partial class Settings : Form
|
||||
{
|
||||
public string CustomCopyPath;
|
||||
public Settings(string currentpath)
|
||||
{
|
||||
InitializeComponent();
|
||||
CustomCopyPath = currentpath;
|
||||
|
||||
}
|
||||
|
||||
private void Settings_Load(object sender, EventArgs e)
|
||||
{
|
||||
textBox1.Text = CustomCopyPath;
|
||||
}
|
||||
|
||||
private void label1_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void textBox1_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
CustomCopyPath = textBox1.Text;
|
||||
}
|
||||
}
|
||||
}
|
120
clients/winuploader/Microbit.Uploader/Settings.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -0,0 +1,39 @@
|
||||
/****************************** Module Header ******************************\
|
||||
* Module Name: SingleInstanceAppHelper.cs
|
||||
* Project: CSWinFormSingleInstanceApp
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* The sample demonstrates how to achieve the goal that only
|
||||
* one instance of the application is allowed in Windows Forms application..
|
||||
*
|
||||
* This source is subject to the Microsoft Public License.
|
||||
* See http://www.microsoft.com/en-us/openness/resources/licenses.aspx#MPL.
|
||||
* All other rights reserved.
|
||||
*
|
||||
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
|
||||
* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
\***************************************************************************/
|
||||
|
||||
using System;
|
||||
using Microsoft.VisualBasic.ApplicationServices;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Microsoft.MicroBit
|
||||
{
|
||||
// We need to add Microsoft.VisualBasic reference to use
|
||||
// WindowsFormsApplicationBase type.
|
||||
class SingleInstanceApp : WindowsFormsApplicationBase
|
||||
{
|
||||
public SingleInstanceApp()
|
||||
{
|
||||
}
|
||||
public SingleInstanceApp(Form f)
|
||||
{
|
||||
// Set IsSingleInstance property to true to make the application
|
||||
base.IsSingleInstance = true;
|
||||
// Set MainForm of the application.
|
||||
this.MainForm = f;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/****************************** Module Header ******************************\
|
||||
* Module Name: SingleInstanceAppStarter.cs
|
||||
* Project: CSWinFormSingleInstanceApp
|
||||
* Copyright (c) Microsoft Corporation.
|
||||
*
|
||||
* The sample demonstrates how to achieve the goal that only
|
||||
* one instance of the application is allowed in Windows Forms application..
|
||||
*
|
||||
* This source is subject to the Microsoft Public License.
|
||||
* See http://www.microsoft.com/en-us/openness/resources/licenses.aspx#MPL.
|
||||
* All other rights reserved.
|
||||
*
|
||||
* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
|
||||
* EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
\***************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Microsoft.VisualBasic.ApplicationServices;
|
||||
|
||||
namespace Microsoft.MicroBit
|
||||
{
|
||||
internal static class SingleInstanceAppStarter
|
||||
{
|
||||
static SingleInstanceApp app = null;
|
||||
|
||||
// Construct SingleInstanceApp object, and invoke its run method.
|
||||
public static void Start(Form f, StartupNextInstanceEventHandler handler)
|
||||
{
|
||||
if (app == null && f != null)
|
||||
app = new SingleInstanceApp(f);
|
||||
|
||||
// Wire up StartupNextInstance event handler.
|
||||
app.StartupNextInstance += handler;
|
||||
app.Run(Environment.GetCommandLineArgs());
|
||||
}
|
||||
}
|
||||
}
|
BIN
clients/winuploader/Microbit.Uploader/favicon.ico
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
clients/winuploader/Microbit.Uploader/microbit.red.png
Normal file
After Width: | Height: | Size: 21 KiB |
10
cmds/cmds.ts
@ -6,6 +6,8 @@ import * as child_process from "child_process";
|
||||
|
||||
let writeFileAsync: any = Promise.promisify(fs.writeFile)
|
||||
let execAsync: (cmd: string, options?: { cwd?: string }) => Promise<Buffer> = Promise.promisify(child_process.exec)
|
||||
let readDirAsync = Promise.promisify(fs.readdir)
|
||||
|
||||
|
||||
export function deployCoreAsync(res: ts.pxt.CompileResult) {
|
||||
return getBitDrivesAsync()
|
||||
@ -26,17 +28,23 @@ export function deployCoreAsync(res: ts.pxt.CompileResult) {
|
||||
|
||||
function getBitDrivesAsync(): Promise<string[]> {
|
||||
if (process.platform == "win32") {
|
||||
let rx = new RegExp("^([A-Z]:).* " + pxt.appTarget.compile.deployDrives)
|
||||
return execAsync("wmic PATH Win32_LogicalDisk get DeviceID, VolumeName, FileSystem")
|
||||
.then(buf => {
|
||||
let res: string[] = []
|
||||
buf.toString("utf8").split(/\n/).forEach(ln => {
|
||||
let m = /^([A-Z]:).* MICROBIT/.exec(ln)
|
||||
let m = rx.exec(ln)
|
||||
if (m) {
|
||||
res.push(m[1] + "/")
|
||||
}
|
||||
})
|
||||
return res
|
||||
})
|
||||
}
|
||||
else if (process.platform == "darwin") {
|
||||
let rx = new RegExp(pxt.appTarget.compile.deployDrives)
|
||||
return readDirAsync("/Volumes")
|
||||
.then(lst => lst.filter(s => rx.test(s)).map(s => "/Volumes/" + s + "/"))
|
||||
} else {
|
||||
return Promise.resolve([])
|
||||
}
|
||||
|
@ -8,6 +8,6 @@
|
||||
"module": "commonjs",
|
||||
"rootDir": ".",
|
||||
"newLine": "LF",
|
||||
"sourceMap": true
|
||||
"sourceMap": false
|
||||
}
|
||||
}
|
||||
|
@ -29,30 +29,40 @@ The BBC micro:bit was made possible by many [partners](https://www.microbit.co.u
|
||||
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.
|
||||
|
||||
## Blocks or JavaScript
|
||||
## Hardware: The Device
|
||||
|
||||
The student can program the BBC micro:bit using [visual blocks](http://www.github.com/Google/blockly) or JavaScript.
|
||||
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
|
||||
basic.showString("BBC micro:bit!");
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
basic.showString("Hi!");
|
||||
})
|
||||
```
|
||||
|
||||
## Compile and Flash
|
||||
## Compile and Flash: Your Program!
|
||||
|
||||
When a user has her code ready, she can connect her BBC micro:bit to a computer via a USB cable, so it appears as a mounted drive.
|
||||
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 the ARM thumb machine code happens in the browser.
|
||||
|
||||
The student is prompted to save the ARM binary program to a file, which she then simply drags to the micro:bit mounted drive,
|
||||
which flashes the micro:bit device with the new program.
|
||||
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
|
||||
Before a student compiles her code for the micro:bit, she can run it using the micro:bit simulator, all within the confines of a web browser.
|
||||
|
||||
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++ BBC 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,
|
||||
The [C++ micro:bit runtime](http://lancaster-university.github.io/microbit-docs/), created at [Lancaster University](http://www.lancaster.ac.uk/), provides access to the hardware functions of the micro:bit,
|
||||
as well as a set of helper functions (such as displaying a number/image/string on the LED screen).
|
||||
The JavaScript micro:bit library mirrors the functions of the C++ library.
|
||||
|
||||
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
|
||||
|
||||
The code for the micro:bit is [open source](/open-source) on GitHub. Contributors are welcome!
|
||||
|
8
docs/blocks.md
Normal file
@ -0,0 +1,8 @@
|
||||
# Blocks language
|
||||
|
||||
```namespaces
|
||||
for (let i = 0;i<5;++i) {}
|
||||
if (true){}
|
||||
let x = 0;
|
||||
Math.random(5);
|
||||
```
|
@ -2,8 +2,6 @@
|
||||
|
||||
true or false.
|
||||
|
||||
### @parent blocks/language
|
||||
|
||||
A Boolean has one of two possible values: `true`; `false`. Boolean (logical) operators (*and*, *or*, *not*) take Boolean inputs and yields a Boolean value. Comparison operators on other types ([numbers](/reference/types/number), [strings](/reference/types/string) yields a Boolean value.
|
||||
|
||||
The following blocks represent the true and false Boolean values, which can be plugged in anywhere a Boolean value is expected:
|
||||
@ -32,7 +30,7 @@ The next six blocks represent comparison operators that yield a Boolean value. M
|
||||
42 >= 0;
|
||||
```
|
||||
|
||||
Boolean values and operators are often used with an [if](/reference/logic/if) or [while](/reference/loops/while) statement to determine which code will execute next. For example:
|
||||
Boolean values and operators are often used with an [if](/blocks/logic/if) or [while](/blocks/loops/while) statement to determine which code will execute next. For example:
|
||||
|
||||
### Functions that return a Boolean
|
||||
|
||||
@ -88,7 +86,7 @@ if (led.point(1,1) && led.point(2,2)) {
|
||||
When you compare two Numbers, you get a Boolean value, such as the comparison `x < 5` in the code below:
|
||||
|
||||
```blocks
|
||||
let x = math.random(5)
|
||||
let x = Math.random(5)
|
||||
if(x < 5) {
|
||||
basic.showString("low");
|
||||
} else {
|
||||
@ -98,11 +96,7 @@ if(x < 5) {
|
||||
|
||||
See the documentation on [Numbers](/reference/types/number) for more information on comparing two Numbers. You can also [compare strings](/reference/types/string-functions) using the `equals` function.
|
||||
|
||||
### Lessons
|
||||
|
||||
[rotation animation](/lessons/rotation-animation), [love meter](/lessons/love-meter), [zoomer](/lessons/zoomer)
|
||||
|
||||
### See also
|
||||
|
||||
[if](/reference/logic/if), [while](/reference/loops/while), [number](/reference/types/number)
|
||||
[if](/blocks/logic/if), [while](/blocks/loops/while), [number](/reference/types/number)
|
||||
|
28
docs/blocks/logic/if.md
Normal file
@ -0,0 +1,28 @@
|
||||
# If
|
||||
|
||||
### @parent blocks/language
|
||||
|
||||
|
||||
Conditionally run code depending on whether a [Boolean](/blocks/logic/boolean) condition is true or false.
|
||||
|
||||
```blocks
|
||||
if(true) {
|
||||
}
|
||||
```
|
||||
|
||||
Click on the dark blue gear icon (see above) to add an *else* or *if* to the current block.
|
||||
|
||||
### Example: adjusting screen brightness
|
||||
|
||||
```blocks
|
||||
if(input.lightLevel()<100){
|
||||
led.setBrightness(255);
|
||||
}
|
||||
```
|
||||
|
||||
If the [light level](/reference/input/light-level) is `< 100`, this code sets the brightness to `255`:
|
||||
|
||||
### See also
|
||||
|
||||
[while loop](/blocks/loops/while), [for](/blocks/loops/for), [boolean](/blocks/logic/boolean)
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
```cards
|
||||
for(let i = 0;i<5;i++) {}
|
||||
for(let i = 1;i<5;i++) {}
|
||||
while(true) {}
|
||||
basic.forever(() => {})
|
||||
basic.forever(() => {});
|
||||
```
|
@ -14,11 +14,7 @@ basic.showNumber(i)
|
||||
}
|
||||
```
|
||||
|
||||
### Lessons
|
||||
|
||||
[looper](/lessons/looper)
|
||||
|
||||
### See also
|
||||
|
||||
[repeat](/reference/loops/repeat), [while](/reference/loops/while), [if](/reference/logic/if), [show number](/reference/basic/show-number)
|
||||
[repeat](/blocks/loops/repeat), [while](/blocks/loops/while), [if](/blocks/logic/if), [show number](/reference/basic/show-number)
|
||||
|
12
docs/blocks/loops/repeat.md
Normal file
@ -0,0 +1,12 @@
|
||||
# Repeat
|
||||
|
||||
Run part of the program the number of times you say.
|
||||
|
||||
### Block Editor
|
||||
|
||||

|
||||
|
||||
### See also
|
||||
|
||||
[for](/blocks/loops/for), [while](/blocks/loops/while), [if](/blocks/logic/if), [show number](/reference/basic/show-number)
|
||||
|
@ -1,16 +1,13 @@
|
||||
# While
|
||||
|
||||
### @parent blocks/language
|
||||
|
||||
|
||||
Repeat code while a [Boolean](/reference/types/boolean) `condition` is true.
|
||||
Repeat code while a [Boolean](/blocks/logic/boolean) `condition` is true.
|
||||
|
||||
```blocks
|
||||
while(true) {
|
||||
}
|
||||
```
|
||||
|
||||
The while loop has a *condition* that evaluates to a [Boolean](/reference/types/boolean) value. After the `do` keyword, add the code that you want to run while the `condition` is `true`. The while loop concludes with `end while`.
|
||||
The while loop has a *condition* that evaluates to a [Boolean](/blocks/logic/boolean) value. After the `do` keyword, add the code that you want to run while the `condition` is `true`. The while loop concludes with `end while`.
|
||||
|
||||
The condition is tested before any code runs. Which means that if the condition is false, the code inside the loop doesn't execute.
|
||||
|
||||
@ -26,11 +23,7 @@ while(index >= 0) {
|
||||
}
|
||||
```
|
||||
|
||||
### Lessons
|
||||
|
||||
[rotation animation](/lessons/rotation-animation)
|
||||
|
||||
### See also
|
||||
|
||||
[on button pressed](/reference/input/on-button-pressed), [for](/reference/loops/for), [if](/reference/logic/if), [forever](/reference/basic/forever)
|
||||
[on button pressed](/reference/input/on-button-pressed), [for](/blocks/loops/for), [if](/blocks/logic/if), [forever](/reference/basic/forever)
|
||||
|
@ -1,15 +1,9 @@
|
||||
# Math Library
|
||||
|
||||
Functions in the math library.
|
||||
# Math functions
|
||||
|
||||
### @parent blocks/language
|
||||
|
||||
The math library includes math related functions that you can use with [Numbers](/reference/types/number).
|
||||
|
||||
* In the [Block editor](/blocks/editor), click **maths** on the left to see the available blocks
|
||||
|
||||
The functions available in Block Editor are:
|
||||
|
||||
### abs
|
||||
|
||||
math `->` abs (x : [Number](/reference/types/number)) *returns* [Number](/reference/types/number)
|
||||
@ -42,11 +36,7 @@ returns a random [Number](/reference/types/number) between 0 and the parameter *
|
||||
|
||||

|
||||
|
||||
### Lessons
|
||||
|
||||
[love meter](/lessons/love-meter)
|
||||
|
||||
### See also
|
||||
|
||||
[Block Editor documentation](/blocks/contents), [Number](/reference/types/number)
|
||||
[Number](/reference/types/number)
|
||||
|
21
docs/blocks/variables.md
Normal file
@ -0,0 +1,21 @@
|
||||
# Variables
|
||||
|
||||
[Assign](/blocks/variables/assign) (set) a variable's value
|
||||
|
||||
```blocks
|
||||
let x = 0;
|
||||
```
|
||||
|
||||
Get a variable's value
|
||||
|
||||
```blocks
|
||||
let x = 0;
|
||||
x;
|
||||
```
|
||||
|
||||
[Change](/blocks/variables/change-var) a variable's value
|
||||
|
||||
```blocks
|
||||
let x = 0;
|
||||
x+=1;
|
||||
```
|
36
docs/blocks/variables/assign.md
Normal file
@ -0,0 +1,36 @@
|
||||
# Assignment Operator
|
||||
|
||||
Use an equals sign to make a [variable](/blocks/variables/var) store the [number](/reference/types/number)
|
||||
or [string](/reference/types/string) you say.
|
||||
|
||||
When you use the equals sign to store something in a variable, the equals sign is called
|
||||
an *assignment operator*, and what you store is called a *value*.
|
||||
|
||||
### Storing numbers in variables
|
||||
|
||||
This program makes the variable `item` equal `5` and then shows it on the [LED screen](/device/screen).
|
||||
|
||||
````blocks
|
||||
let item = 5
|
||||
basic.showNumber(item)
|
||||
````
|
||||
|
||||
### Storing strings in variables
|
||||
|
||||
This program makes the variable `name` equal `Joe` and then shows it on the [LED screen](/device/screen).
|
||||
|
||||
````blocks
|
||||
let name = "Joe"
|
||||
basic.showString(name);
|
||||
````
|
||||
|
||||
### Notes
|
||||
|
||||
You can use the assignment operator with variables of
|
||||
every [type](/reference/types). A *type* is which kind of thing
|
||||
a variable can store, like a number or string.
|
||||
|
||||
### See also
|
||||
|
||||
[variable](/blocks/variables/var), [types](/reference/types)
|
||||
|
40
docs/blocks/variables/change-var.md
Normal file
@ -0,0 +1,40 @@
|
||||
# Change Value
|
||||
|
||||
Set the value for local and global variables.
|
||||
|
||||
### @parent blocks/change-value
|
||||
|
||||
Change the value of a variable
|
||||
|
||||
```blocks
|
||||
let x = 0
|
||||
x += 1
|
||||
```
|
||||
|
||||
### Declare a variable
|
||||
|
||||
Use the assignment operator to set the value of a [variable](/blocks/variables/var). Change the value of a variable from 0 to 1 using the change item block. Like this:
|
||||
|
||||
```blocks
|
||||
let x = 0
|
||||
x += 1
|
||||
```
|
||||
|
||||
### Example
|
||||
|
||||
Use the assignment operator to set the value of a [variable](/blocks/variables/var). Change the value of a variable from 0 to 1 using the change item block. Then display the new value of the variable on the LED screen. Like this:
|
||||
|
||||
```blocks
|
||||
let x = 0;
|
||||
x += 1;
|
||||
basic.showNumber(x);
|
||||
```
|
||||
|
||||
### Notes
|
||||
|
||||
* You can use the assignment operator with variables of each of the supported [types](/reference/types).
|
||||
|
||||
### See also
|
||||
|
||||
[variable](/blocks/variables/var), [types](/reference/types)
|
||||
|
@ -13,7 +13,7 @@ A variable is a place where you can store and retrieve data. Variables have a na
|
||||
### Var statement
|
||||
|
||||
Use the Block Editor variable statement to create a variable
|
||||
and the [assignment operator](/reference/variables/assign)
|
||||
and the [assignment operator](/blocks/variables/assign)
|
||||
to store something in the variable.
|
||||
|
||||
For example, this code stores the number `2` in the `x` variable:
|
||||
@ -27,7 +27,7 @@ Here's how to define a variable in the Block Editor:
|
||||
|
||||
2. Change the default variable name if you like.
|
||||
|
||||
3. Drag a block type on the right-side of the [assignment operator](/reference/variables/assign) and click the down arrow to change the variable name.
|
||||
3. Drag a block type on the right-side of the [assignment operator](/blocks/variables/assign) and click the down arrow to change the variable name.
|
||||
|
||||
A variable is created for the number returned by the [brightness](/reference/led/brightness) function.
|
||||
|
||||
@ -81,11 +81,7 @@ if (led.brightness() > 128) {
|
||||
|
||||
* You can use the default variable names if you'd like, however, it's best to use descriptive variable names. To change a variable name in the editor, select the down arrow next to the variable and then click "new variable".
|
||||
|
||||
### Lessons
|
||||
|
||||
[glowing pendulum](/lessons/glowing-pendulum), [love meter](/lessons/love-meter), [temperature](/lessons/temperature), [zoomer](/lessons/zoomer)
|
||||
|
||||
### See also
|
||||
|
||||
[types](/reference/types), [assignment operator](/reference/variables/assign)
|
||||
[types](/reference/types), [assignment operator](/blocks/variables/assign)
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Device
|
||||
|
||||
All the bits and pieces that make up your BBC micro:bit
|
||||
All the bits and pieces that make up the BBC micro:bit
|
||||
|
||||

|
||||
|
||||
@ -15,19 +15,21 @@ It flashes yellow when the system wants to tell the user that something has happ
|
||||
### Buttons
|
||||
|
||||
Buttons A and B are a form of input. When you press a button, it completes an electrical circuit.
|
||||
The micro:bit can detect either of its two buttons being pressed and un-pressed and be programmed
|
||||
to act on that or send the information to another device.
|
||||
The micro:bit can detect either of its two buttons being pressed/released and be programmed
|
||||
to act on these events.
|
||||
|
||||
Button R on the back of the micro:bit is a system button. It has different uses.
|
||||
When you have downloaded and run your code onto your micro:bit, press Button R to restart and run your program from the beginning.
|
||||
|
||||
When you plug in your micro:bit, it should appear as MICROBIT.
|
||||
### USB connection
|
||||
|
||||
When you plug in your micro:bit, it should appear as ``MICROBIT``.
|
||||
If you accidentally hold down the reset button as you’re plugging in your micro:bit,
|
||||
the micro:bit will appear as a MAINTENANCE drive instead of MICROBIT. This is known as maintenance mode.**
|
||||
the micro:bit will appear as a MAINTENANCE drive instead of ``MICROBIT``. This is known as maintenance mode.**
|
||||
|
||||
To continue programming your micro:bit YOU MUST unplug your USB and reconnect it. Check that the drive now shows as MICROBIT.
|
||||
To continue programming your micro:bit YOU MUST unplug your USB and reconnect it. Check that the drive now shows as ``MICROBIT``.
|
||||
|
||||
**Use with caution. If you click on the drive while it shows as MAINTENANCE,
|
||||
**Use with caution. If you click on the drive while it shows as ``MAINTENANCE``,
|
||||
you can see which version of firmware you have running on your micro:bit.
|
||||
Firmware on your micro:bit should be up-to-date already.
|
||||
You can find the version of firmware in the 'version.txt' file on the micro:bit. Further information on the firmware can be found here:
|
||||
@ -43,7 +45,7 @@ This data can be used by the micro:bit in a program or be sent to another device
|
||||
|
||||
### Accelerometer
|
||||
|
||||
There is a an accelerometer on your micro:bit which detects changes in the micro:bit’s speed.
|
||||
There is an accelerometer on your micro:bit which detects changes in the micro:bit’s speed.
|
||||
It converts analogue information into digital form that can be used in micro:bit programs.
|
||||
Output is in milli-g. The device will also detect a small number of standard actions e.g. shake, tilt and free-fall.
|
||||
|
||||
@ -53,6 +55,10 @@ The pins can be a form of input or output.
|
||||
There are labels for the input/output pins P0, P1, P2, which you can attach external sensors to such as thermometers or moisture detectors.
|
||||
You can read more about large and small pins [here](/device/pins).
|
||||
|
||||
### Light level
|
||||
|
||||
The screen can also be used a light level sensor (it's a really cool trick).
|
||||
|
||||
### How do I connect the micro:bit to my computer?
|
||||
|
||||
Your micro:bit can be connected to your computer via a micro USB cable.
|
||||
@ -63,7 +69,7 @@ and about the error messages you might get [here](/device/error-codes).
|
||||
|
||||
### Powering your micro:bit
|
||||
|
||||
When your micro:bit is connected to your computer with the micro USB, it doesn’t need another power source.
|
||||
When your micro:bit is connected to your computer with the micro USB, it doesn’t need another power source.
|
||||
When your micro:bit isn’t connected to your computer, tablet or mobile, you will need 2 x AAA 1.5 V batteries to power it.
|
||||
|
||||
The pins labelled 3V and GND are the power supply pins.
|
||||
@ -71,11 +77,11 @@ You can attach an external device such as a motor to these and power it using th
|
||||
|
||||
### Serial Communication
|
||||
|
||||
The BBC micro:bit can send an receive data via [serial communication](/device/serial). The serial data can be transfered via USB or BlE.
|
||||
The micro:bit can send an receive data via [serial communication](/device/serial). The serial data can be transfered via USB or BLE.
|
||||
|
||||
### Bluetooth Low Energy (BLE) Antenna
|
||||
|
||||
You will see the label BLE ANNTENA on the back of your micro:bit. It is for a messaging service,
|
||||
You will see the label BLE ANTENNA on the back of your micro:bit. It is for a messaging service,
|
||||
so that devices can talk to each other. The micro:bit is a peripheral
|
||||
device which can talk to a central device like a smart phone or tablet that has Bluetooth Low Energy (BLE).
|
||||
The micro:bit can send signals and receive signals from a central device so another BLE device can
|
||||
|
@ -1,7 +1,5 @@
|
||||
# micro:bit - the device
|
||||
|
||||
The micro:bit device #docs
|
||||
|
||||
The micro:bit is a very capable device with many components:
|
||||
|
||||
* [the USB connector](/device/usb)
|
||||
|
@ -11,12 +11,6 @@ This example displays a random number every time the crocodile clip holds `GND`
|
||||
|
||||
### Connecting Crocodile Clips
|
||||
|
||||
|
||||
|
||||
### Lessons
|
||||
|
||||
[love meter](/lessons/love-meter)
|
||||
|
||||
### See also
|
||||
|
||||
[micro:bit pins](/device/pins), [pin is pressed](/reference/input/pin-is-pressed), [analog read pin](/reference/pins/analog-read-pin), [analog write pin](/reference/pins/analog-write-pin), [digital read pin](/reference/pins/digital-read-pin), [digital write pin](/reference/pins/digital-write-pin)
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Error codes
|
||||
|
||||
The micro:bit error codes #docs
|
||||
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.
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
# The micro:bit - a reactive system
|
||||
|
||||
The micro:bit is a reactive system. #docs
|
||||
|
||||
### Computing systems
|
||||
|
||||
What sort of a *computing system* is the micro:bit?
|
||||
|
@ -3,40 +3,61 @@
|
||||
The micro:bit LED screen
|
||||
|
||||
```sim
|
||||
basic.showString(" ");
|
||||
basic.showLeds(`
|
||||
# . # . #
|
||||
. # . # .
|
||||
# . # . #
|
||||
. # . # .
|
||||
# . # . #
|
||||
`);
|
||||
```
|
||||
|
||||
The micro:bit LED screen consists of 25 red LED lights arranged in a 5X5 grid (5 LEDs across by 5 LEDs down).
|
||||
In the screen above, we created a checkerboard pattern using the LEDs.
|
||||
|
||||
### Which LED?
|
||||
|
||||
You use ``x , y`` coordinates to specify a particular LED in the grid; where ``x`` is the horizontal position and ``y`` is the vertical position (0, 1, 2, 3, 4). To figure out the ``x``, ``y`` coordinates, position your micro:bit horizontally, like a credit card (see picture above).
|
||||
You use `(x ,y)` coordinates to specify a particular LED in the grid;
|
||||
where `x` is the horizontal position (0,1,2,3,4) and `y` is the vertical position
|
||||
(0, 1, 2, 3, 4).
|
||||
|
||||
To figure out the ``x``, ``y`` coordinates, position your micro:bit horizontally, like a credit card (see picture above).
|
||||
|
||||
Here are the x, y coordinates for the LEDs in the 5X5 grid:
|
||||
|
||||
`0, 0` `1, 0` `2, 0` `3, 0` `4, 0`
|
||||
`(0,0)` `(1,0)` `(2,0)` `(3,0)` `(4,0)`
|
||||
|
||||
`0, 1` `1, 1` `2, 1` `3, 1` `4, 1`
|
||||
`(0,1)` `(1,1)` `(2,1)` `(3,1)` `(4,1)`
|
||||
|
||||
`0, 2` `1, 2` `2, 2` `3, 2` `4, 2`
|
||||
`(0,2)` `(1,2)` `(2,2)` `(3,2)` `(4,2)`
|
||||
|
||||
`0, 3` `1, 3` `2, 3` `3, 3` `4, 3`
|
||||
`(0,3)` `(1,3)` `(2,3)` `(3,3)` `(4,3)`
|
||||
|
||||
`0, 4` `1, 4` `2, 4` `3, 4` `4, 4`
|
||||
`(0,4)` `(1,4)` `(2,4)` `(3,4)` `(4,4)`
|
||||
|
||||
The x, y coordinates for the LED in the centre of the grid are `2, 2`. Starting from `0, 0` count over 2 columns and then down 2 rows.
|
||||
The x, y coordinates for the LED in the centre of the grid are `(2,2)`. Starting from `(0,0)` count over 2 columns and then down 2 rows.
|
||||
|
||||
### Check your understanding
|
||||
|
||||
Which LEDs are turned on in the checkboard pattern above?
|
||||
|
||||
### Row, column - 1
|
||||
|
||||
Since the row and column numbers start at 0, an easy way to figure out the x, y coordinates is to subtract 1 from the row and column number (when counting from 1). In other words, to specify the LED in the 4th column 5th row, subtract 1 from each number to get coordinates `3, 4`.
|
||||
Since the row and column numbers start at 0, an easy way to figure out the (x,y) coordinates
|
||||
is to subtract 1 from the row and column number (when counting from 1).
|
||||
In other words, to specify the LED in the 4th column 5th row, subtract 1 from each number to get coordinates `(3,4)`.
|
||||
|
||||
### Turn a LED on/off
|
||||
|
||||
Use [plot](/reference/led/plot) and [unplot](/reference/led/unplot) to turn a LED on or off
|
||||
|
||||
```blocks
|
||||
led.plot(0,0)
|
||||
led.unplot(0,0)
|
||||
led.plot(0,0);
|
||||
led.plot(1,1);
|
||||
basic.pause(1000);
|
||||
led.unplot(0,0);
|
||||
basic.pause(1000);
|
||||
led.unplot(1,1);
|
||||
```
|
||||
|
||||
### Is a LED on/off?
|
||||
|
@ -11,16 +11,43 @@ input.onButtonPressed(Button.A, () => {
|
||||
})
|
||||
```
|
||||
|
||||
Data is also automatically streamed to serial by the ** bar graph** block
|
||||
and picked up by the editor. This data can be streamed to the cloud as well.
|
||||
|
||||
```blocks
|
||||
basic.forever(() => {
|
||||
led.plotBarGraph(input.acceleration(Dimension.X), 0);
|
||||
});
|
||||
```
|
||||
|
||||
## How to read the micro:bit's serial output from your computer
|
||||
|
||||
Unfortunately, using the serial library requires quite a bit of a setup.
|
||||
|
||||
### BBC micro:bit Chrome Extension
|
||||
|
||||
If you are using the Google Chrome browser, you can use our extension to get serial data streaming in the editor.
|
||||
|
||||
* Install the [Extension for BBC micro:bit](https://chrome.google.com/webstore/detail/extension-for-bbc-microbi/cihhkhnngbjlhahcfmhekmbnnjcjdbge?hl=en-US) on the Chrome Web Store.
|
||||
* Restart Chrome and open the [web editor](https://codethemicrobit.com)
|
||||
* The serial data will show below the simulator
|
||||
|
||||
### Windows
|
||||
|
||||
You must install a device driver (for the computer to recognize the serial interface of the micro:bit); then, you must also install a terminal emulator (which is going to connect to the micro:bit and read its output). Here's how to do it:
|
||||
You must install a device driver (for the computer to recognize the
|
||||
serial interface of the micro:bit); then, you must also install a
|
||||
terminal emulator (which is going to connect to the micro:bit and read
|
||||
its output).
|
||||
|
||||
* Follow instructions at https://developer.mbed.org/handbook/Windows-serial-configuration in order to install the device driver
|
||||
* Install a terminal emulator; we recommend [Tera Term](https://ttssh2.osdn.jp/index.html.en). At the time of this writing, the latest version is 4.88 and can be downloaded [from here](http://en.osdn.jp/frs/redir.php?m=jaist&f=%2Fttssh2%2F63767%2Fteraterm-4.88.exe). Follow the instructions from the installer.
|
||||
* Follow the instructions at
|
||||
https://developer.mbed.org/handbook/Windows-serial-configuration to
|
||||
install the device driver.
|
||||
|
||||
* Instructions for installing a terminal emulator are below.
|
||||
|
||||
#### Windows > Tera Term
|
||||
|
||||
* Install the terminal emulator [Tera Term](https://ttssh2.osdn.jp/index.html.en). At the time of this writing, the latest version is 4.88 and can be downloaded [from here](http://en.osdn.jp/frs/redir.php?m=jaist&f=%2Fttssh2%2F63767%2Fteraterm-4.88.exe). Follow the instructions from the installer.
|
||||
|
||||
Once both the driver and the terminal emulator are installed, plug in the micro:bit and wait until the device is fully setup. Then, open TeraTerm.
|
||||
|
||||
@ -32,7 +59,7 @@ You should be good. Feel free to hit `Setup` > `Save Setup` in the menus to eras
|
||||
|
||||
Please note that Windows will assign you a different COM port if you plug in another micro:bit. If you're juggling between micro:bits, you'll have to change the COM port every time.
|
||||
|
||||
### Alternative Windows setup with Putty
|
||||
#### Windows > Putty
|
||||
|
||||
If you prefer another terminal emulator (such as [PuTTY](http://www.putty.org/)), here are some instructions.
|
||||
|
||||
@ -47,14 +74,16 @@ If you prefer another terminal emulator (such as [PuTTY](http://www.putty.org/))
|
||||
|
||||
### Linux
|
||||
|
||||
(Untested).
|
||||
* Install the program `screen` if it is not already installed.
|
||||
* Plug in the micro:bit.
|
||||
* Open a terminal.
|
||||
* Find which device node the micro:bit was assigned to with the command `ls /dev/ttyACM*`.
|
||||
* If it was `/dev/ttyACM0`, type the command `screen /dev/ttyACM0 115200`. If it was some other device node,
|
||||
use that one in the command instead. **Note:** You may need root access to run `screen`
|
||||
successfully. You can probably use the command `sudo` like this: `sudo screen /dev/ttyACM0 115200`.
|
||||
* To exit `screen`, type `Ctrl-A` `Ctrl-D`.
|
||||
|
||||
* Plug in the micro:bit
|
||||
* Open a terminal
|
||||
* `dmesg | tail` will show you which `/dev/` node the micro:bit was assigned (e.g. `/dev/ttyUSB0`)
|
||||
* Then, do: `screen /dev/ttyUSB0 115200` (install the `screen` program if you don't have it). To exit, run `Ctrl-A` `Ctrl-D`.
|
||||
|
||||
Alternative programs include minicom, etc.
|
||||
Alternative programs include `minicom` and so on.
|
||||
|
||||
### Mac OS
|
||||
|
||||
|
@ -2,7 +2,8 @@
|
||||
|
||||
How to compile, transfer, and run a script on your micro:bit.
|
||||
|
||||
While you're writing and testing your Block Editor or Touch Develop scripts, you'll mostly be running scripts in your browser by clicking the `Run` button (see [run code in your browser](/device/simulator) for info about this).
|
||||
While you're writing and testing your scripts, you'll mostly be running scripts in your browser by clicking the `PLay` button
|
||||
(see [run code in your browser](/device/simulator) for info about this).
|
||||
|
||||
Once your masterpiece is complete, you can compile your script and run it on your micro:bit.
|
||||
|
||||
|
49
docs/docs.md
@ -1,35 +1,26 @@
|
||||
# Documentation
|
||||
|
||||
```sim
|
||||
basic.forever(() => {
|
||||
basic.showString("DOCS ");
|
||||
})
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
led.stopAnimation();
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. # . # .
|
||||
. . . . .
|
||||
# . . . #
|
||||
. # # # .`);
|
||||
});
|
||||
input.onButtonPressed(Button.B, () => {
|
||||
led.stopAnimation();
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
# . # . #
|
||||
# . . . #
|
||||
. # . # .
|
||||
. . # . .`);
|
||||
});
|
||||
```
|
||||
### Things to do
|
||||
|
||||
* **[getting started](/getting-started)**
|
||||
* Browse the [API reference](/reference)
|
||||
* Learn more about the [device](/device)
|
||||
* Get started with [lessons](/lessons)
|
||||
* Follow up with the [release notes](/release-notes)
|
||||
* **[Getting Started](/getting-started)**
|
||||
* [Ten projects](/projects)
|
||||
|
||||
### Micro:bit reference
|
||||
|
||||
* [The micro:bit APIs](/reference)
|
||||
* [The micro:bit device](/device)
|
||||
|
||||
### Language and data reference
|
||||
|
||||
* [Blocks language](/blocks)
|
||||
* [JavaScript language](/javascript)
|
||||
* [Streaming data](/streaming)
|
||||
|
||||
### More questions?
|
||||
|
||||
* [Frequently Asked Question](/faq)
|
||||
* [Release notes](/release-notes)
|
||||
|
||||
### Developers
|
||||
|
||||
* Learn about [packages](/packages) (possibly using C++ or ARM thumb)
|
||||
* Learn about [packages](/packages)
|
||||
|
12
docs/faq.md
Normal file
@ -0,0 +1,12 @@
|
||||
# Frequently Asked Questions
|
||||
|
||||
### Where can I get a BBC micro:bit?
|
||||
|
||||
More information at [http://uk.farnell.com/bbc-microbit](http://uk.farnell.com/bbc-microbit).
|
||||
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### My micro:bit does not show up as a drive when I connect it to my computer.
|
||||
|
||||
A common cause for this is a broken cable. Pick another USB cable and try it. Otherwise, try another computer as well.
|
@ -1,59 +1,16 @@
|
||||
# Getting started
|
||||
|
||||
Are you ready to build cool BBC micro:bit programs? For each challenge, reorder the blocks to recreate the program.
|
||||
## ~avatar
|
||||
|
||||
## Open [https://m.pxt.io](/) and create a new **Blocks Editor** project
|
||||
Here are some challenges for you. Arrange the blocks in the editor
|
||||
to make real programs that work!
|
||||
|
||||
## Basic
|
||||
## ~
|
||||
|
||||
### Show leds
|
||||
|
||||
Use the blocks below to draw a figure on the screen. You can redo the smiley face or try something else!
|
||||
|
||||
```shuffle
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. # . # .
|
||||
. . . . .
|
||||
# . . . #
|
||||
. # # # .
|
||||
`)
|
||||
```
|
||||
|
||||
To transfer your code to the BBC micro:bit,
|
||||
* connect your micro:bit to the computer using the USB cable
|
||||
* click on **Download**
|
||||
* drag&drop the **.hex** file into the **MICROBIT** drive
|
||||
* wait till the yellow light is done blinking!
|
||||
|
||||
### Show animation Forever
|
||||
|
||||
Show one image after the other to create an animation by snapping them together.
|
||||
Use the **Basic** drawer in the editor
|
||||
to drag out and arrange three blocks to create this program:
|
||||
|
||||
```blocks
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. # . # .
|
||||
. . . . .
|
||||
# . . . #
|
||||
. # # # .
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. # . # .
|
||||
. . . . .
|
||||
. # # # .
|
||||
# . . . #
|
||||
`)
|
||||
```
|
||||
|
||||
|
||||
### Repeat forever
|
||||
|
||||
Use the ``forever`` block to repeat your code and have a continuous animation.
|
||||
|
||||
Unsuffle the blocks to create a happy, unhappy animation.... or changes the image to make it your own!
|
||||
```shuffle
|
||||
basic.forever(() => {
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
@ -64,108 +21,21 @@ basic.forever(() => {
|
||||
`)
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. # . # .
|
||||
. . . . .
|
||||
. # # # .
|
||||
# . . . #
|
||||
. . . . .
|
||||
. . . . .
|
||||
. . . . .
|
||||
`)
|
||||
});
|
||||
```
|
||||
|
||||
### Your turn now!
|
||||
When this program runs, you will see a smiley face, then a blank
|
||||
screen, then a smiley again -- it never stops! (That's because of the
|
||||
``forever`` block.)
|
||||
|
||||
Use the blocks ``show leds`` and ``forever``
|
||||
to create your own custom awesome animation!
|
||||
Click **Compile** to move your program to the BBC micro:bit!
|
||||
Make sure to follow the instructions.
|
||||
|
||||
## Inputs
|
||||
|
||||
### Button A and B
|
||||
|
||||
Unshuffle the blocks so that the micro:bit shows "YES" when button A is pressed, and "NO" when B is pressed.
|
||||
The key idea is that all the blocks nested under `on button ... pressed` will run when that button is pressed.
|
||||
|
||||
```blocks
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
basic.showString("AAAAA");
|
||||
});
|
||||
```
|
||||
|
||||
Try to unshuffle those blocks:
|
||||
```shuffle
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
basic.showString("YES");
|
||||
});
|
||||
input.onButtonPressed(Button.B, () => {
|
||||
basic.showString("NO");
|
||||
});
|
||||
```
|
||||
|
||||
### Shake
|
||||
|
||||
Using the data from the **accelerometer**, it is possible to detect that the BBC micro:bit is being shaken.
|
||||
|
||||
Unshuffle the code to display a frownie when shaken.
|
||||
```shuffle
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. # . # .
|
||||
. . . . .
|
||||
. # # # .
|
||||
# . . . #`);
|
||||
});
|
||||
```
|
||||
|
||||
### Tilting
|
||||
|
||||
Aside from shake, it is also possible to detect tilt left and right, logo up and down or face up and down.
|
||||
Let's build a rock paper scissors game where you turn the micro:bit left to display paper, right to display scissors and down to display rock.
|
||||
|
||||
Unshuffle and try this code on the micro:bit itself!
|
||||
```shuffle
|
||||
input.onGesture(Gesture.TiltLeft, () => {
|
||||
basic.showLeds(`
|
||||
# # # # #
|
||||
# . . . #
|
||||
# . . . #
|
||||
# . . . #
|
||||
# # # # #`);
|
||||
});
|
||||
input.onGesture(Gesture.LogoDown, () => {
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. # # # .
|
||||
. # # # .
|
||||
. # # # .
|
||||
. . . . .`);
|
||||
});
|
||||
input.onGesture(Gesture.TiltRight, () => {
|
||||
basic.showLeds(`
|
||||
# # . . #
|
||||
# # . # .
|
||||
. . # . .
|
||||
# # . # .
|
||||
# # . . #`);
|
||||
});
|
||||
```
|
||||
|
||||
### Pins
|
||||
|
||||
It is possible to use the pins (big metal bar at the bottom of the board) as button. Hold the ``GND`` button with one hand and press the ``0`` pin
|
||||
(called ``P0``) with the other hand to trigger a pin pressed.
|
||||
|
||||
Unshuffle the blocks to display a smiley when pin ``P0`` is pressed.
|
||||
```shuffle
|
||||
input.onPinPressed(TouchPin.P0, () => {
|
||||
basic.showLeds(`
|
||||
. . . . .
|
||||
. # . # .
|
||||
. . . . .
|
||||
# . . . #
|
||||
. # # # .`);
|
||||
});
|
||||
```
|
||||
|
||||
### Your turn now!
|
||||
|
||||
Use the scree, buttons, gestures, pins to create a fun game using the micro:bit.
|
||||
### ~button /getting-started/screen
|
||||
NEXT: THE SCREEN
|
||||
### ~
|