Compare commits
34 Commits
Author | SHA1 | Date | |
---|---|---|---|
31998fec05 | |||
342aa3ca32 | |||
9b599b6242 | |||
e5e63c548f | |||
f3eb9a988f | |||
e7e2ff7752 | |||
f10ac93268 | |||
47f46553e0 | |||
3158e95cde | |||
854029fe33 | |||
1b379bddd0 | |||
9495da9a53 | |||
128b3f2f51 | |||
a331a017b8 | |||
790b9f557a | |||
0b469f69b6 | |||
5cce86ec7e | |||
65e01dc0df | |||
1a3c31c9f3 | |||
7aeb216462 | |||
543659b0e8 | |||
5d4bd77bf4 | |||
c83d7e9f07 | |||
efee05c7f5 | |||
cc9ab86181 | |||
ef8d7185ee | |||
b0392da8b1 | |||
c817f9e3ff | |||
5f78f98f94 | |||
395b6184b9 | |||
3274964a11 | |||
f5e8b35df4 | |||
996073728c | |||
1e964ba1ea |
4
.gitignore
vendored
@ -24,3 +24,7 @@ clients/electron/projects
|
||||
*.db
|
||||
*.suo
|
||||
*.log
|
||||
|
||||
.DS_Store
|
||||
.idea
|
||||
*.iml
|
||||
|
22
cmds/cmds.ts
@ -13,20 +13,20 @@ export function deployCoreAsync(res: ts.pxtc.CompileResult) {
|
||||
return getBitDrivesAsync()
|
||||
.then(drives => {
|
||||
if (drives.length == 0) {
|
||||
let msg = "cannot find any drives to deploy to";
|
||||
console.log(msg);
|
||||
return Promise.reject(new Error(msg));
|
||||
console.log("cannot find any drives to deploy to");
|
||||
return Promise.resolve(0);
|
||||
}
|
||||
|
||||
console.log(`copy ${ts.pxtc.BINARY_HEX} to ` + drives.join(", "))
|
||||
console.log(`copy ${ts.pxtc.BINARY_HEX} to ` + drives.join(", "));
|
||||
|
||||
return Promise.map(drives, d =>
|
||||
writeFileAsync(d + ts.pxtc.BINARY_HEX, res.outfiles[ts.pxtc.BINARY_HEX])
|
||||
.then(() => {
|
||||
console.log("wrote hex file to " + d)
|
||||
}))
|
||||
})
|
||||
.then(() => { })
|
||||
let writeHexFile = (filename: string) => {
|
||||
return writeFileAsync(filename + ts.pxtc.BINARY_HEX, res.outfiles[ts.pxtc.BINARY_HEX])
|
||||
.then(() => console.log("wrote hex file to " + filename));
|
||||
};
|
||||
|
||||
return Promise.map(drives, d => writeHexFile(d))
|
||||
.then(() => drives.length);
|
||||
});
|
||||
}
|
||||
|
||||
function getBitDrivesAsync(): Promise<string[]> {
|
||||
|
@ -1,11 +1,40 @@
|
||||
# crocodile clips
|
||||
|
||||
The large holes at the bottom of the board are designed to attach alligator/crocodile clips.
|
||||
Register an event that will execute whenever the user attaches one side of the crocodile clip to the `GND` pin, then connects and disconnects the unattached side of the crocodile clip to pin `0`, `1`, or `2`.
|
||||
The large holes at the bottom of the board are designed to attach alligator/crocodile clips
|
||||
to create electrical circuit with other components.
|
||||
|
||||
### Example: on pin pressed with random numbers
|
||||
# ~hint
|
||||
|
||||
This example displays a random number every time the crocodile clip holds `GND` then connects and disconnects the `P0` pin. Each time the crocodile clip is firmly connected and disconnected from pin `P0`, the micro:bit will return a random Number between 0 and the parameter limit
|
||||
**No crocodile clips!?!?!** Use wires or Aluminium foil! [Read more...](/device/foil-circuits)
|
||||
|
||||
# ~
|
||||
|
||||
|
||||
## Connecting Crocodile Clips
|
||||
|
||||
The hole for ``P0`` and ``GND`` allow to grab the board on the side which makes for a great grip.
|
||||
|
||||

|
||||
|
||||
Pass one jaw in the hole and grab the side of the board with the other jaw.
|
||||
|
||||

|
||||
|
||||
For the center holes, ``P1`` and ``P2``, you can also grab the bottom of the board but they are a bit harder to grip.
|
||||
|
||||
You can also grip the board between the jaws. In which case, you will want to make sure to avoid overlapping the jaws
|
||||
with the other pins as it will create short-circuit in the board.
|
||||
|
||||

|
||||
|
||||
Adding a little tape helps keeping the crocodile clips in place.
|
||||
|
||||

|
||||
|
||||
## Example: on pin pressed with random numbers
|
||||
|
||||
This example displays a random number every time the crocodile clip holds `GND` then connects and disconnects the `P0` pin.
|
||||
Each time the crocodile clip is firmly connected and disconnected from pin `P0`, the micro:bit will return a random Number between 0 and the parameter limit.
|
||||
|
||||
```blocks
|
||||
input.onPinPressed(TouchPin.P0, () => {
|
||||
@ -13,11 +42,6 @@ input.onPinPressed(TouchPin.P0, () => {
|
||||
})
|
||||
```
|
||||
|
||||
### Connecting Crocodile Clips
|
||||
|
||||

|
||||
|
||||
### See also
|
||||
|
||||
[micro:bit pins](/device/pins), [pin is pressed](/reference/input/pin-is-pressed), [analog read pin](/reference/pins/analog-read-pin), [analog write pin](/reference/pins/analog-write-pin), [digital read pin](/reference/pins/digital-read-pin), [digital write pin](/reference/pins/digital-write-pin)
|
||||
## See also
|
||||
|
||||
[micro:bit pins](/device/pins)
|
||||
|
@ -1,7 +1,5 @@
|
||||
# Error codes
|
||||
|
||||
The micro:bit error codes
|
||||
|
||||
Your micro:bit may encounter a situation that prevents it from running your code. When this happens, a frowny face will appear on your micro:bit screen (see picture) followed by an error number.
|
||||
|
||||
Below is a list of error numbers and what they mean:
|
||||
|
52
docs/device/foil-circuits.md
Normal file
@ -0,0 +1,52 @@
|
||||
# foil circuits
|
||||
|
||||
The large holes at the bottom of the board are designed to attach alligator/crocodile clips
|
||||
to create electrical circuit with other components.
|
||||
|
||||
If you do not have crocodile clips at hand, dyou can use wires or even Aluminium foil to acheive the same result.
|
||||
We will show you how to connect the micro:bit to headphones using Alumunium foil and tape.
|
||||
|
||||
https://youtu.be/mhXYyPuvpz0
|
||||
|
||||
### Materials
|
||||
|
||||
* micro:bit and battery pack (you can also power it via USB)
|
||||
* a small piece of cardboard
|
||||
* Aluminium foil
|
||||
* tape
|
||||
|
||||
### Assembly instructions
|
||||
|
||||
Tape the micro:bit and battery pack to the card board. Make sure to remove the batteries while you are building your circuit.
|
||||
|
||||

|
||||
|
||||
Cut the thinest strip of foil possible and roll it into a cable. You can also try to fold, whatever works for you.
|
||||
Build two of those wires.
|
||||
|
||||

|
||||
|
||||
Place the foil wire on the ``GND`` pin and attach with a piece of tape. Press hard to get the best connection between
|
||||
the foil and the pin board. Make sure the foil is not overlapping with the other pins!
|
||||
|
||||

|
||||
|
||||
Place the second wire on the ``P0`` pin the same way. Make sure the wire does not overlap with the other pins!
|
||||
|
||||

|
||||
|
||||
Tape the headphone jack connector to the cardboard and roll the wire coming from ``GND`` around the metal base.
|
||||
Make sure the wire does not touch the other metal rings on the jack.
|
||||
|
||||

|
||||
|
||||
Tape the second wire on the head of the jack connector.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
|
||||
## See also
|
||||
|
||||
[micro:bit pins](/device/pins)
|
@ -7,11 +7,12 @@
|
||||
```sim
|
||||
basic.forever(() => {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .`);
|
||||
. # . # .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .`
|
||||
);
|
||||
basic.pause(500);
|
||||
basic.clearScreen();
|
||||
basic.pause(500);
|
||||
@ -29,11 +30,12 @@ Use [show leds](/reference/basic/show-leds) and make your code look like this:
|
||||
|
||||
```blocks
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .`);
|
||||
. # . # .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .`
|
||||
);
|
||||
```
|
||||
|
||||
## Step 2
|
||||
@ -42,11 +44,11 @@ Add a [pause](/reference/basic/pause) to wait and [clear screen](/reference/basi
|
||||
|
||||
```blocks
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .`);
|
||||
. # . # .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .`);
|
||||
basic.pause(500);
|
||||
basic.clearScreen();
|
||||
```
|
||||
@ -58,11 +60,12 @@ Put a [forever loop](/reference/basic/forever) around it.
|
||||
```blocks
|
||||
basic.forever(() => {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .`);
|
||||
. # . # .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .`
|
||||
);
|
||||
basic.pause(500);
|
||||
basic.clearScreen();
|
||||
})
|
||||
@ -75,11 +78,12 @@ Add a [pause](/reference/basic/pause) to wait after clearing the screen.
|
||||
```blocks
|
||||
basic.forever(() => {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .`);
|
||||
. # . # .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .`
|
||||
);
|
||||
basic.pause(500);
|
||||
basic.clearScreen();
|
||||
basic.pause(500);
|
||||
@ -94,20 +98,22 @@ Add a second image of a broken heart.
|
||||
```blocks
|
||||
basic.forever(() => {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .`);
|
||||
. # . # .
|
||||
# # # # #
|
||||
# # # # #
|
||||
. # # # .
|
||||
. . # . .`
|
||||
);
|
||||
basic.pause(500);
|
||||
basic.clearScreen();
|
||||
basic.pause(500);
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
# . # # #
|
||||
# . . . #
|
||||
. # # # .
|
||||
. . # . .`);
|
||||
. # . # .
|
||||
# . # # #
|
||||
# . . . #
|
||||
. # # # .
|
||||
. . # . .`
|
||||
);
|
||||
basic.pause(500);
|
||||
basic.clearScreen();
|
||||
basic.pause(500);
|
||||
|
@ -24,6 +24,12 @@ Build your own music player micro:bit from headphones.
|
||||
* [Connect your headphone](/projects/hack-your-headphone/making)
|
||||
* [Play sounds!]()
|
||||
|
||||
# ~hint
|
||||
|
||||
**No crocodile clips!?!?!** Use wires or Aluminium foil! [Read more...](/device/foil-circuits)
|
||||
|
||||
# ~
|
||||
|
||||
### ~button /projects/hack-your-headphones/making
|
||||
|
||||
Let's get started!
|
||||
|
@ -6,6 +6,12 @@ Did you know you could attach your headhpones to the micro:bit to generate sound
|
||||
|
||||
### ~
|
||||
|
||||
# ~hint
|
||||
|
||||
**No crocodile clips!?!?!** Use wires or Aluminium foil! [Read more...](/device/foil-circuits)
|
||||
|
||||
# ~
|
||||
|
||||
### Step 1
|
||||
|
||||

