Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb3e91420c | ||
|
|
38cd913020 | ||
|
|
9159c297a5 | ||
|
|
851687dba8 | ||
|
|
28b8006ec5 | ||
|
|
271128c075 | ||
|
|
a04ca0d715 | ||
|
|
8b89fe721d | ||
|
|
1baf04b1fd | ||
|
|
6c7f0f911c | ||
|
|
f2008f9263 | ||
|
|
62127f7269 | ||
|
|
740cedd978 | ||
|
|
4278ff2b37 | ||
|
|
e7bea34d95 | ||
|
|
825409b697 | ||
|
|
8f72ac0094 | ||
|
|
8a6bb610e3 | ||
|
|
94dc141062 | ||
|
|
286dd1e50b | ||
|
|
6451d9add9 | ||
|
|
fd1dcde86b | ||
|
|
99947a9e21 | ||
|
|
a69239abed |
54
docs/code.md
Normal file
54
docs/code.md
Normal 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.
|
||||
|
||||

|
||||
|
||||
## 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.
|
||||
15
docs/faq.md
15
docs/faq.md
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
32
docs/reference/control/wait-micros.md
Normal file
32
docs/reference/control/wait-micros.md
Normal 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)
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
10
libs/microbit/shims.d.ts
vendored
10
libs/microbit/shims.d.ts
vendored
@@ -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.
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user