Compare commits

...

17 Commits

Author SHA1 Message Date
7e79635413 0.3.8 2016-07-29 10:49:38 -07:00
56e1cf91ac Bump pxt-core to 0.3.11 2016-07-29 10:49:36 -07:00
f9f96f33f0 0.3.7 2016-07-29 11:37:58 +01:00
0b33073be1 Bump pxt-core to 0.3.10 2016-07-29 11:37:57 +01:00
65594842fc Fix issue with multi digit numbers not scrolling all the way off screen as is the case on the physical pxt. 2016-07-28 15:54:10 -07:00
c6ed665f84 Fix for issue 176: basic.showNumber timing in the simulator
- updated basic.cpp::showNumber to use printChar instead of print.
2016-07-28 15:04:56 -07:00
79462deb24 Merge pull request #190 from Microsoft/microsoftsam/issue179
Fix for issue 179: Watch Challenges goes to Rock Paper Scissors instead of the challenges code
2016-07-28 14:21:18 -07:00
5c05f3e241 Fix for issue 179: Watch Challenges goes to Rock Paper Scissors instead of the challenges code 2016-07-28 13:13:33 -07:00
4f7dd75fbe Finished animation API 2016-07-28 12:16:18 -07:00
338e507b51 temporary fix for reference 2016-07-28 12:03:03 -07:00
601231a5dc 0.3.6 2016-07-28 11:54:23 -07:00
f0850336e5 Bump pxt-core to 0.3.9 2016-07-28 11:54:18 -07:00
a6b2187ec5 Edited advanced page 2016-07-28 10:56:37 -07:00
28ae4f4230 better board name detection 2016-07-28 10:22:05 -07:00
09933b6a8d advanced section 2016-07-28 09:15:31 -07:00
45bb6e7cb3 0.3.5 2016-07-28 12:47:58 +01:00
33c234a87e Bump pxt-core to 0.3.8 2016-07-28 12:47:57 +01:00
8 changed files with 47 additions and 28 deletions

View File

@ -28,11 +28,12 @@ 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] + "/")
}
@ -41,8 +42,9 @@ function getBitDrivesAsync(): Promise<string[]> {
})
}
else if (process.platform == "darwin") {
let rx = new RegExp(pxt.appTarget.compile.deployDrives)
return readDirAsync("/Volumes")
.then(lst => lst.filter(s => /MICROBIT/.test(s)).map(s => "/Volumes/" + s + "/"))
.then(lst => lst.filter(s => rx.test(s)).map(s => "/Volumes/" + s + "/"))
} else {
return Promise.resolve([])
}

View File

@ -148,12 +148,6 @@ Trim any leftover fabric, threads or tape.
Your watch is ready!
### ~avatar avatar
Excellent, you're ready to continue with the [challenges](/projects/rock-paper-scissors)!
### ~
### Acknowledgements
Artistic design by Melinda Hoeneisen.

View File

@ -9,14 +9,24 @@ led.stopAnimation()
### Example
This program...
This program sets up the ``stop animation`` part of the program,
and then shows a string that you can stop with button ``B``.
```blocks
basic.showString("STOP ME! STOP ME! PLEASE, WON'T SOMEBODY STOP ME?");
input.onButtonPressed(Button.B, () => {
led.stopAnimation();
});
'```
basic.showString("STOP ME! STOP ME! PLEASE, WON'T SOMEBODY STOP ME?");
```
### ~hint
It's important to set up ``stop animation`` before showing the
animation, so the ``stop animation`` part of the program will be ready
to go.
### ~
### See Also
[show animation](/reference/basic/show-animation)

View File

@ -1,18 +1,26 @@
# Write Value To Serial
Writes the full data received data via ``radio`` to serial in JSON format.
**Note** - This method only works for [send number](/reference/radio/send-number) and [send value](/reference/radio/send-value). It does not work for [send string](/reference/radio/send-string) (although a string can be sent with [send value](/reference/radio/send-value)).
Writes the data received by ``radio`` to serial in JSON format.
```sig
radio.writeValueToSerial();
```
## Data received format
The format for received data printed to serial is as follows
- [send number](/reference/radio/send-number) - ```{v:ValueSent,t:MicrobitTimeAlive,s:Unused}```
- [send value](/reference/radio/send-number) - ```{v:Value,t:MicrobitTimeAlive,s:Unused,n:"Name"}```
- [send string](/reference/radio/send-string) - ```{}``` (currently unavailable)
### ~hint
This method only works for [send number](/reference/radio/send-number)
and [send value](/reference/radio/send-value). It does not work for
[send string](/reference/radio/send-string), although you can send a
string as part of [send value](/reference/radio/send-value).
### ~
### Data received format
The format for received data printed to serial is as follows:
- [send number](/reference/radio/send-number): ```{v:ValueSent,t:MicrobitTimeAlive,s:Unused}```
- [send value](/reference/radio/send-value): ```{v:ValueSent,t:MicrobitTimeAlive,s:Unused,n:"Name"}```
### Simulator
@ -20,7 +28,9 @@ This function only works on the micro:bit, not in browsers.
### Examples
When ```radio``` data is received (after pressing A button on 2nd micro:bit), output temperature data to serial.
When ```radio``` data is received (after pressing the ``A`` button on
the second micro:bit), this program sends temperature data to
serial.
```blocks
input.onButtonPressed(Button.A, () => {
@ -30,9 +40,11 @@ radio.onDataReceived(() => {
radio.writeValueToSerial();
});
```
Example output to serial when A button pressed:
Sample output to serial when ``A`` button pressed:
```{v:27,t:323,s:0}```
### See also
[send number](/reference/radio/send-number), [send value](/reference/radio/send-number), [on data received](/reference/radio/on-data-received)
[send number](/reference/radio/send-number),
[send value](/reference/radio/send-value),
[on data received](/reference/radio/on-data-received)

View File

@ -23,7 +23,7 @@ namespace basic {
if (value < 0 || value >= 10) {
uBit.display.scroll(t, interval);
} else {
uBit.display.print(t.charAt(0), interval * 5);
uBit.display.printChar(t.charAt(0), interval * 5);
}
}

View File

@ -1,6 +1,6 @@
{
"name": "pxt-microbit",
"version": "0.3.4",
"version": "0.3.8",
"description": "BBC micro:bit target for PXT",
"keywords": [
"JavaScript",
@ -29,6 +29,6 @@
"typescript": "^1.8.7"
},
"dependencies": {
"pxt-core": "0.3.7"
"pxt-core": "0.3.11"
}
}

View File

@ -52,7 +52,7 @@
"compile": {
"isNative": false,
"hasHex": true,
"deployDrives": "^MICROBIT",
"deployDrives": "(MICROBIT|MBED)",
"driveName": "MICROBIT",
"hexMimeType": "application/x-microbit-hex"
},

View File

@ -725,7 +725,8 @@ namespace pxsim.ImageMethods {
board().animationQ.enqueue({
interval: interval,
frame: () => {
if (off >= leds.width || off < 0) return false;
//TODO: support right to left.
if (off >= leds.width + 5 || off < 0) return false;
stride > 0 ? display.shiftLeft(stride) : display.shiftRight(-stride);
let c = Math.min(stride, leds.width - off);
leds.copyTo(off, c, display, 5 - stride)