Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a224259e74 | ||
|
|
c144f3a15d | ||
|
|
aa20f2fa4d | ||
|
|
4a1399de59 | ||
|
|
445066776b | ||
|
|
6cb204c548 | ||
|
|
98bc8d2a27 | ||
|
|
58d0e238e3 | ||
|
|
60f8dd8228 | ||
|
|
a34bcee7a2 | ||
|
|
d011cdb37e | ||
|
|
b37e823b57 | ||
|
|
8cb31daa48 | ||
|
|
e856d59235 | ||
|
|
32753d3395 | ||
|
|
7b11a04727 | ||
|
|
6d6c053e4f | ||
|
|
1008fdd371 | ||
|
|
ddc2b7437b | ||
|
|
b9c95ebb1e | ||
|
|
b16d02ec66 | ||
|
|
38fb36087a |
@@ -9,16 +9,16 @@ let execAsync: (cmd: string, options?: { cwd?: string }) => Promise<Buffer> = Pr
|
|||||||
let readDirAsync = Promise.promisify(fs.readdir)
|
let readDirAsync = Promise.promisify(fs.readdir)
|
||||||
|
|
||||||
|
|
||||||
export function deployCoreAsync(res: pxtc.CompileResult) {
|
export function deployCoreAsync(res: ts.pxtc.CompileResult) {
|
||||||
return getBitDrivesAsync()
|
return getBitDrivesAsync()
|
||||||
.then(drives => {
|
.then(drives => {
|
||||||
if (drives.length == 0) {
|
if (drives.length == 0) {
|
||||||
console.log("cannot find any drives to deploy to")
|
console.log("cannot find any drives to deploy to")
|
||||||
} else {
|
} else {
|
||||||
console.log(`copy ${pxtc.BINARY_HEX} to ` + drives.join(", "))
|
console.log(`copy ${ts.pxtc.BINARY_HEX} to ` + drives.join(", "))
|
||||||
}
|
}
|
||||||
return Promise.map(drives, d =>
|
return Promise.map(drives, d =>
|
||||||
writeFileAsync(d + pxtc.BINARY_HEX, res.outfiles[pxtc.BINARY_HEX])
|
writeFileAsync(d + ts.pxtc.BINARY_HEX, res.outfiles[ts.pxtc.BINARY_HEX])
|
||||||
.then(() => {
|
.then(() => {
|
||||||
console.log("wrote hex file to " + d)
|
console.log("wrote hex file to " + d)
|
||||||
}))
|
}))
|
||||||
|
|||||||
17
docs/cli.md
Normal file
17
docs/cli.md
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Command Line Interface
|
||||||
|
|
||||||
|
```sim
|
||||||
|
basic.forever(() => {
|
||||||
|
basic.showString("CLI<3")
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
It is possible to use the codethemicrobit tools from a command line interface (CLI). The PXT CLI allows to
|
||||||
|
* edit, compile or deploy JavaScript programs
|
||||||
|
* can easily be integrated in most IDEs. It comes with built-in support for [Visual Studio Code](/code)!
|
||||||
|
* run a local web server for the web editor
|
||||||
|
* author packages using JavaScript and/or C++
|
||||||
|
|
||||||
|
Using the CLI assumes that you have some experience with programming and will require to install tools on your machine as well.
|
||||||
|
|
||||||
|
* **[LET'S GET STARTED](https://pxt.io/cli)**
|
||||||
50
docs/code.md
50
docs/code.md
@@ -1,54 +1,16 @@
|
|||||||
# Visual Studio Code
|
# Visual Studio Code
|
||||||
|
|
||||||
Visual Studio Code is a Free Open Source code editor that you can use to edit your programs.
|
[Visual Studio Code](https://code.visualstudio.com) is a Free Open Source code editor that you can use to edit your programs.
|
||||||
|
|
||||||
Working from Visual Studio code allows you to benefit from all the features
|
Working from Visual Studio code allows you to benefit from all the features
|
||||||
of a professional IDE while working with PXT: working with files,
|
of a professional IDE while working with PXT: working with files,
|
||||||
git integration (or source control of your choice), hundreds of extensions.
|
git integration (or source control of your choice), hundreds of extensions.
|
||||||
|
|
||||||

|
* background compilation
|
||||||
|
* auto-completion
|
||||||
|
* pxt command line integration
|
||||||
|
|
||||||
## Setup
|
**Follow [these instructions](https://pxt.io/cli)** to setup your machine and edit your programs in Visual Studio Code.
|
||||||
|
|
||||||
Follow these instructions to setup your machine and edit your programs in Visual Studio Code.
|

|
||||||
|
|
||||||
* install [Visual Studio Code](https://code.visualstudio.com/)
|
|
||||||
* install [Node.JS](https://nodejs.org/en/)
|
|
||||||
* install the PXT Tools (on Mac or Linux, you might have to add ``sudo`` to the command).
|
|
||||||
```
|
|
||||||
pxt install -g pxt
|
|
||||||
```
|
|
||||||
* create a folder for your projects
|
|
||||||
```
|
|
||||||
mkdir microbit
|
|
||||||
```
|
|
||||||
* install the microbit target
|
|
||||||
```
|
|
||||||
pxt target microbit
|
|
||||||
```
|
|
||||||
|
|
||||||
That's it! You are ready to create new projects in code or open existing projects.
|
|
||||||
|
|
||||||
## Creating a new project
|
|
||||||
|
|
||||||
Open a shell to your ``microbit`` folder.
|
|
||||||
|
|
||||||
```
|
|
||||||
# create a new subfolder for your project
|
|
||||||
mkdir myproject
|
|
||||||
cd myproject
|
|
||||||
# start the project set
|
|
||||||
pxt init
|
|
||||||
# open code
|
|
||||||
code .
|
|
||||||
```
|
|
||||||
|
|
||||||
## Opening an existing project
|
|
||||||
|
|
||||||
You can extract a project from the embedded URL or .hex file. Open a shell to your projects folder
|
|
||||||
|
|
||||||
```
|
|
||||||
# extract the project from the URL
|
|
||||||
pxt extract EMBEDURL
|
|
||||||
```
|
|
||||||
where ``EMBEDURL`` is the published project URL.
|
|
||||||
@@ -26,4 +26,5 @@
|
|||||||
|
|
||||||
### Developers
|
### Developers
|
||||||
|
|
||||||
|
* [Command Line Interface](/cli)
|
||||||
* Learn about [packages](/packages)
|
* Learn about [packages](/packages)
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ Control of the LED screen.
|
|||||||
led.plot(0, 0);
|
led.plot(0, 0);
|
||||||
led.unplot(0, 0);
|
led.unplot(0, 0);
|
||||||
led.point(0, 0);
|
led.point(0, 0);
|
||||||
|
led.toggle(0, 0);
|
||||||
led.brightness();
|
led.brightness();
|
||||||
led.setBrightness(255);
|
led.setBrightness(255);
|
||||||
led.stopAnimation();
|
led.stopAnimation();
|
||||||
@@ -14,7 +15,6 @@ led.fadeIn();
|
|||||||
led.fadeOut();
|
led.fadeOut();
|
||||||
led.plotAll();
|
led.plotAll();
|
||||||
led.screenshot();
|
led.screenshot();
|
||||||
led.toggle(0, 0);
|
|
||||||
led.toggleAll();
|
led.toggleAll();
|
||||||
led.setDisplayMode(DisplayMode.BackAndWhite);
|
led.setDisplayMode(DisplayMode.BackAndWhite);
|
||||||
```
|
```
|
||||||
|
|||||||
BIN
docs/static/mb/vscode.png
vendored
Normal file
BIN
docs/static/mb/vscode.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 65 KiB |
@@ -196,6 +196,8 @@ namespace pxt {
|
|||||||
int programHash();
|
int programHash();
|
||||||
//%
|
//%
|
||||||
void *ptrOfLiteral(int offset);
|
void *ptrOfLiteral(int offset);
|
||||||
|
//%
|
||||||
|
int getNumGlobals();
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace pxtrt {
|
namespace pxtrt {
|
||||||
@@ -308,11 +310,6 @@ namespace pxtrt {
|
|||||||
// Debugger
|
// Debugger
|
||||||
//
|
//
|
||||||
|
|
||||||
//%
|
|
||||||
uint32_t getNumGlobals() {
|
|
||||||
return numGlobals;
|
|
||||||
}
|
|
||||||
|
|
||||||
//%
|
//%
|
||||||
void* getGlobalsPtr() {
|
void* getGlobalsPtr() {
|
||||||
return globals;
|
return globals;
|
||||||
|
|||||||
@@ -1,63 +1,110 @@
|
|||||||
enum Note {
|
enum Note {
|
||||||
C = 262,
|
C = 262,
|
||||||
//% block=C#
|
//% block=C#
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
CSharp = 277,
|
CSharp = 277,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
D = 294,
|
D = 294,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
Eb = 311,
|
Eb = 311,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
E = 330,
|
E = 330,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
F = 349,
|
F = 349,
|
||||||
//% block=F#
|
//% block=F#
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
FSharp = 370,
|
FSharp = 370,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
G = 392,
|
G = 392,
|
||||||
//% block=G#
|
//% block=G#
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
GSharp = 415,
|
GSharp = 415,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
A = 440,
|
A = 440,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
Bb = 466,
|
Bb = 466,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
B = 494,
|
B = 494,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
C3 = 131,
|
C3 = 131,
|
||||||
//% block=C#3
|
//% block=C#3
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
CSharp3 = 139,
|
CSharp3 = 139,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
D3 = 147,
|
D3 = 147,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
Eb3 = 156,
|
Eb3 = 156,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
E3 = 165,
|
E3 = 165,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
F3 = 175,
|
F3 = 175,
|
||||||
//% block=F#3
|
//% block=F#3
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
FSharp3 = 185,
|
FSharp3 = 185,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
G3 = 196,
|
G3 = 196,
|
||||||
//% block=G#3
|
//% block=G#3
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
GSharp3 = 208,
|
GSharp3 = 208,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
A3 = 220,
|
A3 = 220,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
Bb3 = 233,
|
Bb3 = 233,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
B3 = 247,
|
B3 = 247,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
C4 = 262,
|
C4 = 262,
|
||||||
//% block=C#4
|
//% block=C#4
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
CSharp4 = 277,
|
CSharp4 = 277,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
D4 = 294,
|
D4 = 294,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
Eb4 = 311,
|
Eb4 = 311,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
E4 = 330,
|
E4 = 330,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
F4 = 349,
|
F4 = 349,
|
||||||
//% block=F#4
|
//% block=F#4
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
FSharp4 = 370,
|
FSharp4 = 370,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
G4 = 392,
|
G4 = 392,
|
||||||
//% block=G#4
|
//% block=G#4
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
GSharp4 = 415,
|
GSharp4 = 415,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
A4 = 440,
|
A4 = 440,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
Bb4 = 466,
|
Bb4 = 466,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
B4 = 494,
|
B4 = 494,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
C5 = 523,
|
C5 = 523,
|
||||||
//% block=C#5
|
//% block=C#5
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
CSharp5 = 555,
|
CSharp5 = 555,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
D5 = 587,
|
D5 = 587,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
Eb5 = 622,
|
Eb5 = 622,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
E5 = 659,
|
E5 = 659,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
F5 = 698,
|
F5 = 698,
|
||||||
//% block=F#5
|
//% block=F#5
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
FSharp5 = 740,
|
FSharp5 = 740,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
G5 = 784,
|
G5 = 784,
|
||||||
//% block=G#5
|
//% block=G#5
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
GSharp5 = 831,
|
GSharp5 = 831,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
A5 = 880,
|
A5 = 880,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
Bb5 = 932,
|
Bb5 = 932,
|
||||||
|
//% blockIdentity=music.noteFrequency
|
||||||
B5 = 989,
|
B5 = 989,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,6 +168,7 @@ namespace music {
|
|||||||
*/
|
*/
|
||||||
//% weight=50 help=music/note-frequency
|
//% weight=50 help=music/note-frequency
|
||||||
//% blockId=device_note block="%note"
|
//% blockId=device_note block="%note"
|
||||||
|
//% shim=TD_ID
|
||||||
export function noteFrequency(name: Note): number {
|
export function noteFrequency(name: Note): number {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pxt-microbit",
|
"name": "pxt-microbit",
|
||||||
"version": "0.3.51",
|
"version": "0.3.59",
|
||||||
"description": "micro:bit target for PXT",
|
"description": "micro:bit target for PXT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"JavaScript",
|
"JavaScript",
|
||||||
@@ -29,6 +29,6 @@
|
|||||||
"typescript": "^1.8.7"
|
"typescript": "^1.8.7"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pxt-core": "0.3.56"
|
"pxt-core": "0.3.68"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@
|
|||||||
"yottaTarget": "bbc-microbit-classic-gcc",
|
"yottaTarget": "bbc-microbit-classic-gcc",
|
||||||
"yottaCorePackage": "pxt-microbit-core",
|
"yottaCorePackage": "pxt-microbit-core",
|
||||||
"githubCorePackage": "microsoft/pxt-microbit-core",
|
"githubCorePackage": "microsoft/pxt-microbit-core",
|
||||||
"gittag": "v0.3.1",
|
"gittag": "v0.4.1",
|
||||||
"serviceId": "ws"
|
"serviceId": "ws"
|
||||||
},
|
},
|
||||||
"serial": {
|
"serial": {
|
||||||
|
|||||||
Reference in New Issue
Block a user