Compare commits

...

22 Commits

Author SHA1 Message Date
Peli de Halleux
a224259e74 0.3.59 2016-08-31 16:36:35 -07:00
Peli de Halleux
c144f3a15d Bump pxt-core to 0.3.68 2016-08-31 16:36:34 -07:00
Peli de Halleux
aa20f2fa4d 0.3.58 2016-08-31 16:24:07 -07:00
Peli de Halleux
4a1399de59 Bump pxt-core to 0.3.67 2016-08-31 16:24:06 -07:00
Peli de Halleux
445066776b 0.3.57 2016-08-31 15:42:18 -07:00
Peli de Halleux
6cb204c548 Bump pxt-core to 0.3.66 2016-08-31 15:42:16 -07:00
Peli de Halleux
98bc8d2a27 0.3.56 2016-08-31 15:20:34 -07:00
Peli de Halleux
58d0e238e3 Bump pxt-core to 0.3.65 2016-08-31 15:20:33 -07:00
Peli de Halleux
60f8dd8228 annotating note with TD_ID 2016-08-31 11:22:07 -07:00
Peli de Halleux
a34bcee7a2 added simulator 2016-08-30 13:39:31 -07:00
Peli de Halleux
d011cdb37e updated cli / vscode docs 2016-08-30 13:34:05 -07:00
Peli de Halleux
b37e823b57 0.3.55 2016-08-30 11:35:31 -07:00
Peli de Halleux
8cb31daa48 Adding CLI pointer 2016-08-30 11:35:16 -07:00
Michal Moskal
e856d59235 0.3.54 2016-08-30 12:50:18 +02:00
Michal Moskal
32753d3395 Bump pxt-core to 0.3.61 2016-08-30 12:50:18 +02:00
Michal Moskal
7b11a04727 Upgrade pxt-microbit-core to 0.4.1 2016-08-30 12:48:58 +02:00
Peli de Halleux
6d6c053e4f 0.3.53 2016-08-29 23:25:12 -07:00
Peli de Halleux
1008fdd371 Bump pxt-core to 0.3.60 2016-08-29 23:25:11 -07:00
Peli de Halleux
ddc2b7437b re-ordering of blocks in docs 2016-08-29 14:49:51 -07:00
Peli de Halleux
b9c95ebb1e 0.3.52 2016-08-29 13:26:01 -07:00
Peli de Halleux
b16d02ec66 Bump pxt-core to 0.3.59 2016-08-29 13:25:58 -07:00
Peli de Halleux
38fb36087a fixing local deployment (pxtc import issue) 2016-08-26 17:51:15 -07:00
10 changed files with 81 additions and 56 deletions

View File

@@ -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
View 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)**

View File

@@ -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.
![](https://code.visualstudio.com/home/home-screenshot-win-lg.png) * 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. ![](/static/mb/vscode.png)
* 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.

View File

@@ -26,4 +26,5 @@
### Developers ### Developers
* [Command Line Interface](/cli)
* Learn about [packages](/packages) * Learn about [packages](/packages)

View File

@@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

View File

@@ -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;

View File

@@ -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;
} }

View File

@@ -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"
} }
} }

View File

@@ -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": {