|
||||
|
@ -10,11 +10,12 @@ Use [show leds](/reference/basic/show-leds) to make a smiley face:
|
||||
|
||||
```blocks
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
. # . # .
|
||||
. . . . .
|
||||
# . . . #
|
||||
. # # # .`);
|
||||
. # . # .
|
||||
. # . # .
|
||||
. . . . .
|
||||
# . . . #
|
||||
. # # # .`
|
||||
);
|
||||
```
|
||||
|
||||
## Step 2
|
||||
@ -24,18 +25,20 @@ frowny face inside it:
|
||||
|
||||
```blocks
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
. # . # .
|
||||
. . . . .
|
||||
# . . . #
|
||||
. # # # .`);
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
. # . # .
|
||||
. . . . .
|
||||
. # # # .
|
||||
# . . . #`);
|
||||
# . . . #
|
||||
. # # # .`
|
||||
);
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
. # . # .
|
||||
. . . . .
|
||||
. # # # .
|
||||
# . . . #`
|
||||
);
|
||||
});
|
||||
```
|
||||
|
||||
@ -45,25 +48,28 @@ Now add blocks so that when [button B is pressed](/reference/input/button-is-pre
|
||||
|
||||
```blocks
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
. # . # .
|
||||
. . . . .
|
||||
# . . . #
|
||||
. # # # .`);
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
. # . # .
|
||||
. . . . .
|
||||
. # # # .
|
||||
# . . . #`);
|
||||
});
|
||||
input.onButtonPressed(Button.B, () => {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
. # . # .
|
||||
. . . . .
|
||||
# . . . #
|
||||
. # # # .`);
|
||||
. # # # .`
|
||||
);
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
. # . # .
|
||||
. . . . .
|
||||
. # # # .
|
||||
# . . . #`
|
||||
);
|
||||
});
|
||||
input.onButtonPressed(Button.B, () => {
|
||||
basic.showLeds(`
|
||||
. # . # .
|
||||
. # . # .
|
||||
. . . . .
|
||||
# . . . #
|
||||
. # # # .`
|
||||
);
|
||||
});
|
||||
```
|
||||
|
BIN
docs/static/mb/device/croc-clips/badclamp.jpg
vendored
Normal file
After Width: | Height: | Size: 35 KiB |
BIN
docs/static/mb/device/croc-clips/crocclipsclamped.jpg
vendored
Normal file
After Width: | Height: | Size: 91 KiB |
BIN
docs/static/mb/device/croc-clips/foilcircuit.jpg
vendored
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
docs/static/mb/device/croc-clips/foilcut.jpg
vendored
Normal file
After Width: | Height: | Size: 79 KiB |
BIN
docs/static/mb/device/croc-clips/frontclamp.jpg
vendored
Normal file
After Width: | Height: | Size: 93 KiB |
BIN
docs/static/mb/device/croc-clips/groundconnected.jpg
vendored
Normal file
After Width: | Height: | Size: 61 KiB |
BIN
docs/static/mb/device/croc-clips/jackconnect.jpg
vendored
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
docs/static/mb/device/croc-clips/jackground.jpg
vendored
Normal file
After Width: | Height: | Size: 47 KiB |
BIN
docs/static/mb/device/croc-clips/microbitattached.jpg
vendored
Normal file
After Width: | Height: | Size: 85 KiB |
BIN
docs/static/mb/device/croc-clips/microbitconnect.jpg
vendored
Normal file
After Width: | Height: | Size: 66 KiB |
BIN
docs/static/mb/device/croc-clips/sideclamp.jpg
vendored
Normal file
After Width: | Height: | Size: 34 KiB |
42
libs/calliope-test/calliope.ts
Normal file
@ -0,0 +1,42 @@
|
||||
basic.showString("RGB")
|
||||
basic.setLedColor(Colors.Blue)
|
||||
basic.pause(500)
|
||||
basic.setLedColor(Colors.Red)
|
||||
basic.pause(500)
|
||||
basic.setLedColor(Colors.Green)
|
||||
basic.pause(500)
|
||||
basic.setLedColor(Colors.Violet)
|
||||
basic.pause(500)
|
||||
basic.setLedColor(0);
|
||||
basic.showString("Gesten")
|
||||
input.onGesture(Gesture.Shake, () => {
|
||||
basic.showString("S")
|
||||
})
|
||||
input.onGesture(Gesture.LogoUp, () => {
|
||||
basic.showString("U")
|
||||
})
|
||||
input.onGesture(Gesture.LogoDown, () => {
|
||||
basic.showString("D")
|
||||
})
|
||||
input.onGesture(Gesture.ScreenUp, () => {
|
||||
basic.showString("+")
|
||||
})
|
||||
input.onGesture(Gesture.TiltRight, () => {
|
||||
basic.showString("R")
|
||||
})
|
||||
input.onGesture(Gesture.FreeFall, () => {
|
||||
basic.showString("F")
|
||||
})
|
||||
input.onGesture(Gesture.ScreenDown, () => {
|
||||
basic.showString("-")
|
||||
})
|
||||
input.onGesture(Gesture.TiltLeft, () => {
|
||||
basic.showString("L")
|
||||
})
|
||||
input.onGesture(Gesture.ThreeG, () => {
|
||||
basic.showString("3")
|
||||
})
|
||||
input.onGesture(Gesture.SixG, () => {
|
||||
basic.showString("6")
|
||||
})
|
||||
|
11
libs/calliope-test/pxt.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "calliope",
|
||||
"description": "Test of Calliope Parts",
|
||||
"files": [
|
||||
"calliope.ts"
|
||||
],
|
||||
"public": true,
|
||||
"dependencies": {
|
||||
"core": "file:../core"
|
||||
}
|
||||
}
|
80
libs/core/_locales/ja/core-strings.json
Normal file
@ -0,0 +1,80 @@
|
||||
{
|
||||
"Math.randomBoolean|block": "pick random true or false",
|
||||
"Math|block": "Math",
|
||||
"String.fromCharCode|block": "text from char code %code",
|
||||
"String|block": "String",
|
||||
"basic.clearScreen|block": "clear screen",
|
||||
"basic.forever|block": "forever",
|
||||
"basic.pause|block": "pause (ms) %pause",
|
||||
"basic.showLeds|block": "show leds",
|
||||
"basic.showNumber|block": "show|number %number",
|
||||
"basic.showString|block": "show|string %text",
|
||||
"basic|block": "basic",
|
||||
"control.inBackground|block": "run in background",
|
||||
"control.reset|block": "reset",
|
||||
"control.waitMicros|block": "wait (µs)%micros",
|
||||
"control|block": "control",
|
||||
"game.addScore|block": "change score by|%points",
|
||||
"game.gameOver|block": "game over",
|
||||
"game.score|block": "score",
|
||||
"game.startCountdown|block": "start countdown|(ms) %duration",
|
||||
"game|block": "game",
|
||||
"images.createBigImage|block": "create big image",
|
||||
"images.createImage|block": "create image",
|
||||
"images|block": "images",
|
||||
"input.acceleration|block": "acceleration (mg)|%NAME",
|
||||
"input.buttonIsPressed|block": "button|%NAME|is pressed",
|
||||
"input.compassHeading|block": "compass heading (°)",
|
||||
"input.lightLevel|block": "light level",
|
||||
"input.magneticForce|block": "magnetic force (µT)|%NAME",
|
||||
"input.onButtonPressed|block": "on button|%NAME|pressed",
|
||||
"input.onGesture|block": "on |%NAME",
|
||||
"input.onPinPressed|block": "on pin %NAME|pressed",
|
||||
"input.onPinReleased|block": "on pin %NAME|released",
|
||||
"input.pinIsPressed|block": "pin %NAME|is pressed",
|
||||
"input.rotation|block": "rotation (°)|%NAME",
|
||||
"input.runningTime|block": "running time (ms)",
|
||||
"input.setAccelerometerRange|block": "set accelerometer|range %range",
|
||||
"input.temperature|block": "temperature (°C)",
|
||||
"input|block": "input",
|
||||
"led.brightness|block": "brightness",
|
||||
"led.plotBarGraph|block": "plot bar graph of %value |up to %high",
|
||||
"led.plot|block": "plot|x %x|y %y",
|
||||
"led.point|block": "point|x %x|y %y",
|
||||
"led.setBrightness|block": "set brightness %value",
|
||||
"led.stopAnimation|block": "stop animation",
|
||||
"led.toggle|block": "toggle|x %x|y %y",
|
||||
"led.unplot|block": "unplot|x %x|y %y",
|
||||
"led|block": "led",
|
||||
"music.beat|block": "%fraction|beat",
|
||||
"music.changeTempoBy|block": "change tempo by (bpm)|%value",
|
||||
"music.noteFrequency|block": "%note",
|
||||
"music.playTone|block": "play|tone %note=device_note|for %duration=device_beat",
|
||||
"music.rest|block": "rest(ms)|%duration=device_beat",
|
||||
"music.ringTone|block": "ring tone (Hz)|%note=device_note",
|
||||
"music.setTempo|block": "set tempo to (bpm)|%value",
|
||||
"music.tempo|block": "tempo (bpm)",
|
||||
"music|block": "music",
|
||||
"pins.analogReadPin|block": "analog read|pin %name",
|
||||
"pins.analogSetPeriod|block": "analog set period|pin %pin|to (µs)%micros",
|
||||
"pins.analogWritePin|block": "analog write|pin %name|to %value",
|
||||
"pins.digitalReadPin|block": "digital read|pin %name",
|
||||
"pins.digitalWritePin|block": "digital write|pin %name|to %value",
|
||||
"pins.i2cReadNumber|block": "i2c read number|at address %address|of format %format=i2c_sizeof",
|
||||
"pins.i2cWriteNumber|block": "i2c write number|at address %address|with value %value|of format %format=i2c_sizeof",
|
||||
"pins.map|block": "map %value|from low %fromLow|from high %fromHigh|to low %toLow|to high %toHigh",
|
||||
"pins.onPulsed|block": "on|pin %pin|pulsed %pulse",
|
||||
"pins.pulseDuration|block": "pulse duration (µs)",
|
||||
"pins.servoSetPulse|block": "servo set pulse|pin %value|to (µs) %micros",
|
||||
"pins.servoWritePin|block": "servo write|pin %name|to %value",
|
||||
"pins.setPull|block": "set pull|pin %pin|to %pull",
|
||||
"pins.spiWrite|block": "spi write %value",
|
||||
"pins|block": "pins",
|
||||
"serial.readLine|block": "serial read line",
|
||||
"serial.redirect|block": "serial redirect to|TX %tx|RX %rx|at baud rate %rate",
|
||||
"serial.writeLine|block": "serial|write line %text",
|
||||
"serial.writeNumber|block": "serial|write number %value",
|
||||
"serial.writeString|block": "serial write string %text",
|
||||
"serial.writeValue|block": "serial|write value %name|= %value",
|
||||
"serial|block": "serial"
|
||||
}
|
1
libs/core/dal.d.ts
vendored
@ -426,6 +426,7 @@ declare const enum DAL {
|
||||
MICROBIT_ACCELEROMETER_TILT_TOLERANCE = 200,
|
||||
MICROBIT_ACCELEROMETER_FREEFALL_TOLERANCE = 400,
|
||||
MICROBIT_ACCELEROMETER_SHAKE_TOLERANCE = 400,
|
||||
MICROBIT_ACCELEROMETER_2G_TOLERANCE = 2048,
|
||||
MICROBIT_ACCELEROMETER_3G_TOLERANCE = 3072,
|
||||
MICROBIT_ACCELEROMETER_6G_TOLERANCE = 6144,
|
||||
MICROBIT_ACCELEROMETER_8G_TOLERANCE = 8192,
|
||||
|
@ -130,7 +130,7 @@ namespace input {
|
||||
//% parts="accelerometer"
|
||||
void onGesture(Gesture gesture, Action body) {
|
||||
if ((int)gesture == MICROBIT_ACCELEROMETER_EVT_3G && uBit.accelerometer.getRange() < 3)
|
||||
uBit.accelerometer.setRange(4);
|
||||
uBit.accelerometer.setRange(6);
|
||||
else if ((int)gesture == MICROBIT_ACCELEROMETER_EVT_6G && uBit.accelerometer.getRange() < 6)
|
||||
uBit.accelerometer.setRange(8);
|
||||
registerWithDal(MICROBIT_ID_GESTURE, (int)gesture, body);
|
||||
|
@ -33,7 +33,9 @@
|
||||
"parts/speaker.svg",
|
||||
"parts/headphone.svg",
|
||||
"parts/dcmotor.svg",
|
||||
"_locales/fr/microbit-jsdoc-strings.json"
|
||||
"_locales/ja/core-jsdoc-strings.json",
|
||||
"_locales/ja/core-strings.json",
|
||||
"_locales/fr/core-jsdoc-strings.json"
|
||||
],
|
||||
"public": true,
|
||||
"dependencies": {},
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pxt-calliope",
|
||||
"version": "0.5.16",
|
||||
"version": "0.5.23",
|
||||
"description": "calliope target for PXT",
|
||||
"keywords": [
|
||||
"JavaScript",
|
||||
@ -29,6 +29,6 @@
|
||||
"typescript": "^1.8.7"
|
||||
},
|
||||
"dependencies": {
|
||||
"pxt-core": "0.4.58"
|
||||
"pxt-core": "0.4.63"
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +202,7 @@
|
||||
"yottaTarget": "bbc-microbit-classic-gcc",
|
||||
"yottaCorePackage": "pxt-calliope-core",
|
||||
"githubCorePackage": "microsoft/pxt-calliope-core",
|
||||
"gittag": "v0.5.10",
|
||||
"gittag": "v0.5.11",
|
||||
"serviceId": "calliope"
|
||||
},
|
||||
"serial": {
|
||||
@ -252,7 +252,7 @@
|
||||
"path": "/browsers/windows"
|
||||
}
|
||||
],
|
||||
"boardName": "BBC micro:bit",
|
||||
"boardName": "Calliope MINI",
|
||||
"docMenu": [
|
||||
{
|
||||
"name": "Getting Started",
|
||||
|
@ -987,7 +987,7 @@ namespace pxsim.visuals {
|
||||
"C16, Serial - RX", "C17, Serial - TX", "+3v3", "GND"
|
||||
];
|
||||
const MB_WIDTH = 251.8;
|
||||
const MB_HEIGHT = 222.2;
|
||||
const MB_HEIGHT = 222.2;
|
||||
export interface IBoardTheme {
|
||||
accent?: string;
|
||||
display?: string;
|
||||
@ -1059,8 +1059,205 @@ namespace pxsim.visuals {
|
||||
private thermometerText: SVGTextElement;
|
||||
private shakeButton: SVGElement;
|
||||
public board: pxsim.DalBoard;
|
||||
private pinNmToCoord: Map<Coord>;
|
||||
private rgbLed: SVGElement;
|
||||
private pinNmToCoord: Map<Coord> = {
|
||||
"EXT_PWR": [
|
||||
92.30997467041016,
|
||||
-42.92474937438965
|
||||
],
|
||||
"SPKR": [
|
||||
106.44635391235352,
|
||||
-16.370698928833008
|
||||
],
|
||||
"BTN_A": [
|
||||
93.8138427734375,
|
||||
56.631452560424805
|
||||
],
|
||||
"BTN_B": [
|
||||
204.92835235595703,
|
||||
56.631452560424805
|
||||
],
|
||||
"EDGE_P0": [
|
||||
56.002254486083984,
|
||||
95.43130111694336
|
||||
],
|
||||
"EDGE_P1": [
|
||||
103.00893783569336,
|
||||
175.82388305664062
|
||||
],
|
||||
"EDGE_P2": [
|
||||
195.90512084960938,
|
||||
175.3082733154297
|
||||
],
|
||||
"EDGE_P3": [
|
||||
241.79466247558594,
|
||||
95.3883285522461
|
||||
],
|
||||
"EDGE_GND": [
|
||||
103.00893783569336,
|
||||
14.86682915687561
|
||||
],
|
||||
"EDGE_VCC": [
|
||||
195.64733123779297,
|
||||
14.86682915687561
|
||||
],
|
||||
"C_GND1": [
|
||||
113.1493148803711,
|
||||
159.83989715576172
|
||||
],
|
||||
"C_GND2": [
|
||||
150.27342987060547,
|
||||
159.83989715576172
|
||||
],
|
||||
"C_GND3": [
|
||||
150.27342987060547,
|
||||
153.5666275024414
|
||||
],
|
||||
"C_GND4": [
|
||||
187.39752960205078,
|
||||
153.5666275024414
|
||||
],
|
||||
"C_VCC1": [
|
||||
187.39752960205078,
|
||||
159.83989715576172
|
||||
],
|
||||
"C_VCC2": [
|
||||
113.1922836303711,
|
||||
153.5666275024414
|
||||
],
|
||||
"C_P0": [
|
||||
119.33667373657227,
|
||||
159.83989715576172
|
||||
],
|
||||
"C_P2": [
|
||||
125.52401733398438,
|
||||
159.83989715576172
|
||||
],
|
||||
"C_P4": [
|
||||
131.71136474609375,
|
||||
159.83989715576172
|
||||
],
|
||||
"C_P6": [
|
||||
137.89871978759766,
|
||||
159.83989715576172
|
||||
],
|
||||
"C_P8": [
|
||||
144.08607482910156,
|
||||
159.83989715576172
|
||||
],
|
||||
"C_P10": [
|
||||
156.46077728271484,
|
||||
159.83989715576172
|
||||
],
|
||||
"C_P12": [
|
||||
162.64812469482422,
|
||||
159.83989715576172
|
||||
],
|
||||
"C_P14": [
|
||||
168.83545684814453,
|
||||
159.83989715576172
|
||||
],
|
||||
"C_P16": [
|
||||
175.02281951904297,
|
||||
159.83989715576172
|
||||
],
|
||||
"C_P20": [
|
||||
181.2101821899414,
|
||||
159.83989715576172
|
||||
],
|
||||
"C_P1": [
|
||||
119.379638671875,
|
||||
153.5666275024414
|
||||
],
|
||||
"C_P22": [
|
||||
125.56698226928711,
|
||||
153.5666275024414
|
||||
],
|
||||
"C_P5": [
|
||||
131.71136474609375,
|
||||
153.5666275024414
|
||||
],
|
||||
"C_P7": [
|
||||
137.89871978759766,
|
||||
153.5666275024414
|
||||
],
|
||||
"C_P9": [
|
||||
144.08607482910156,
|
||||
153.5666275024414
|
||||
],
|
||||
"C_P11": [
|
||||
156.46077728271484,
|
||||
153.5666275024414
|
||||
],
|
||||
"C_P13": [
|
||||
162.64812469482422,
|
||||
153.5666275024414
|
||||
],
|
||||
"C_P15": [
|
||||
168.83545684814453,
|
||||
153.5666275024414
|
||||
],
|
||||
"C_P21": [
|
||||
175.02281951904297,
|
||||
153.5666275024414
|
||||
],
|
||||
"C_P19": [
|
||||
181.2101821899414,
|
||||
153.5666275024414
|
||||
],
|
||||
"M_GND1": [
|
||||
137.89871978759766,
|
||||
141.70752716064453
|
||||
],
|
||||
"M_GND2": [
|
||||
156.46077728271484,
|
||||
141.70752716064453
|
||||
],
|
||||
"M_OUT1": [
|
||||
144.08607482910156,
|
||||
141.70752716064453
|
||||
],
|
||||
"M_OUT2": [
|
||||
150.27342987060547,
|
||||
141.70752716064453
|
||||
],
|
||||
"M_VM": [
|
||||
162.64812469482422,
|
||||
141.70752716064453
|
||||
],
|
||||
"G_A0_GND": [
|
||||
82.47036743164062,
|
||||
72.35763549804688
|
||||
],
|
||||
"G_A0_VCC": [
|
||||
78.34546279907227,
|
||||
76.3106689453125
|
||||
],
|
||||
"G_A0_SDA": [
|
||||
74.65023803710938,
|
||||
80.00588989257812
|
||||
],
|
||||
"G_A0_SCL": [
|
||||
70.43940734863281,
|
||||
84.21672821044922
|
||||
],
|
||||
"G_A1_RX": [
|
||||
216.52963256835938,
|
||||
71.4982795715332
|
||||
],
|
||||
"G_A1_TX": [
|
||||
220.65453338623047,
|
||||
75.53724670410156
|
||||
],
|
||||
"G_A1_VCC": [
|
||||
224.34976959228516,
|
||||
79.23247528076172
|
||||
],
|
||||
"G_A1_GND": [
|
||||
228.56060028076172,
|
||||
83.44330978393555
|
||||
]
|
||||
};
|
||||
|
||||
constructor(public props: IBoardProps) {
|
||||
this.buildDom();
|
||||
@ -1089,7 +1286,6 @@ namespace pxsim.visuals {
|
||||
}
|
||||
|
||||
public getCoord(pinNm: string): Coord {
|
||||
if (!this.pinNmToCoord) this.recordPinCoords();
|
||||
return this.pinNmToCoord[pinNm];
|
||||
}
|
||||
|
||||
@ -1101,14 +1297,13 @@ namespace pxsim.visuals {
|
||||
return 10;
|
||||
}
|
||||
|
||||
public recordPinCoords() {
|
||||
this.pinNmToCoord = {};
|
||||
pinNames.forEach((nm,i) => {
|
||||
// TODO: position pins from SVG
|
||||
private recordPinCoords() {
|
||||
pinNames.forEach((nm, i) => {
|
||||
const p = this.pins[i];
|
||||
const r = p.getBoundingClientRect();
|
||||
this.pinNmToCoord[nm] = [r.left + r.width / 2, r.top + r.height / 2];
|
||||
});
|
||||
console.log(JSON.stringify(this.pinNmToCoord, null, 2))
|
||||
}
|
||||
|
||||
private updateTheme() {
|
||||
@ -1168,7 +1363,7 @@ namespace pxsim.visuals {
|
||||
const g = (c >> 8) & 0xFF;
|
||||
const r = (c >> 16) & 0xFF;
|
||||
const w = (c >> 24) & 0xFF;
|
||||
const ch = `rgba(${r}, ${g}, ${b}, 1)`;
|
||||
const ch = `rgba(${r}, ${g}, ${b}, 1)`;
|
||||
svg.fill(this.rgbLed, ch);
|
||||
} else if (this.rgbLed) {
|
||||
svg.fill(this.rgbLed, 'white');
|
||||
@ -1246,8 +1441,10 @@ namespace pxsim.visuals {
|
||||
rx: 5, ry: 5,
|
||||
fill: `url(#${gid})`
|
||||
});
|
||||
this.thermometerText = svg.child(this.g, "text", { class: 'sim-text',
|
||||
x: 100, y: MB_HEIGHT - 174 }) as SVGTextElement;
|
||||
this.thermometerText = svg.child(this.g, "text", {
|
||||
class: 'sim-text',
|
||||
x: 100, y: MB_HEIGHT - 174
|
||||
}) as SVGTextElement;
|
||||
this.updateTheme();
|
||||
|
||||
let pt = this.element.createSVGPoint();
|
||||
@ -1356,7 +1553,7 @@ namespace pxsim.visuals {
|
||||
}
|
||||
}, ev => { },
|
||||
ev => { })
|
||||
this.lightLevelText = svg.child(this.g, "text", { x: cx-r-7, y: cy + r + 8, text: '', class: 'sim-text inverted' }) as SVGTextElement;
|
||||
this.lightLevelText = svg.child(this.g, "text", { x: cx - r - 7, y: cy + r + 8, text: '', class: 'sim-text inverted' }) as SVGTextElement;
|
||||
this.updateTheme();
|
||||
}
|
||||
|
||||
|