Compare commits

...

24 Commits

Author SHA1 Message Date
Michal Moskal
eb3e91420c 0.3.32 2016-08-17 15:09:56 +03:00
Michal Moskal
38cd913020 Bump pxt-core to 0.3.35 2016-08-17 15:08:24 +03:00
Peli de Halleux
9159c297a5 added wait-micros function 2016-08-16 17:04:21 -07:00
Peli de Halleux
851687dba8 0.3.31 2016-08-16 13:44:38 -07:00
Peli de Halleux
28b8006ec5 removing spurious logging 2016-08-16 10:11:55 -07:00
Peli de Halleux
271128c075 answering questions about saving 2016-08-16 09:21:41 -07:00
Peli de Halleux
a04ca0d715 0.3.30 2016-08-16 07:46:43 -07:00
Peli de Halleux
8b89fe721d Bump pxt-core to 0.3.34 2016-08-16 07:46:39 -07:00
Peli de Halleux
1baf04b1fd added links to packages 2016-08-15 23:16:10 -07:00
Peli de Halleux
6c7f0f911c 0.3.29 2016-08-15 15:44:05 -07:00
Peli de Halleux
f2008f9263 Bump pxt-core to 0.3.33 2016-08-15 15:44:03 -07:00
Peli de Halleux
62127f7269 Updated VS code instructions 2016-08-15 11:03:03 -07:00
Peli de Halleux
740cedd978 added docs 2016-08-12 16:15:41 -07:00
Peli de Halleux
4278ff2b37 0.3.28 2016-08-12 08:36:34 -07:00
Peli de Halleux
e7bea34d95 Bump pxt-core to 0.3.32 2016-08-12 08:36:33 -07:00
Peli de Halleux
825409b697 0.3.27 2016-08-12 04:03:06 -07:00
Peli de Halleux
8f72ac0094 Bump pxt-core to 0.3.31 2016-08-12 04:03:03 -07:00
Peli de Halleux
8a6bb610e3 updated description 2016-08-12 03:37:27 -07:00
Peli de Halleux
94dc141062 0.3.26 2016-08-11 16:33:03 -07:00
Peli de Halleux
286dd1e50b Bump pxt-core to 0.3.29 2016-08-11 16:33:00 -07:00
Peli de Halleux
6451d9add9 0.3.25 2016-08-11 16:24:34 -07:00
Peli de Halleux
fd1dcde86b Bump pxt-core to 0.3.28 2016-08-11 16:24:30 -07:00
Peli de Halleux
99947a9e21 0.3.24 2016-08-11 16:07:31 -07:00
Peli de Halleux
a69239abed Bump pxt-core to 0.3.27 2016-08-11 16:07:29 -07:00
12 changed files with 138 additions and 7 deletions

54
docs/code.md Normal file
View File

@@ -0,0 +1,54 @@
# Visual Studio Code
Visual Studio Code is a Free Open Source code editor that you can use to edit your programs.
Working from Visual Studio code allows you to benefit from all the features
of a professional IDE while working with PXT: working with files,
git integration (or source control of your choice), hundreds of extensions.
![](https://code.visualstudio.com/home/home-screenshot-win-lg.png)
## Setup
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.

View File

@@ -4,6 +4,21 @@
More information at [http://uk.farnell.com/bbc-microbit](http://uk.farnell.com/bbc-microbit).
### How do I send feedback?
Find the small bubble icon on the bottom of the editor and
post your feedback from there!
### How do I save my code?
The web editor automatically saves your code in the browser cache. Simply reopen the browser and navigate to the web editor
to reopen your latest project. You can also open previous project stored locally through **More -> Open Project**.
The project source is also stored in each compiled ``.hex`` file. Drag and drop the ``.hex`` file into the web editor to load the project.
To share your project with others, you can use the **Embed** feature. It stores your project in the cloud and creates a URL that you can share with others.
If you are using [Visual Studio Code](/code), all your programs are stored as files on your computer and you can use your favorite source control system as needed.
## Troubleshooting

View File

@@ -5,6 +5,8 @@ that users can then add to their scripts. These typically
provide a driver for a particular hardware device you can connect
to a microbit.
* [pxt-max6675](https://github.com/Microsoft/pxt-max6675) -- TypeScript only package
* [pxt-neopixel](https://github.com/Microsoft/pxt-neopixel) -- TypeScript + ARM Thumb assembly package
* [Sample C++ extension](https://github.com/Microsoft/pxt-microbit-cppsample)
* [Sample TypeScript extension](https://github.com/Microsoft/pxt-microbit/tree/master/libs/i2c-fram)

View File

@@ -7,8 +7,9 @@ control.inBackground(() => {
});
control.reset();
control.waitMicros(4);
```
### See Also
[inBackground](/reference/control/in-background), [reset](/reference/control/reset)
[inBackground](/reference/control/in-background), [reset](/reference/control/reset), [wait-micros](/reference/control/wait-micros)

View File

@@ -0,0 +1,32 @@
# WaitMicros
Blocks the current fiber for the given amount of micro-seconds.
```sig
control.waitMicros(4)
```
### Example
This program sends a 10 micro-second HIGH pulse through pin ``P0``.
```blocks
// ensure pin is low to send a clean pulse
pins.digitalWritePin(DigitalPin.P0, 0)
control.waitMicros(2)
// set pin to 1 and wait 10 micros
pins.digitalWritePin(DigitalPin.P0, 1)
control.waitMicros(10)
// finish pulse
pins.digitalWritePin(DigitalPin.P0, 0)
```
#### ~hint
This function is not supported in the simulator.
#### ~
### See Also
[pause](/reference/basic/pause)

View File

@@ -4,6 +4,11 @@
basic.forever(() => { basic.showString("RELEASE NOTES"); });
```
## August 2016
* The JavaScript editor is using Monaco
* New [package system](/packages) based on GitHub
## June 2016
* It is now possible to stream data into the cloud (Azure) from the PXT editor. Simply click on the log view to get started.

View File

@@ -129,12 +129,22 @@ namespace control {
/**
* Resets the BBC micro:bit.
*/
//% weight=30 async help=control/reset
//% weight=30 async help=control/reset blockGap=8
//% blockId="control_reset" block="reset"
void reset() {
microbit_reset();
}
/**
* Blocks the current fiber for the given microseconds
* @param micros number of micro-seconds to wait. eg: 4
*/
//% help=control/wait-micros weight=29
//% blockId="control_wait_us" block="wait (µs)%micros"
void waitMicros(int micros) {
wait_us(micros);
}
/**
* Raises an event in the event bus.
* @param src ID of the MicroBit Component that generated the event e.g. MICROBIT_ID_BUTTON_A.

View File

@@ -333,10 +333,18 @@ declare namespace control {
/**
* Resets the BBC micro:bit.
*/
//% weight=30 async help=control/reset
//% weight=30 async help=control/reset blockGap=8
//% blockId="control_reset" block="reset" shim=control::reset
function reset(): void;
/**
* Blocks the current fiber for the given microseconds
* @param micros number of micro-seconds to wait. eg: 4
*/
//% help=control/wait-micros weight=29
//% blockId="control_wait_us" block="wait (µs)%micros" shim=control::waitMicros
function waitMicros(micros: number): void;
/**
* Raises an event in the event bus.
* @param src ID of the MicroBit Component that generated the event e.g. MICROBIT_ID_BUTTON_A.

View File

@@ -1,7 +1,7 @@
{
"name": "pxt-microbit",
"version": "0.3.23",
"description": "BBC micro:bit target for PXT",
"version": "0.3.32",
"description": "micro:bit target for PXT",
"keywords": [
"JavaScript",
"education",
@@ -29,6 +29,6 @@
"typescript": "^1.8.7"
},
"dependencies": {
"pxt-core": "0.3.26"
"pxt-core": "0.3.35"
}
}

View File

@@ -2,6 +2,7 @@
"id": "microbit",
"name": "code the micro:bit",
"title": "code the micro:bit - Blocks / Javascript editor",
"description": "A Blocks / JavaScript code editor for the micro:bit.",
"corepkg": "microbit",
"bundleddirs": [
"libs/microbit",

View File

@@ -227,6 +227,10 @@ namespace pxsim.control {
U.userError("reset not implemented in simulator yet")
}
export function waitMicros(micros: number) {
// TODO
}
export function deviceName(): string {
let b = board();
return b && b.id

View File

@@ -551,7 +551,6 @@ namespace pxsim {
default: theme = pxsim.micro_bit.randomTheme();
}
console.log("setting up microbit simulator")
let view = new pxsim.micro_bit.MicrobitBoardSvg({
theme: theme,
runtime: runtime