Compare commits
68 Commits
Author | SHA1 | Date | |
---|---|---|---|
4d9dbb8a66 | |||
28aa7d451f | |||
7618996c0e | |||
be5c478d9f | |||
80cc438fa8 | |||
8080cb2bfd | |||
82c1717c4c | |||
d46748cd5a | |||
d4197e2eb1 | |||
1514458823 | |||
da72b09750 | |||
437ebb4fad | |||
b7c8709424 | |||
2325ffcd76 | |||
a02476f025 | |||
7d35519ca8 | |||
a45d46d4b4 | |||
176771abfb | |||
9db2687985 | |||
910987fcea | |||
7c8c35a326 | |||
7ad9a1cab8 | |||
97ba83f660 | |||
d69bd0e0e4 | |||
3e46d4c615 | |||
2a3f2d4b11 | |||
d9b3f2fbef | |||
978e0fd765 | |||
00b4e8dc01 | |||
7a8f540b27 | |||
f04222fecb | |||
ede7c8b29b | |||
3dffd14abb | |||
fbf653834e | |||
166014bd92 | |||
3811461274 | |||
dbd3837dba | |||
db79634446 | |||
7f710c7d78 | |||
ce8bd38cb7 | |||
56dc85e6ff | |||
60f921c173 | |||
28fc309a64 | |||
e28cd3c3c6 | |||
4d2981489d | |||
f7f9a29e55 | |||
be88603d57 | |||
0dc9f53e30 | |||
9cb426e060 | |||
38c60710d1 | |||
5c62e5d697 | |||
63268c61a8 | |||
0c0c1cdd73 | |||
3d70526d05 | |||
cf1b85f85b | |||
1f7ad1f114 | |||
b1d8ab0206 | |||
8bfa79fd15 | |||
991aa40f19 | |||
279f72c800 | |||
2420a7c781 | |||
7f134f330d | |||
a91c28bd56 | |||
a5aca0dfcf | |||
b1fd48882c | |||
a34004c14a | |||
7730b7c18f | |||
9b2fdabdcc |
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"appref": "v"
|
"appref": "v0"
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"appref": "v0.8.2"
|
"appref": "v0.8.30"
|
||||||
}
|
}
|
||||||
|
30
docs/reference/pins/set-events.md
Normal file
30
docs/reference/pins/set-events.md
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# Set Events
|
||||||
|
|
||||||
|
Configure the type of events emitted by a given pin.
|
||||||
|
|
||||||
|
```sig
|
||||||
|
pins.setEvents(DigitalPin.P0, PinEventType.Edge);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
* ``name``: The @boardname@ hardware pin to configure (``P0`` through ``P20``)
|
||||||
|
* ``type``: The type of events this pin should emit
|
||||||
|
|
||||||
|
### Example
|
||||||
|
|
||||||
|
The following example configures pin ``P0`` and then
|
||||||
|
subscribes to the rise and fall events.
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
control.onEvent(control.eventSourceId(EventBusSource.MICROBIT_ID_IO_P0), control.eventValueId(EventBusValue.MICROBIT_PIN_EVT_RISE), () => {
|
||||||
|
basic.showString("Rise")
|
||||||
|
})
|
||||||
|
control.onEvent(control.eventSourceId(EventBusSource.MICROBIT_ID_IO_P0), control.eventValueId(EventBusValue.MICROBIT_PIN_EVT_FALL), () => {
|
||||||
|
basic.showString("Fall")
|
||||||
|
})
|
||||||
|
pins.setEvents(DigitalPin.P0, PinEventType.Edge)
|
||||||
|
```
|
||||||
|
|
||||||
|
**This is an advanced API.** For more information, see the
|
||||||
|
[@boardname@ runtime messageBus documentation](https://lancaster-university.github.io/microbit-docs/ubit/messageBus/)
|
BIN
docs/static/Microsoft-logo_rgb_c-gray-square.png
vendored
Normal file
BIN
docs/static/Microsoft-logo_rgb_c-gray-square.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
@ -8,6 +8,7 @@ def branch = GithubBranchName
|
|||||||
def newJobName = InternalUtilities.getFullJobName(project, "Default", isPR)
|
def newJobName = InternalUtilities.getFullJobName(project, "Default", isPR)
|
||||||
def newJob = job(newJobName) {
|
def newJob = job(newJobName) {
|
||||||
steps {
|
steps {
|
||||||
|
shell("chmod +x ./jenkins.sh")
|
||||||
shell("./jenkins.sh ${isPR}")
|
shell("./jenkins.sh ${isPR}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ echo isPR: $1
|
|||||||
|
|
||||||
originRegex="^origin/.*"
|
originRegex="^origin/.*"
|
||||||
branchRegex="^origin/\K.*(?=$)"
|
branchRegex="^origin/\K.*(?=$)"
|
||||||
|
releaseBranchRegex = "^(master|v\d+)$"
|
||||||
|
|
||||||
if [[ "$GIT_BRANCH" =~ $originRegex ]]; then
|
if [[ "$GIT_BRANCH" =~ $originRegex ]]; then
|
||||||
branchName=$(echo ${GIT_BRANCH} | grep -oP $branchRegex)
|
branchName=$(echo ${GIT_BRANCH} | grep -oP $branchRegex)
|
||||||
@ -27,7 +28,7 @@ if [ "$1" == "false" ]; then
|
|||||||
echo Setting TRAVIS_PULL_REQUEST to false
|
echo Setting TRAVIS_PULL_REQUEST to false
|
||||||
export TRAVIS_PULL_REQUEST=false
|
export TRAVIS_PULL_REQUEST=false
|
||||||
|
|
||||||
if [ $TRAVIS_BRANCH == "master" ]; then
|
if [[ "$TRAVIS_BRANCH" =~ $releaseBranchRegex ]]; then
|
||||||
if [[ -z $PXT_RELEASE_REPO ]]; then
|
if [[ -z $PXT_RELEASE_REPO ]]; then
|
||||||
echo Cannot find release repo; skipping tag checks
|
echo Cannot find release repo; skipping tag checks
|
||||||
else
|
else
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
{
|
{
|
||||||
|
"bluetooth": "Unterstützung für zusätzliche Bluetooth-Dienste.",
|
||||||
|
"bluetooth.onBluetoothConnected|param|body": "Code, der ausgeführt wird, wenn eine Bluetooth-Verbindung aufgebaut wurde",
|
||||||
"bluetooth.uartWriteNumber": "Gibt einen numerischen Wert an die serielle",
|
"bluetooth.uartWriteNumber": "Gibt einen numerischen Wert an die serielle",
|
||||||
"bluetooth.uartWriteValue": "Schreibt ein ``Namen: Wert`` Wertepaar auf die serielle Schnittstelle.",
|
"bluetooth.uartWriteValue": "Schreibt ein ``Namen: Wert`` Wertepaar auf die serielle Schnittstelle.",
|
||||||
"bluetooth.uartWriteValue|param|name": "Name des Wertestreams, z.B.: x",
|
"bluetooth.uartWriteValue|param|name": "Name des Wertestreams, z.B.: x",
|
||||||
|
23
libs/calliope-i2c/i2c.ts
Normal file
23
libs/calliope-i2c/i2c.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import rgbw = basic.rgbw;
|
||||||
|
serial.writeLine("I2C");
|
||||||
|
// send to 0x44, register 0x00, value 0x46 (RESET ISL29125)
|
||||||
|
pins.i2cWriteNumber(0x44, 0x0046, NumberFormat.UInt16BE);
|
||||||
|
// send to 0x44, register 0x01, value 0x05 (GRB SAMPLING)
|
||||||
|
pins.i2cWriteNumber(0x44, 0x0105, NumberFormat.UInt16BE);
|
||||||
|
basic.forever(() => {
|
||||||
|
serial.writeString("[");
|
||||||
|
pins.i2cWriteNumber(0x44, 0x0A, NumberFormat.Int8BE);
|
||||||
|
let g = pins.i2cReadNumber(0x44, NumberFormat.UInt8BE);
|
||||||
|
serial.writeNumber(r);
|
||||||
|
serial.writeString(",");
|
||||||
|
pins.i2cWriteNumber(0x44, 0x0C, NumberFormat.UInt8BE);
|
||||||
|
let r = pins.i2cReadNumber(0x44, NumberFormat.UInt8BE);
|
||||||
|
serial.writeNumber(g);
|
||||||
|
serial.writeString(",");
|
||||||
|
pins.i2cWriteNumber(0x44, 0x0E, NumberFormat.UInt8BE);
|
||||||
|
let b = pins.i2cReadNumber(0x44, NumberFormat.UInt8LE);
|
||||||
|
serial.writeNumber(b);
|
||||||
|
serial.writeLine("]");
|
||||||
|
basic.setLedColor(basic.rgbw(r,g,b, 0));
|
||||||
|
basic.pause(1000);
|
||||||
|
});
|
11
libs/calliope-i2c/pxt.json
Normal file
11
libs/calliope-i2c/pxt.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "calliope-i2c",
|
||||||
|
"description": "Calliope I2C test",
|
||||||
|
"files": [
|
||||||
|
"i2c.ts"
|
||||||
|
],
|
||||||
|
"public": true,
|
||||||
|
"dependencies": {
|
||||||
|
"core": "file:../core"
|
||||||
|
}
|
||||||
|
}
|
23
libs/calliope-midi/midi.ts
Normal file
23
libs/calliope-midi/midi.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
serial.redirect(
|
||||||
|
SerialPin.P0,
|
||||||
|
SerialPin.P1,
|
||||||
|
31250
|
||||||
|
);
|
||||||
|
|
||||||
|
basic.forever(() => {
|
||||||
|
for (let note = 0; note <= 90 - 1; note++) {
|
||||||
|
// Note on channel 1 (0x90), some note value (note),
|
||||||
|
// middle velocity (0x45):
|
||||||
|
serial.writeString(String.fromCharCode(144));
|
||||||
|
serial.writeString(String.fromCharCode(note));
|
||||||
|
serial.writeString(String.fromCharCode(69));
|
||||||
|
basic.pause(100);
|
||||||
|
// Note on channel 1 (0x90), some note value (note),
|
||||||
|
// silent velocity (0x00):
|
||||||
|
serial.writeString(String.fromCharCode(144));
|
||||||
|
serial.writeString(String.fromCharCode(note));
|
||||||
|
serial.writeString("\0");
|
||||||
|
basic.pause(100);
|
||||||
|
basic.pause(1000);
|
||||||
|
}
|
||||||
|
});
|
11
libs/calliope-midi/pxt.json
Normal file
11
libs/calliope-midi/pxt.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "midi",
|
||||||
|
"description": "MIDI Example via Serial",
|
||||||
|
"files": [
|
||||||
|
"midi.ts"
|
||||||
|
],
|
||||||
|
"public": true,
|
||||||
|
"dependencies": {
|
||||||
|
"core": "file:../core"
|
||||||
|
}
|
||||||
|
}
|
@ -180,6 +180,7 @@
|
|||||||
"music.noteFrequency": "Gets the frequency of a note.",
|
"music.noteFrequency": "Gets the frequency of a note.",
|
||||||
"music.noteFrequency|param|name": "the note name",
|
"music.noteFrequency|param|name": "the note name",
|
||||||
"music.playTone": "Plays a tone through ``speaker`` for the given duration.",
|
"music.playTone": "Plays a tone through ``speaker`` for the given duration.",
|
||||||
|
"music.playTone|param|frequency": "pitch of the tone to play in Hertz (Hz)",
|
||||||
"music.playTone|param|ms": "tone duration in milliseconds (ms)",
|
"music.playTone|param|ms": "tone duration in milliseconds (ms)",
|
||||||
"music.rest": "Rests (plays nothing) for a specified time through pin ``P0``.",
|
"music.rest": "Rests (plays nothing) for a specified time through pin ``P0``.",
|
||||||
"music.rest|param|ms": "rest duration in milliseconds (ms)",
|
"music.rest|param|ms": "rest duration in milliseconds (ms)",
|
||||||
@ -230,6 +231,9 @@
|
|||||||
"pins.servoWritePin": "Writes a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).",
|
"pins.servoWritePin": "Writes a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with ``0`` being full-speed in one direction, ``180`` being full speed in the other, and a value near ``90`` being no movement).",
|
||||||
"pins.servoWritePin|param|name": "pin to write to",
|
"pins.servoWritePin|param|name": "pin to write to",
|
||||||
"pins.servoWritePin|param|value": "angle or rotation speed, eg:180,90,0",
|
"pins.servoWritePin|param|value": "angle or rotation speed, eg:180,90,0",
|
||||||
|
"pins.setEvents": "Configures the events emitted by this pin. Events can be subscribed to\nusing ``control.onEvent()``.",
|
||||||
|
"pins.setEvents|param|name": "pin to set the event mode on, eg: DigitalPin.P0",
|
||||||
|
"pins.setEvents|param|type": "the type of events for this pin to emit, eg: PinEventType.Edge",
|
||||||
"pins.setPull": "Configures the pull of this pin.",
|
"pins.setPull": "Configures the pull of this pin.",
|
||||||
"pins.setPull|param|name": "pin to set the pull mode on",
|
"pins.setPull|param|name": "pin to set the pull mode on",
|
||||||
"pins.setPull|param|pull": "one of the mbed pull configurations: PullUp, PullDown, PullNone ",
|
"pins.setPull|param|pull": "one of the mbed pull configurations: PullUp, PullDown, PullNone ",
|
||||||
@ -245,8 +249,9 @@
|
|||||||
"serial.readUntil": "Reads a line of text from the serial port and returns the buffer when the delimiter is met.",
|
"serial.readUntil": "Reads a line of text from the serial port and returns the buffer when the delimiter is met.",
|
||||||
"serial.readUntil|param|delimiter": "text delimiter that separates each text chunk",
|
"serial.readUntil|param|delimiter": "text delimiter that separates each text chunk",
|
||||||
"serial.redirect": "Dynamically configuring the serial instance to use pins other than USBTX and USBRX.",
|
"serial.redirect": "Dynamically configuring the serial instance to use pins other than USBTX and USBRX.",
|
||||||
"serial.redirect|param|rx": "the new reception pin",
|
"serial.redirect|param|rate": "the new baud rate. eg: 115200",
|
||||||
"serial.redirect|param|tx": "the new transmission pins",
|
"serial.redirect|param|rx": "the new reception pin, eg: SerialPin.P1",
|
||||||
|
"serial.redirect|param|tx": "the new transmission pins, eg: SerialPin.P0",
|
||||||
"serial.writeLine": "Prints a line of text to the serial",
|
"serial.writeLine": "Prints a line of text to the serial",
|
||||||
"serial.writeNumber": "Prints a numeric value to the serial",
|
"serial.writeNumber": "Prints a numeric value to the serial",
|
||||||
"serial.writeString": "Sends a piece of text through Serial connection.",
|
"serial.writeString": "Sends a piece of text through Serial connection.",
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
"AcceleratorRange.TwoG": "The accelerator measures forces up to 2 gravity",
|
"AcceleratorRange.TwoG": "The accelerator measures forces up to 2 gravity",
|
||||||
"AcceleratorRange.TwoG|block": "2g",
|
"AcceleratorRange.TwoG|block": "2g",
|
||||||
"BaudRate.BaudRate115200|block": "115200",
|
"BaudRate.BaudRate115200|block": "115200",
|
||||||
|
"BaudRate.BaudRate56700|block": "57600",
|
||||||
"BaudRate.BaudRate9600|block": "9600",
|
"BaudRate.BaudRate9600|block": "9600",
|
||||||
"BeatFraction.Eighth|block": "1/8",
|
"BeatFraction.Eighth|block": "1/8",
|
||||||
"BeatFraction.Half|block": "1/2",
|
"BeatFraction.Half|block": "1/2",
|
||||||
@ -83,6 +84,10 @@
|
|||||||
"Note.GSharp4|block": "G#4",
|
"Note.GSharp4|block": "G#4",
|
||||||
"Note.GSharp5|block": "G#5",
|
"Note.GSharp5|block": "G#5",
|
||||||
"Note.GSharp|block": "G#",
|
"Note.GSharp|block": "G#",
|
||||||
|
"PinEventType.Edge|block": "edge",
|
||||||
|
"PinEventType.None|block": "none",
|
||||||
|
"PinEventType.Pulse|block": "pulse",
|
||||||
|
"PinEventType.Touch|block": "touch",
|
||||||
"PinPullMode.PullDown|block": "down",
|
"PinPullMode.PullDown|block": "down",
|
||||||
"PinPullMode.PullNone|block": "none",
|
"PinPullMode.PullNone|block": "none",
|
||||||
"PinPullMode.PullUp|block": "up",
|
"PinPullMode.PullUp|block": "up",
|
||||||
@ -90,9 +95,7 @@
|
|||||||
"Rotation.Roll|block": "roll",
|
"Rotation.Roll|block": "roll",
|
||||||
"String.charAt|block": "char from %this=text|at %pos",
|
"String.charAt|block": "char from %this=text|at %pos",
|
||||||
"String.compare|block": "compare %this=text| to %that",
|
"String.compare|block": "compare %this=text| to %that",
|
||||||
"String.concat|block": "join %this=text|%other",
|
|
||||||
"String.fromCharCode|block": "text from char code %code",
|
"String.fromCharCode|block": "text from char code %code",
|
||||||
"String.isEmpty|block": "%this=text| is empty",
|
|
||||||
"String.length|block": "length of %VALUE",
|
"String.length|block": "length of %VALUE",
|
||||||
"String.substr|block": "substring of %this=text|from %start|of length %length",
|
"String.substr|block": "substring of %this=text|from %start|of length %length",
|
||||||
"String|block": "String",
|
"String|block": "String",
|
||||||
@ -164,19 +167,22 @@
|
|||||||
"music.setTempo|block": "set tempo to (bpm)|%value",
|
"music.setTempo|block": "set tempo to (bpm)|%value",
|
||||||
"music.tempo|block": "tempo (bpm)",
|
"music.tempo|block": "tempo (bpm)",
|
||||||
"music|block": "music",
|
"music|block": "music",
|
||||||
|
"pins.analogPitch|block": "analog pitch %frequency|for (ms) %ms",
|
||||||
"pins.analogReadPin|block": "analog read|pin %name",
|
"pins.analogReadPin|block": "analog read|pin %name",
|
||||||
"pins.analogSetPeriod|block": "analog set period|pin %pin|to (µs)%micros",
|
"pins.analogSetPeriod|block": "analog set period|pin %pin|to (µs)%micros",
|
||||||
|
"pins.analogSetPitchPin|block": "analog set pitch pin %name",
|
||||||
"pins.analogWritePin|block": "analog write|pin %name|to %value",
|
"pins.analogWritePin|block": "analog write|pin %name|to %value",
|
||||||
"pins.digitalReadPin|block": "digital read|pin %name",
|
"pins.digitalReadPin|block": "digital read|pin %name",
|
||||||
"pins.digitalWritePin|block": "digital write|pin %name|to %value",
|
"pins.digitalWritePin|block": "digital write|pin %name|to %value",
|
||||||
"pins.i2cReadNumber|block": "i2c read number|at address %address|of format %format=i2c_sizeof",
|
"pins.i2cReadNumber|block": "i2c read number|at address %address|of format %format=i2c_sizeof|repeat %repeat",
|
||||||
"pins.i2cWriteNumber|block": "i2c write number|at address %address|with value %value|of format %format=i2c_sizeof",
|
"pins.i2cWriteNumber|block": "i2c write number|at address %address|with value %value|of format %format=i2c_sizeof|repeat %repeat",
|
||||||
"pins.map|block": "map %value|from low %fromLow|from high %fromHigh|to low %toLow|to high %toHigh",
|
"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.onPulsed|block": "on|pin %pin|pulsed %pulse",
|
||||||
"pins.pulseDuration|block": "pulse duration (µs)",
|
"pins.pulseDuration|block": "pulse duration (µs)",
|
||||||
"pins.pulseIn|block": "pulse in (µs)|pin %name|pulsed %value",
|
"pins.pulseIn|block": "pulse in (µs)|pin %name|pulsed %value",
|
||||||
"pins.servoSetPulse|block": "servo set pulse|pin %value|to (µs) %micros",
|
"pins.servoSetPulse|block": "servo set pulse|pin %value|to (µs) %micros",
|
||||||
"pins.servoWritePin|block": "servo write|pin %name|to %value",
|
"pins.servoWritePin|block": "servo write|pin %name|to %value",
|
||||||
|
"pins.setEvents|block": "set pin %pin|to emit %type|events",
|
||||||
"pins.setPull|block": "set pull|pin %pin|to %pull",
|
"pins.setPull|block": "set pull|pin %pin|to %pull",
|
||||||
"pins.spiWrite|block": "spi write %value",
|
"pins.spiWrite|block": "spi write %value",
|
||||||
"pins|block": "pins",
|
"pins|block": "pins",
|
||||||
|
@ -71,7 +71,6 @@
|
|||||||
"control.waitMicros|param|micros": "Anzahl der Mikrosekunden, die gewartet werden soll, z.B.: 4",
|
"control.waitMicros|param|micros": "Anzahl der Mikrosekunden, die gewartet werden soll, z.B.: 4",
|
||||||
"game": "Eine Einzel-LED-Sprite-Spielumgebung",
|
"game": "Eine Einzel-LED-Sprite-Spielumgebung",
|
||||||
"game.addLife": "Fügt Leben zum aktuellen Spielstand hinzu",
|
"game.addLife": "Fügt Leben zum aktuellen Spielstand hinzu",
|
||||||
"game.addLife|param|lives": "TODO",
|
|
||||||
"game.addScore": "Fügt zum aktuellen Spielstand Punkte hinzu",
|
"game.addScore": "Fügt zum aktuellen Spielstand Punkte hinzu",
|
||||||
"game.addScore|param|points": "Anzahl von zu verändernden Punkten, z.B.: 1",
|
"game.addScore|param|points": "Anzahl von zu verändernden Punkten, z.B.: 1",
|
||||||
"game.createSprite": "Erzeugt einen neuen LED-Sprite, der nach rechts zeigt.",
|
"game.createSprite": "Erzeugt einen neuen LED-Sprite, der nach rechts zeigt.",
|
||||||
@ -86,12 +85,9 @@
|
|||||||
"game.levelUp": "Erhöht das Level und zeigt eine Nachricht an.",
|
"game.levelUp": "Erhöht das Level und zeigt eine Nachricht an.",
|
||||||
"game.life": "Ruft das aktuelle Leben ab",
|
"game.life": "Ruft das aktuelle Leben ab",
|
||||||
"game.removeLife": "Entfernt ein Leben",
|
"game.removeLife": "Entfernt ein Leben",
|
||||||
"game.removeLife|param|life": "TODO",
|
|
||||||
"game.score": "Ruft den aktuellen Punktestand ab",
|
"game.score": "Ruft den aktuellen Punktestand ab",
|
||||||
"game.setLife": "Setzt den aktuellen Wert der Leben",
|
"game.setLife": "Setzt den aktuellen Wert der Leben",
|
||||||
"game.setLife|param|value": "TODO",
|
|
||||||
"game.setScore": "Setzt den aktuellen Wert des Spielstands",
|
"game.setScore": "Setzt den aktuellen Wert des Spielstands",
|
||||||
"game.setScore|param|value": "TODO",
|
|
||||||
"game.showScore": "Zeigt den Spielstand auf dem Display.",
|
"game.showScore": "Zeigt den Spielstand auf dem Display.",
|
||||||
"game.startCountdown": "Startet einen Spiel-Countdown",
|
"game.startCountdown": "Startet einen Spiel-Countdown",
|
||||||
"game.startCountdown|param|ms": "Countdown-Dauer in Millisekunden, z.B.: 10000",
|
"game.startCountdown|param|ms": "Countdown-Dauer in Millisekunden, z.B.: 10000",
|
||||||
@ -101,38 +97,24 @@
|
|||||||
"images.createImage": "Erstellt ein Bild, das auf den LED-Bildschirm passt.",
|
"images.createImage": "Erstellt ein Bild, das auf den LED-Bildschirm passt.",
|
||||||
"input": "Ereignisse und Daten der Sensoren",
|
"input": "Ereignisse und Daten der Sensoren",
|
||||||
"input.acceleration": "Holt den Beschleunigungswert in Milli-Erdanziehung (wenn das Board flach mit dem Display nach oben liegt, X = 0, y = 0 und Z =-1024)",
|
"input.acceleration": "Holt den Beschleunigungswert in Milli-Erdanziehung (wenn das Board flach mit dem Display nach oben liegt, X = 0, y = 0 und Z =-1024)",
|
||||||
"input.acceleration|param|dimension": "TODO",
|
|
||||||
"input.buttonIsPressed": "Erhalte den Sie den Tastenstatus (gepresst oder nicht) für ``A`` und ``B``.",
|
"input.buttonIsPressed": "Erhalte den Sie den Tastenstatus (gepresst oder nicht) für ``A`` und ``B``.",
|
||||||
"input.calibrate": "Veraltet, Kompasskalibrierung erfolgt automatisch.",
|
"input.calibrate": "Veraltet, Kompasskalibrierung erfolgt automatisch.",
|
||||||
"input.compassHeading": "Holt die aktuelle Kompassrichtung in Grad.",
|
"input.compassHeading": "Holt die aktuelle Kompassrichtung in Grad.",
|
||||||
"input.lightLevel": "Liest die Lichtintensität auf dem LED-Bildschirm im Bereich von ``0`` (dunkel) und `` 255`` (hell).",
|
"input.lightLevel": "Liest die Lichtintensität auf dem LED-Bildschirm im Bereich von ``0`` (dunkel) und `` 255`` (hell).",
|
||||||
"input.magneticForce": "Ruft den Wert der Magnetkraft in ``Mikro-Tesla`` (``µT``) ab. Diese Funktion wird im Simulator nicht unterstützt.",
|
"input.magneticForce": "Ruft den Wert der Magnetkraft in ``Mikro-Tesla`` (``µT``) ab. Diese Funktion wird im Simulator nicht unterstützt.",
|
||||||
"input.magneticForce|param|dimension": "TODO",
|
|
||||||
"input.onButtonPressed": "Tue etwas, wenn eine Taste (``A``, ``B`` oder ``A + B``) gedrückt wird",
|
"input.onButtonPressed": "Tue etwas, wenn eine Taste (``A``, ``B`` oder ``A + B``) gedrückt wird",
|
||||||
"input.onButtonPressed|param|body": "TODO",
|
|
||||||
"input.onButtonPressed|param|button": "TODO",
|
|
||||||
"input.onGesture": "Mache etwas, wenn eine Geste gemacht wird (wie den mini zu schütteln).",
|
"input.onGesture": "Mache etwas, wenn eine Geste gemacht wird (wie den mini zu schütteln).",
|
||||||
"input.onGesture|param|body": "TODO",
|
|
||||||
"input.onLogoDown": "Fügt Code hinzu, der ausgeführt wird, wenn das Logo nach unten zeigt und das Board vertikal ausgerichtet ist.",
|
"input.onLogoDown": "Fügt Code hinzu, der ausgeführt wird, wenn das Logo nach unten zeigt und das Board vertikal ausgerichtet ist.",
|
||||||
"input.onLogoDown|param|body": "TODO",
|
|
||||||
"input.onLogoUp": "Fügt Code hinzu, der ausgeführt wird, wenn das Logo nach oben zeigt und das Board vertikal ausgerichtet ist.",
|
"input.onLogoUp": "Fügt Code hinzu, der ausgeführt wird, wenn das Logo nach oben zeigt und das Board vertikal ausgerichtet ist.",
|
||||||
"input.onLogoUp|param|body": "TODO",
|
|
||||||
"input.onPinPressed": "Mache etwas, wenn eine Pin gehalten wird.",
|
"input.onPinPressed": "Mache etwas, wenn eine Pin gehalten wird.",
|
||||||
"input.onPinPressed|param|body": "Code, der ausführt wird, wenn ein Pin gehalten wird",
|
"input.onPinPressed|param|body": "Code, der ausführt wird, wenn ein Pin gehalten wird",
|
||||||
"input.onPinPressed|param|name": "Der Pin, der gehalten werden muss",
|
|
||||||
"input.onPinReleased": "Mache etwas, wenn der Pin losgelassen wird.",
|
"input.onPinReleased": "Mache etwas, wenn der Pin losgelassen wird.",
|
||||||
"input.onPinReleased|param|body": "Code, der ausgeführt werden soll, wenn der Pin losgelassen wird",
|
"input.onPinReleased|param|body": "Code, der ausgeführt werden soll, wenn der Pin losgelassen wird",
|
||||||
"input.onPinReleased|param|name": "Der Pin, der losgelassen werden muss",
|
|
||||||
"input.onScreenDown": "Hängt Code an, der ausgeführt wird, wenn der Bildschirm nach unten zeigt.",
|
"input.onScreenDown": "Hängt Code an, der ausgeführt wird, wenn der Bildschirm nach unten zeigt.",
|
||||||
"input.onScreenDown|param|body": "TODO",
|
|
||||||
"input.onScreenUp": "Hängt Code an, der ausgeführt wird, wenn der Bildschirm nach oben zeigt.",
|
"input.onScreenUp": "Hängt Code an, der ausgeführt wird, wenn der Bildschirm nach oben zeigt.",
|
||||||
"input.onScreenUp|param|body": "TODO",
|
|
||||||
"input.onShake": "Hängt Code an, der ausgeführt wird, wenn der mini geschüttelt wird.",
|
"input.onShake": "Hängt Code an, der ausgeführt wird, wenn der mini geschüttelt wird.",
|
||||||
"input.onShake|param|body": "TODO",
|
|
||||||
"input.pinIsPressed": "Ruft den Pin-Zustand (gehalten oder nicht) ab. Die Erdung muss gehalten werden, um den Stromkreis zu schließen.",
|
"input.pinIsPressed": "Ruft den Pin-Zustand (gehalten oder nicht) ab. Die Erdung muss gehalten werden, um den Stromkreis zu schließen.",
|
||||||
"input.pinIsPressed|param|name": "Pin, der verwendet wird, um eine Berührung zu erkennen",
|
|
||||||
"input.rotation": "Die Neigung und Drehung des mini Drehung auf ``X-Achse``oder ``Y-Achse``, in Grad.",
|
"input.rotation": "Die Neigung und Drehung des mini Drehung auf ``X-Achse``oder ``Y-Achse``, in Grad.",
|
||||||
"input.rotation|param|kind": "TODO",
|
|
||||||
"input.runningTime": "Ruft die Anzahl der Millisekunden auf, die seit dem Einschalten vergangen sind.",
|
"input.runningTime": "Ruft die Anzahl der Millisekunden auf, die seit dem Einschalten vergangen sind.",
|
||||||
"input.setAccelerometerRange": "Legt die Stichprobenbereich des Beschleunigungssensors in Schwerkraft fest.",
|
"input.setAccelerometerRange": "Legt die Stichprobenbereich des Beschleunigungssensors in Schwerkraft fest.",
|
||||||
"input.setAccelerometerRange|param|range": "Ein Wert, der die maximale Stärke der gemessenen Beschleunigung beschreibt",
|
"input.setAccelerometerRange|param|range": "Ein Wert, der die maximale Stärke der gemessenen Beschleunigung beschreibt",
|
||||||
@ -141,19 +123,13 @@
|
|||||||
"led.brightness": "Ruft die Helligkeit des Bildschirms ab, von 0 (aus) bis 255 (volle Helligkeit).",
|
"led.brightness": "Ruft die Helligkeit des Bildschirms ab, von 0 (aus) bis 255 (volle Helligkeit).",
|
||||||
"led.enable": "Schaltet das Display an und aus",
|
"led.enable": "Schaltet das Display an und aus",
|
||||||
"led.fadeIn": "Blendet die Bildschirmanzeige ein.",
|
"led.fadeIn": "Blendet die Bildschirmanzeige ein.",
|
||||||
"led.fadeIn|param|ms": "TODO",
|
|
||||||
"led.fadeOut": "Blendet die Bildschirmhelligkeit aus.",
|
"led.fadeOut": "Blendet die Bildschirmhelligkeit aus.",
|
||||||
"led.fadeOut|param|ms": "TODO",
|
|
||||||
"led.plot": "Schalte die angegebene LED mit Hilfe von X- und Y-Koordinaten ein (X ist horizontal, Y ist vertikal). (0,0) ist die obere linke Ecke.",
|
"led.plot": "Schalte die angegebene LED mit Hilfe von X- und Y-Koordinaten ein (X ist horizontal, Y ist vertikal). (0,0) ist die obere linke Ecke.",
|
||||||
"led.plotAll": "Schaltet alle LEDs an",
|
"led.plotAll": "Schaltet alle LEDs an",
|
||||||
"led.plotBarGraph": "Zeigt ein vertikales Balkendiagramm an, basierend auf dem `Wert`und dem `Hoch`-Wert. Wenn `Hoch`0 ist, wird das Diagramm automatisch angepasst.",
|
"led.plotBarGraph": "Zeigt ein vertikales Balkendiagramm an, basierend auf dem `Wert`und dem `Hoch`-Wert. Wenn `Hoch`0 ist, wird das Diagramm automatisch angepasst.",
|
||||||
"led.plotBarGraph|param|high": "maximalen Wert. Wenn dieser 0 ist, wird der Maximalwert automatisch angepasst, z.B.: 0",
|
"led.plotBarGraph|param|high": "maximalen Wert. Wenn dieser 0 ist, wird der Maximalwert automatisch angepasst, z.B.: 0",
|
||||||
"led.plotBarGraph|param|value": "aktueller Wert zum Darstellen",
|
"led.plotBarGraph|param|value": "aktueller Wert zum Darstellen",
|
||||||
"led.plot|param|x": "TODO",
|
|
||||||
"led.plot|param|y": "TODO",
|
|
||||||
"led.point": "Ruft den An/Aus-Status einer vorgegebenen LED mittels X-/Y-Koordinaten ab. (0,0) ist oben links.",
|
"led.point": "Ruft den An/Aus-Status einer vorgegebenen LED mittels X-/Y-Koordinaten ab. (0,0) ist oben links.",
|
||||||
"led.point|param|x": "TODO",
|
|
||||||
"led.point|param|y": "TODO",
|
|
||||||
"led.screenshot": "Macht einen Screenshot vom LED-Bildschirm und gibt ein Bild aus.",
|
"led.screenshot": "Macht einen Screenshot vom LED-Bildschirm und gibt ein Bild aus.",
|
||||||
"led.setBrightness": "Lege die Helligkeit des Bildschirms fest, von 0 (aus) bis 255 (volle Helligkeit).",
|
"led.setBrightness": "Lege die Helligkeit des Bildschirms fest, von 0 (aus) bis 255 (volle Helligkeit).",
|
||||||
"led.setBrightness|param|value": "Helligkeitswert, z.B.: 255, 127, 0",
|
"led.setBrightness|param|value": "Helligkeitswert, z.B.: 255, 127, 0",
|
||||||
@ -162,11 +138,7 @@
|
|||||||
"led.stopAnimation": "Bricht die aktuelle Animation ab und löscht andere ausstehende Animationen.",
|
"led.stopAnimation": "Bricht die aktuelle Animation ab und löscht andere ausstehende Animationen.",
|
||||||
"led.toggle": "Schaltet ein bestimmtes Pixel ein",
|
"led.toggle": "Schaltet ein bestimmtes Pixel ein",
|
||||||
"led.toggleAll": "Invertiert die aktuelle LED-Anzeige",
|
"led.toggleAll": "Invertiert die aktuelle LED-Anzeige",
|
||||||
"led.toggle|param|x": "TODO",
|
|
||||||
"led.toggle|param|y": "TODO",
|
|
||||||
"led.unplot": "Schalte die angegebene LED mit x-und y-Koordinaten ab (X ist horizontal, y ist vertikal). (0,0) ist oben links.",
|
"led.unplot": "Schalte die angegebene LED mit x-und y-Koordinaten ab (X ist horizontal, y ist vertikal). (0,0) ist oben links.",
|
||||||
"led.unplot|param|x": "TODO",
|
|
||||||
"led.unplot|param|y": "TODO",
|
|
||||||
"motors": "Blöcke, die genutzt werden, um Onboard-Motoren zu steuern",
|
"motors": "Blöcke, die genutzt werden, um Onboard-Motoren zu steuern",
|
||||||
"motors.dualMotorPower": "Steuert zwei an das Board angeschlossene Motoren. Schaltet auf Dual-Motor-Modus um!",
|
"motors.dualMotorPower": "Steuert zwei an das Board angeschlossene Motoren. Schaltet auf Dual-Motor-Modus um!",
|
||||||
"motors.motorCommand": "Schicke Anhalten, Ausrollen oder Anhalten-Befehle an den Motor. Hat im Dual-Motor-Modus keinen Effekt.",
|
"motors.motorCommand": "Schicke Anhalten, Ausrollen oder Anhalten-Befehle an den Motor. Hat im Dual-Motor-Modus keinen Effekt.",
|
||||||
@ -177,7 +149,6 @@
|
|||||||
"music.changeTempoBy": "Ändere die Geschwindigkeit um den angegebenen Betrag",
|
"music.changeTempoBy": "Ändere die Geschwindigkeit um den angegebenen Betrag",
|
||||||
"music.changeTempoBy|param|bpm": "Die Änderung in Schlägen pro Minute auf das Tempo, z.B.: 20",
|
"music.changeTempoBy|param|bpm": "Die Änderung in Schlägen pro Minute auf das Tempo, z.B.: 20",
|
||||||
"music.noteFrequency": "Ruft die Frequenz einer Note ab.",
|
"music.noteFrequency": "Ruft die Frequenz einer Note ab.",
|
||||||
"music.noteFrequency|param|name": "der Name der Notiz",
|
|
||||||
"music.playTone": "Spielt einen Ton für den angegebenen Zeitraum auf dem Lautsprecher ab.",
|
"music.playTone": "Spielt einen Ton für den angegebenen Zeitraum auf dem Lautsprecher ab.",
|
||||||
"music.playTone|param|ms": "Tondauer in Millisekunden (ms)",
|
"music.playTone|param|ms": "Tondauer in Millisekunden (ms)",
|
||||||
"music.rest": "Ruht (spielt nichts) für eine bestimmte Zeit auf Pin ``P0``.",
|
"music.rest": "Ruht (spielt nichts) für eine bestimmte Zeit auf Pin ``P0``.",
|
||||||
@ -189,24 +160,15 @@
|
|||||||
"music.tempo": "Gibt die Geschwindigkeit in Schlägen pro Minute aus. Die Geschwindigkeit ist Schnelligkeit (Bpm = Beats pro Minute), in der Töne abgespielt werden. Je größer der Wert, desto schneller werden die Töne abgespielt.",
|
"music.tempo": "Gibt die Geschwindigkeit in Schlägen pro Minute aus. Die Geschwindigkeit ist Schnelligkeit (Bpm = Beats pro Minute), in der Töne abgespielt werden. Je größer der Wert, desto schneller werden die Töne abgespielt.",
|
||||||
"pins": "Steuere die Stromstärke über die Pins für analoge/digitale Signale, Servos, I2C,...",
|
"pins": "Steuere die Stromstärke über die Pins für analoge/digitale Signale, Servos, I2C,...",
|
||||||
"pins.analogPitch": "Gibt ein Pulsweiten Modulation (PWM)-Signal über den aktuellen Pitch-Pin. Benutze `analog set pitch pin`, um den Pitch-Pin festzulegen.",
|
"pins.analogPitch": "Gibt ein Pulsweiten Modulation (PWM)-Signal über den aktuellen Pitch-Pin. Benutze `analog set pitch pin`, um den Pitch-Pin festzulegen.",
|
||||||
"pins.analogPitch|param|frequency": "TODO",
|
|
||||||
"pins.analogPitch|param|ms": "TODO",
|
|
||||||
"pins.analogReadPin": "Lese den Anschlusswert als Analog aus, d. h. als einen Wert zwischen 0 und 1023.",
|
"pins.analogReadPin": "Lese den Anschlusswert als Analog aus, d. h. als einen Wert zwischen 0 und 1023.",
|
||||||
"pins.analogReadPin|param|name": "Pin, auf den geschrieben werden soll",
|
|
||||||
"pins.analogSetPeriod": "Stellt die Pulsweite Modulation (PWM) des Analogausganges auf den angegebenen Wert in ** Mikrosekunden ** oder `1/1000` Millisekunden ein.\nWenn dieser Pin nicht als einen Analogausgang (mit `analog write pin`) konfiguriert ist, hat der Vorgang keine Auswirkungen.",
|
"pins.analogSetPeriod": "Stellt die Pulsweite Modulation (PWM) des Analogausganges auf den angegebenen Wert in ** Mikrosekunden ** oder `1/1000` Millisekunden ein.\nWenn dieser Pin nicht als einen Analogausgang (mit `analog write pin`) konfiguriert ist, hat der Vorgang keine Auswirkungen.",
|
||||||
"pins.analogSetPeriod|param|micros": "Zeit in Mikrosekunden. z.B.: 20000",
|
"pins.analogSetPeriod|param|micros": "Zeit in Mikrosekunden. z.B.: 20000",
|
||||||
"pins.analogSetPeriod|param|name": "analoger Pin, der zeitlich festgelegt werden soll",
|
|
||||||
"pins.analogSetPitchPin": "Setzt den genutzten Pin, wenn `pins->analog pitch`angewendet wird.",
|
|
||||||
"pins.analogSetPitchPin|param|name": "TODO",
|
|
||||||
"pins.analogWritePin": "Legt den Wert des Verbinders auf analog fest. Der Wert muss zwischen 0 und 1023 liegen.",
|
"pins.analogWritePin": "Legt den Wert des Verbinders auf analog fest. Der Wert muss zwischen 0 und 1023 liegen.",
|
||||||
"pins.analogWritePin|param|name": "PIN-Name, auf den geschrieben werden soll",
|
|
||||||
"pins.analogWritePin|param|value": "Wert, der auf den Pin geschrieben werden soll, zwischen ``0`` und ``1023`` z.B.: 1023,0",
|
"pins.analogWritePin|param|value": "Wert, der auf den Pin geschrieben werden soll, zwischen ``0`` und ``1023`` z.B.: 1023,0",
|
||||||
"pins.createBuffer": "Erstellt einen Null-initialisierten Zwischenspeicher.",
|
"pins.createBuffer": "Erstellt einen Null-initialisierten Zwischenspeicher.",
|
||||||
"pins.createBuffer|param|size": "Anzahl der Bytes im Zwischenspeicher",
|
"pins.createBuffer|param|size": "Anzahl der Bytes im Zwischenspeicher",
|
||||||
"pins.digitalReadPin": "Lese den angegebene Pin oder Verbinder als 0 oder 1",
|
"pins.digitalReadPin": "Lese den angegebene Pin oder Verbinder als 0 oder 1",
|
||||||
"pins.digitalReadPin|param|name": "Pin, aus dem gelesen werden soll",
|
|
||||||
"pins.digitalWritePin": "Setzt einen Pin- oder Verbinder-Wert auf 0 oder 1.",
|
"pins.digitalWritePin": "Setzt einen Pin- oder Verbinder-Wert auf 0 oder 1.",
|
||||||
"pins.digitalWritePin|param|name": "Pin, auf den geschrieben werden soll",
|
|
||||||
"pins.digitalWritePin|param|value": "Wert, der auf dem Pin 1 gesetzt werden soll, z.B. 0",
|
"pins.digitalWritePin|param|value": "Wert, der auf dem Pin 1 gesetzt werden soll, z.B. 0",
|
||||||
"pins.i2cReadBuffer": "Lese `Größe`bytes aus einer 7-bit I2C-Adresse.",
|
"pins.i2cReadBuffer": "Lese `Größe`bytes aus einer 7-bit I2C-Adresse.",
|
||||||
"pins.i2cReadNumber": "Lese eine Nummer aus einer 7-bit I2C-Adresse.",
|
"pins.i2cReadNumber": "Lese eine Nummer aus einer 7-bit I2C-Adresse.",
|
||||||
@ -227,11 +189,8 @@
|
|||||||
"pins.servoSetPulse|param|micros": "Impulsdauer in Mikrosekunden, z.B.: 1500",
|
"pins.servoSetPulse|param|micros": "Impulsdauer in Mikrosekunden, z.B.: 1500",
|
||||||
"pins.servoSetPulse|param|name": "PIN-Name",
|
"pins.servoSetPulse|param|name": "PIN-Name",
|
||||||
"pins.servoWritePin": "Schreibt einen Wert in den Servo, der die Welle entsprechend kontroliert. Auf einem Standard-Servo wird so der Winkel der Welle (in Grad) eingestellt, sodass sich die Welle entsprechend anpasst. Auf einem kontinuierlich drehenden Servo wird dadurch die Geschwindigkeit des Servos festgelegt, wobei ``0``die volle Geschwindigkeit in eine Richtung darstellt, ``180``die volle Geschwindigkeit in die andere, und ein Wert von ``90`` einen Stillstand erzeugt.",
|
"pins.servoWritePin": "Schreibt einen Wert in den Servo, der die Welle entsprechend kontroliert. Auf einem Standard-Servo wird so der Winkel der Welle (in Grad) eingestellt, sodass sich die Welle entsprechend anpasst. Auf einem kontinuierlich drehenden Servo wird dadurch die Geschwindigkeit des Servos festgelegt, wobei ``0``die volle Geschwindigkeit in eine Richtung darstellt, ``180``die volle Geschwindigkeit in die andere, und ein Wert von ``90`` einen Stillstand erzeugt.",
|
||||||
"pins.servoWritePin|param|name": "Pin, auf den geschrieben werden soll",
|
|
||||||
"pins.servoWritePin|param|value": "Winkel oder Rotationsbeschleunigung, z.B.: 180,90,0",
|
"pins.servoWritePin|param|value": "Winkel oder Rotationsbeschleunigung, z.B.: 180,90,0",
|
||||||
"pins.setPull": "Stellt die Anziehungskraft des Pins ein.",
|
"pins.setPull": "Stellt die Anziehungskraft des Pins ein.",
|
||||||
"pins.setPull|param|name": "Pin, auf dem der Pull-Modus aktiviert wird",
|
|
||||||
"pins.setPull|param|pull": "eine der mbed-Pull-Konfigurationen: PullUp, PullDown, PullNone",
|
|
||||||
"pins.sizeOf": "Ruft die Bytegröße im spezifierten Nummernformat ab.",
|
"pins.sizeOf": "Ruft die Bytegröße im spezifierten Nummernformat ab.",
|
||||||
"pins.spiWrite": "Schreibe in den SPI-Slave und gebe die Antwort aus",
|
"pins.spiWrite": "Schreibe in den SPI-Slave und gebe die Antwort aus",
|
||||||
"pins.spiWrite|param|value": "Daten, die an den SPI-Slave geschickt werden sollen",
|
"pins.spiWrite|param|value": "Daten, die an den SPI-Slave geschickt werden sollen",
|
||||||
@ -242,8 +201,6 @@
|
|||||||
"serial.readUntil": "Liest aus eine Textzeile aus dem seriellen Anschluss und gibt den Puffer aus, wenn die Begrenzung erreicht wurde.",
|
"serial.readUntil": "Liest aus eine Textzeile aus dem seriellen Anschluss und gibt den Puffer aus, wenn die Begrenzung erreicht wurde.",
|
||||||
"serial.readUntil|param|delimiter": "Text-Begrenzung, die die Textblöcke voneinander trennt",
|
"serial.readUntil|param|delimiter": "Text-Begrenzung, die die Textblöcke voneinander trennt",
|
||||||
"serial.redirect": "Konfiguriert dynamisch die serielle Instanz, damit sie andere Pins als USBTX und USBRX benutzt.",
|
"serial.redirect": "Konfiguriert dynamisch die serielle Instanz, damit sie andere Pins als USBTX und USBRX benutzt.",
|
||||||
"serial.redirect|param|rx": "der neue Empfangs-Pin",
|
|
||||||
"serial.redirect|param|tx": "Der neue Übertragungs-Pin",
|
|
||||||
"serial.writeLine": "Gibt eine Zeile des Textes an die serielle",
|
"serial.writeLine": "Gibt eine Zeile des Textes an die serielle",
|
||||||
"serial.writeNumber": "Gibt einen numerischen Wert an die serielle",
|
"serial.writeNumber": "Gibt einen numerischen Wert an die serielle",
|
||||||
"serial.writeString": "Sendet ein Stück Text über serielle Verbindung.",
|
"serial.writeString": "Sendet ein Stück Text über serielle Verbindung.",
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
"AcceleratorRange.OneG|block": "1g",
|
"AcceleratorRange.OneG|block": "1g",
|
||||||
"AcceleratorRange.TwoG": "Der Bewegungssensor misst Kräfte bis 2g",
|
"AcceleratorRange.TwoG": "Der Bewegungssensor misst Kräfte bis 2g",
|
||||||
"AcceleratorRange.TwoG|block": "2g",
|
"AcceleratorRange.TwoG|block": "2g",
|
||||||
"BaudRate.BaudRate115200|block": "11520",
|
"BaudRate.BaudRate115200|block": "115200",
|
||||||
"BaudRate.BaudRate9600|block": "9600",
|
"BaudRate.BaudRate9600|block": "9600",
|
||||||
"BeatFraction.Eighth|block": "1/8",
|
"BeatFraction.Eighth|block": "1/8",
|
||||||
"BeatFraction.Half|block": "1/2",
|
"BeatFraction.Half|block": "1/2",
|
||||||
|
@ -57,6 +57,10 @@ enum EventBusValue {
|
|||||||
MICROBIT_BUTTON_EVT_CLICK_ = MICROBIT_BUTTON_EVT_CLICK,
|
MICROBIT_BUTTON_EVT_CLICK_ = MICROBIT_BUTTON_EVT_CLICK,
|
||||||
MICROBIT_RADIO_EVT_DATAGRAM_ = MICROBIT_RADIO_EVT_DATAGRAM,
|
MICROBIT_RADIO_EVT_DATAGRAM_ = MICROBIT_RADIO_EVT_DATAGRAM,
|
||||||
MICROBIT_ACCELEROMETER_EVT_DATA_UPDATE_ = MICROBIT_ACCELEROMETER_EVT_DATA_UPDATE,
|
MICROBIT_ACCELEROMETER_EVT_DATA_UPDATE_ = MICROBIT_ACCELEROMETER_EVT_DATA_UPDATE,
|
||||||
|
MICROBIT_PIN_EVT_RISE_ = MICROBIT_PIN_EVT_RISE,
|
||||||
|
MICROBIT_PIN_EVT_FALL_ = MICROBIT_PIN_EVT_FALL,
|
||||||
|
MICROBIT_PIN_EVT_PULSE_HI_ = MICROBIT_PIN_EVT_PULSE_HI,
|
||||||
|
MICROBIT_PIN_EVT_PULSE_LO_ = MICROBIT_PIN_EVT_PULSE_LO,
|
||||||
MES_ALERT_EVT_ALARM1_ = MES_ALERT_EVT_ALARM1,
|
MES_ALERT_EVT_ALARM1_ = MES_ALERT_EVT_ALARM1,
|
||||||
MES_ALERT_EVT_ALARM2_ = MES_ALERT_EVT_ALARM2,
|
MES_ALERT_EVT_ALARM2_ = MES_ALERT_EVT_ALARM2,
|
||||||
MES_ALERT_EVT_ALARM3_ = MES_ALERT_EVT_ALARM3,
|
MES_ALERT_EVT_ALARM3_ = MES_ALERT_EVT_ALARM3,
|
||||||
|
1
libs/core/dal.d.ts
vendored
1
libs/core/dal.d.ts
vendored
@ -192,6 +192,7 @@ declare const enum DAL {
|
|||||||
MICROBIT_SERIAL_EVT_TX_EMPTY = 2,
|
MICROBIT_SERIAL_EVT_TX_EMPTY = 2,
|
||||||
MICROBIT_UART_S_EVT_TX_EMPTY = 3,
|
MICROBIT_UART_S_EVT_TX_EMPTY = 3,
|
||||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/CalliopeRGB.h
|
// built/yt/yotta_modules/microbit-dal/inc/drivers/CalliopeRGB.h
|
||||||
|
RGB_LED_MAX_INTENSITY = 40,
|
||||||
// built/yt/yotta_modules/microbit-dal/inc/drivers/CalliopeSoundMotor.h
|
// built/yt/yotta_modules/microbit-dal/inc/drivers/CalliopeSoundMotor.h
|
||||||
CALLIOPE_SM_DEFAULT_DUTY_M = 50,
|
CALLIOPE_SM_DEFAULT_DUTY_M = 50,
|
||||||
CALLIOPE_SM_DEFAULT_DUTY_S = 100,
|
CALLIOPE_SM_DEFAULT_DUTY_S = 100,
|
||||||
|
33
libs/core/enums.d.ts
vendored
33
libs/core/enums.d.ts
vendored
@ -176,6 +176,10 @@ declare namespace input {
|
|||||||
MICROBIT_BUTTON_EVT_CLICK = 3, // MICROBIT_BUTTON_EVT_CLICK
|
MICROBIT_BUTTON_EVT_CLICK = 3, // MICROBIT_BUTTON_EVT_CLICK
|
||||||
MICROBIT_RADIO_EVT_DATAGRAM = 1, // MICROBIT_RADIO_EVT_DATAGRAM
|
MICROBIT_RADIO_EVT_DATAGRAM = 1, // MICROBIT_RADIO_EVT_DATAGRAM
|
||||||
MICROBIT_ACCELEROMETER_EVT_DATA_UPDATE = 1, // MICROBIT_ACCELEROMETER_EVT_DATA_UPDATE
|
MICROBIT_ACCELEROMETER_EVT_DATA_UPDATE = 1, // MICROBIT_ACCELEROMETER_EVT_DATA_UPDATE
|
||||||
|
MICROBIT_PIN_EVT_RISE = 2, // MICROBIT_PIN_EVT_RISE
|
||||||
|
MICROBIT_PIN_EVT_FALL = 3, // MICROBIT_PIN_EVT_FALL
|
||||||
|
MICROBIT_PIN_EVT_PULSE_HI = 4, // MICROBIT_PIN_EVT_PULSE_HI
|
||||||
|
MICROBIT_PIN_EVT_PULSE_LO = 5, // MICROBIT_PIN_EVT_PULSE_LO
|
||||||
MES_ALERT_EVT_ALARM1 = 6, // MES_ALERT_EVT_ALARM1
|
MES_ALERT_EVT_ALARM1 = 6, // MES_ALERT_EVT_ALARM1
|
||||||
MES_ALERT_EVT_ALARM2 = 7, // MES_ALERT_EVT_ALARM2
|
MES_ALERT_EVT_ALARM2 = 7, // MES_ALERT_EVT_ALARM2
|
||||||
MES_ALERT_EVT_ALARM3 = 8, // MES_ALERT_EVT_ALARM3
|
MES_ALERT_EVT_ALARM3 = 8, // MES_ALERT_EVT_ALARM3
|
||||||
@ -310,22 +314,33 @@ declare namespace motors {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
declare enum PinEventType {
|
||||||
|
//% block="edge"
|
||||||
|
Edge = 1, // MICROBIT_PIN_EVENT_ON_EDGE
|
||||||
|
//% block="pulse"
|
||||||
|
Pulse = 2, // MICROBIT_PIN_EVENT_ON_PULSE
|
||||||
|
//% block="touch"
|
||||||
|
Touch = 3, // MICROBIT_PIN_EVENT_ON_TOUCH
|
||||||
|
//% block="none"
|
||||||
|
None = 0, // MICROBIT_PIN_EVENT_NONE
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
declare enum SerialPin {
|
declare enum SerialPin {
|
||||||
P0 = 7, // MICROBIT_ID_IO_P0
|
C16 = 9, // MICROBIT_ID_IO_P2
|
||||||
P1 = 8, // MICROBIT_ID_IO_P1
|
C17 = 15, // MICROBIT_ID_IO_P8
|
||||||
P2 = 9, // MICROBIT_ID_IO_P2
|
P0 = 19, // MICROBIT_ID_IO_P12
|
||||||
//P8 = MICROBIT_ID_IO_P8,
|
P1 = 7, // MICROBIT_ID_IO_P0
|
||||||
//P12 = MICROBIT_ID_IO_P12,
|
P2 = 8, // MICROBIT_ID_IO_P1
|
||||||
//P13 = MICROBIT_ID_IO_P13,
|
P3 = 23, // MICROBIT_ID_IO_P16
|
||||||
//P14 = MICROBIT_ID_IO_P14,
|
|
||||||
//P15 = MICROBIT_ID_IO_P15,
|
|
||||||
//P16 = MICROBIT_ID_IO_P16
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
declare enum BaudRate {
|
declare enum BaudRate {
|
||||||
//% block=115200
|
//% block=115200
|
||||||
BaudRate115200 = 115200,
|
BaudRate115200 = 115200,
|
||||||
|
//% block=57600
|
||||||
|
BaudRate56700 = 57600,
|
||||||
//% block=9600
|
//% block=9600
|
||||||
BaudRate9600 = 9600,
|
BaudRate9600 = 9600,
|
||||||
}
|
}
|
||||||
|
@ -43,9 +43,9 @@ namespace ImageMethods {
|
|||||||
*/
|
*/
|
||||||
//% help=images/show-image weight=80 blockNamespace=images
|
//% help=images/show-image weight=80 blockNamespace=images
|
||||||
//% blockId=device_show_image_offset block="show image %sprite|at offset %offset" blockGap=8
|
//% blockId=device_show_image_offset block="show image %sprite|at offset %offset" blockGap=8
|
||||||
//% parts="ledmatrix"
|
//% parts="ledmatrix" async
|
||||||
void showImage(Image sprite, int xOffset) {
|
void showImage(Image sprite, int xOffset, int interval = 400) {
|
||||||
uBit.display.print(MicroBitImage(sprite), -xOffset, 0, 0);
|
uBit.display.print(MicroBitImage(sprite), -xOffset, 0, 0, interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -150,7 +150,7 @@ namespace ImageMethods {
|
|||||||
*/
|
*/
|
||||||
//% weight=70 help=images/show-frame
|
//% weight=70 help=images/show-frame
|
||||||
//% parts="ledmatrix"
|
//% parts="ledmatrix"
|
||||||
void showFrame(Image i, int frame) {
|
void showFrame(Image i, int frame, int interval = 400) {
|
||||||
showImage(i, frame * 5);
|
showImage(i, frame * 5, interval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,9 +9,13 @@ namespace music {
|
|||||||
//% help=music/play-tone weight=90
|
//% help=music/play-tone weight=90
|
||||||
//% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" icon="\uf025" blockGap=8
|
//% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" icon="\uf025" blockGap=8
|
||||||
//% parts="speaker" async
|
//% parts="speaker" async
|
||||||
void playTone(int freqency, int ms) {
|
void playTone(int frequency, int ms) {
|
||||||
uBit.soundmotor.soundOn(freqency);
|
if(frequency > 0) uBit.soundmotor.soundOn(frequency);
|
||||||
if(ms > 0) uBit.sleep(ms);
|
else uBit.soundmotor.soundOff();
|
||||||
uBit.soundmotor.soundOff();
|
if(ms > 0) {
|
||||||
|
uBit.sleep(ms);
|
||||||
|
uBit.soundmotor.soundOff();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,17 @@ enum class PinPullMode {
|
|||||||
PullNone = 2
|
PullNone = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class PinEventType {
|
||||||
|
//% block="edge"
|
||||||
|
Edge = MICROBIT_PIN_EVENT_ON_EDGE,
|
||||||
|
//% block="pulse"
|
||||||
|
Pulse = MICROBIT_PIN_EVENT_ON_PULSE,
|
||||||
|
//% block="touch"
|
||||||
|
Touch = MICROBIT_PIN_EVENT_ON_TOUCH,
|
||||||
|
//% block="none"
|
||||||
|
None = MICROBIT_PIN_EVENT_NONE
|
||||||
|
};
|
||||||
|
|
||||||
MicroBitPin *getPin(int id) {
|
MicroBitPin *getPin(int id) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case MICROBIT_ID_IO_P0: return &uBit.io.P0;
|
case MICROBIT_ID_IO_P0: return &uBit.io.P0;
|
||||||
@ -104,7 +115,7 @@ namespace pins {
|
|||||||
*/
|
*/
|
||||||
//% help=pins/digital-write-pin weight=29
|
//% help=pins/digital-write-pin weight=29
|
||||||
//% blockId=device_set_digital_pin block="digital write|pin %name|to %value"
|
//% blockId=device_set_digital_pin block="digital write|pin %name|to %value"
|
||||||
void digitalWritePin(DigitalPin name, int value) {
|
void digitalWritePin(DigitalPin name, int value) {
|
||||||
PINOP(setDigitalValue(value));
|
PINOP(setDigitalValue(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +124,7 @@ namespace pins {
|
|||||||
* @param name pin to write to
|
* @param name pin to write to
|
||||||
*/
|
*/
|
||||||
//% help=pins/analog-read-pin weight=25
|
//% help=pins/analog-read-pin weight=25
|
||||||
//% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8"
|
//% blockId=device_get_analog_pin block="analog read|pin %name" blockGap="8"
|
||||||
int analogReadPin(AnalogPin name) {
|
int analogReadPin(AnalogPin name) {
|
||||||
PINREAD(getAnalogValue());
|
PINREAD(getAnalogValue());
|
||||||
}
|
}
|
||||||
@ -125,7 +136,7 @@ namespace pins {
|
|||||||
*/
|
*/
|
||||||
//% help=pins/analog-write-pin weight=24
|
//% help=pins/analog-write-pin weight=24
|
||||||
//% blockId=device_set_analog_pin block="analog write|pin %name|to %value" blockGap=8
|
//% blockId=device_set_analog_pin block="analog write|pin %name|to %value" blockGap=8
|
||||||
void analogWritePin(AnalogPin name, int value) {
|
void analogWritePin(AnalogPin name, int value) {
|
||||||
PINOP(setAnalogValue(value));
|
PINOP(setAnalogValue(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -136,11 +147,11 @@ namespace pins {
|
|||||||
* @param micros period in micro seconds. eg:20000
|
* @param micros period in micro seconds. eg:20000
|
||||||
*/
|
*/
|
||||||
//% help=pins/analog-set-period weight=23 blockGap=8
|
//% help=pins/analog-set-period weight=23 blockGap=8
|
||||||
//% blockId=device_set_analog_period block="analog set period|pin %pin|to (µs)%micros"
|
//% blockId=device_set_analog_period block="analog set period|pin %pin|to (µs)%micros"
|
||||||
void analogSetPeriod(AnalogPin name, int micros) {
|
void analogSetPeriod(AnalogPin name, int micros) {
|
||||||
PINOP(setAnalogPeriodUs(micros));
|
PINOP(setAnalogPeriodUs(micros));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures this pin to a digital input, and generates events where the timestamp is the duration that this pin was either ``high`` or ``low``.
|
* Configures this pin to a digital input, and generates events where the timestamp is the duration that this pin was either ``high`` or ``low``.
|
||||||
*/
|
*/
|
||||||
@ -149,11 +160,11 @@ namespace pins {
|
|||||||
void onPulsed(DigitalPin name, PulseValue pulse, Action body) {
|
void onPulsed(DigitalPin name, PulseValue pulse, Action body) {
|
||||||
MicroBitPin* pin = getPin((int)name);
|
MicroBitPin* pin = getPin((int)name);
|
||||||
if (!pin) return;
|
if (!pin) return;
|
||||||
|
|
||||||
pin->eventOn(MICROBIT_PIN_EVENT_ON_PULSE);
|
pin->eventOn(MICROBIT_PIN_EVENT_ON_PULSE);
|
||||||
registerWithDal((int)name, (int)pulse, body);
|
registerWithDal((int)name, (int)pulse, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the duration of the last pulse in micro-seconds. This function should be called from a ``onPulsed`` handler.
|
* Gets the duration of the last pulse in micro-seconds. This function should be called from a ``onPulsed`` handler.
|
||||||
*/
|
*/
|
||||||
@ -169,7 +180,7 @@ namespace pins {
|
|||||||
* @param name the pin which measures the pulse
|
* @param name the pin which measures the pulse
|
||||||
* @param value the value of the pulse (default high)
|
* @param value the value of the pulse (default high)
|
||||||
* @param maximum duration in micro-seconds
|
* @param maximum duration in micro-seconds
|
||||||
*/
|
*/
|
||||||
//% blockId="pins_pulse_in" block="pulse in (µs)|pin %name|pulsed %value"
|
//% blockId="pins_pulse_in" block="pulse in (µs)|pin %name|pulsed %value"
|
||||||
//% weight=20
|
//% weight=20
|
||||||
int pulseIn(DigitalPin name, PulseValue value, int maxDuration = 2000000) {
|
int pulseIn(DigitalPin name, PulseValue value, int maxDuration = 2000000) {
|
||||||
@ -177,20 +188,20 @@ namespace pins {
|
|||||||
if (!pin) return 0;
|
if (!pin) return 0;
|
||||||
|
|
||||||
int pulse = value == PulseValue::High ? 1 : 0;
|
int pulse = value == PulseValue::High ? 1 : 0;
|
||||||
uint64_t tick = system_timer_current_time_us();
|
uint64_t tick = system_timer_current_time_us();
|
||||||
uint64_t maxd = (uint64_t)maxDuration;
|
uint64_t maxd = (uint64_t)maxDuration;
|
||||||
while(pin->getDigitalValue() != pulse) {
|
while(pin->getDigitalValue() != pulse) {
|
||||||
if(system_timer_current_time_us() - tick > maxd)
|
if(system_timer_current_time_us() - tick > maxd)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t start = system_timer_current_time_us();
|
uint64_t start = system_timer_current_time_us();
|
||||||
while(pin->getDigitalValue() == pulse) {
|
while(pin->getDigitalValue() == pulse) {
|
||||||
if(system_timer_current_time_us() - tick > maxd)
|
if(system_timer_current_time_us() - tick > maxd)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint64_t end = system_timer_current_time_us();
|
uint64_t end = system_timer_current_time_us();
|
||||||
return end - start;
|
return end - start;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -201,7 +212,7 @@ namespace pins {
|
|||||||
//% help=pins/servo-write-pin weight=20
|
//% help=pins/servo-write-pin weight=20
|
||||||
//% blockId=device_set_servo_pin block="servo write|pin %name|to %value" blockGap=8
|
//% blockId=device_set_servo_pin block="servo write|pin %name|to %value" blockGap=8
|
||||||
//% parts=microservo trackArgs=0
|
//% parts=microservo trackArgs=0
|
||||||
void servoWritePin(AnalogPin name, int value) {
|
void servoWritePin(AnalogPin name, int value) {
|
||||||
PINOP(setServoValue(value));
|
PINOP(setServoValue(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,7 +223,7 @@ namespace pins {
|
|||||||
*/
|
*/
|
||||||
//% help=pins/servo-set-pulse weight=19
|
//% help=pins/servo-set-pulse weight=19
|
||||||
//% blockId=device_set_servo_pulse block="servo set pulse|pin %value|to (µs) %micros"
|
//% blockId=device_set_servo_pulse block="servo set pulse|pin %value|to (µs) %micros"
|
||||||
void servoSetPulse(AnalogPin name, int micros) {
|
void servoSetPulse(AnalogPin name, int micros) {
|
||||||
PINOP(setServoPulseUs(micros));
|
PINOP(setServoPulseUs(micros));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -223,8 +234,9 @@ namespace pins {
|
|||||||
* Sets the pin used when using `pins->analog pitch`.
|
* Sets the pin used when using `pins->analog pitch`.
|
||||||
* @param name TODO
|
* @param name TODO
|
||||||
*/
|
*/
|
||||||
//% help=pins/analog-set-pitch weight=12
|
//% blockId=device_analog_set_pitch_pin block="analog set pitch pin %name"
|
||||||
void analogSetPitchPin(AnalogPin name) {
|
//% help=pins/analog-set-pitch weight=3 advanced=true
|
||||||
|
void analogSetPitchPin(AnalogPin name) {
|
||||||
pitchPin = getPin((int)name);
|
pitchPin = getPin((int)name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,16 +245,18 @@ namespace pins {
|
|||||||
* @param frequency TODO
|
* @param frequency TODO
|
||||||
* @param ms TODO
|
* @param ms TODO
|
||||||
*/
|
*/
|
||||||
//% help=pins/analog-pitch weight=14 async
|
//% blockId=device_analog_pitch block="analog pitch %frequency|for (ms) %ms"
|
||||||
void analogPitch(int frequency, int ms) {
|
//% help=pins/analog-pitch weight=4 async advanced=true blockGap=8
|
||||||
if (pitchPin == NULL) return;
|
void analogPitch(int frequency, int ms) {
|
||||||
|
if (pitchPin == NULL)
|
||||||
|
analogSetPitchPin(AnalogPin::P1);
|
||||||
if (frequency <= 0) {
|
if (frequency <= 0) {
|
||||||
pitchPin->setAnalogValue(0);
|
pitchPin->setAnalogValue(0);
|
||||||
} else {
|
} else {
|
||||||
pitchPin->setAnalogValue(512);
|
pitchPin->setAnalogValue(512);
|
||||||
pitchPin->setAnalogPeriodUs(1000000/frequency);
|
pitchPin->setAnalogPeriodUs(1000000/frequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ms > 0) {
|
if (ms > 0) {
|
||||||
fiber_sleep(ms);
|
fiber_sleep(ms);
|
||||||
pitchPin->setAnalogValue(0);
|
pitchPin->setAnalogValue(0);
|
||||||
@ -251,7 +265,7 @@ namespace pins {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configures the pull of this pin.
|
* Configures the pull of this pin.
|
||||||
* @param name pin to set the pull mode on
|
* @param name pin to set the pull mode on
|
||||||
@ -260,13 +274,25 @@ namespace pins {
|
|||||||
//% help=pins/set-pull weight=3
|
//% help=pins/set-pull weight=3
|
||||||
//% blockId=device_set_pull block="set pull|pin %pin|to %pull"
|
//% blockId=device_set_pull block="set pull|pin %pin|to %pull"
|
||||||
void setPull(DigitalPin name, PinPullMode pull) {
|
void setPull(DigitalPin name, PinPullMode pull) {
|
||||||
PinMode m = pull == PinPullMode::PullDown
|
PinMode m = pull == PinPullMode::PullDown
|
||||||
? PinMode::PullDown
|
? PinMode::PullDown
|
||||||
: pull == PinPullMode::PullUp ? PinMode::PullUp
|
: pull == PinPullMode::PullUp ? PinMode::PullUp
|
||||||
: PinMode::PullNone;
|
: PinMode::PullNone;
|
||||||
PINOP(setPull(m));
|
PINOP(setPull(m));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures the events emitted by this pin. Events can be subscribed to
|
||||||
|
* using ``control.onEvent()``.
|
||||||
|
* @param name pin to set the event mode on, eg: DigitalPin.P0
|
||||||
|
* @param type the type of events for this pin to emit, eg: PinEventType.Edge
|
||||||
|
*/
|
||||||
|
//% help=pins/set-events weight=4 advanced=true
|
||||||
|
//% blockId=device_set_pin_events block="set pin %pin|to emit %type|events"
|
||||||
|
void setEvents(DigitalPin name, PinEventType type) {
|
||||||
|
getPin((int)name)->eventOn((int)type);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new zero-initialized buffer.
|
* Create a new zero-initialized buffer.
|
||||||
* @param size number of bytes in the buffer
|
* @param size number of bytes in the buffer
|
||||||
@ -287,7 +313,7 @@ namespace pins {
|
|||||||
uBit.i2c.read(address << 1, (char*)buf->payload, size, repeat);
|
uBit.i2c.read(address << 1, (char*)buf->payload, size, repeat);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write bytes to a 7-bit I2C `address`.
|
* Write bytes to a 7-bit I2C `address`.
|
||||||
*/
|
*/
|
||||||
@ -314,5 +340,5 @@ namespace pins {
|
|||||||
auto p = allocSPI();
|
auto p = allocSPI();
|
||||||
return p->write(value);
|
return p->write(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,9 +22,9 @@ namespace pins {
|
|||||||
* Read one number from 7-bit I2C address.
|
* Read one number from 7-bit I2C address.
|
||||||
*/
|
*/
|
||||||
//% help=pins/i2c-read-number blockGap=8
|
//% help=pins/i2c-read-number blockGap=8
|
||||||
//% blockId=pins_i2c_readnumber block="i2c read number|at address %address|of format %format=i2c_sizeof" weight=7
|
//% blockId=pins_i2c_readnumber block="i2c read number|at address %address|of format %format=i2c_sizeof|repeat %repeat" weight=7
|
||||||
export function i2cReadNumber(address: number, format: NumberFormat): number {
|
export function i2cReadNumber(address: number, format: NumberFormat, repeat?: boolean): number {
|
||||||
let buf = pins.i2cReadBuffer(address, pins.sizeOf(format))
|
let buf = pins.i2cReadBuffer(address, pins.sizeOf(format), repeat)
|
||||||
return buf.getNumber(format, 0)
|
return buf.getNumber(format, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,11 +32,11 @@ namespace pins {
|
|||||||
* Write one number to a 7-bit I2C address.
|
* Write one number to a 7-bit I2C address.
|
||||||
*/
|
*/
|
||||||
//% help=pins/i2c-write-number blockGap=8
|
//% help=pins/i2c-write-number blockGap=8
|
||||||
//% blockId=i2c_writenumber block="i2c write number|at address %address|with value %value|of format %format=i2c_sizeof" weight=6
|
//% blockId=i2c_writenumber block="i2c write number|at address %address|with value %value|of format %format=i2c_sizeof|repeat %repeat" weight=6
|
||||||
export function i2cWriteNumber(address: number, value: number, format: NumberFormat): void {
|
export function i2cWriteNumber(address: number, value: number, format: NumberFormat, repeat?: boolean): void {
|
||||||
let buf = createBuffer(pins.sizeOf(format))
|
let buf = createBuffer(pins.sizeOf(format))
|
||||||
buf.setNumber(format, 0, value)
|
buf.setNumber(format, 0, value)
|
||||||
pins.i2cWriteBuffer(address, buf)
|
pins.i2cWriteBuffer(address, buf, repeat)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,20 +1,19 @@
|
|||||||
#include "pxt.h"
|
#include "pxt.h"
|
||||||
|
|
||||||
enum SerialPin {
|
enum SerialPin {
|
||||||
P0 = MICROBIT_ID_IO_P0,
|
C16 = MICROBIT_ID_IO_P2,
|
||||||
P1 = MICROBIT_ID_IO_P1,
|
C17 = MICROBIT_ID_IO_P8,
|
||||||
P2 = MICROBIT_ID_IO_P2,
|
P0 = MICROBIT_ID_IO_P12,
|
||||||
//P8 = MICROBIT_ID_IO_P8,
|
P1 = MICROBIT_ID_IO_P0,
|
||||||
//P12 = MICROBIT_ID_IO_P12,
|
P2 = MICROBIT_ID_IO_P1,
|
||||||
//P13 = MICROBIT_ID_IO_P13,
|
P3 = MICROBIT_ID_IO_P16,
|
||||||
//P14 = MICROBIT_ID_IO_P14,
|
|
||||||
//P15 = MICROBIT_ID_IO_P15,
|
|
||||||
//P16 = MICROBIT_ID_IO_P16
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum BaudRate {
|
enum BaudRate {
|
||||||
//% block=115200
|
//% block=115200
|
||||||
BaudRate115200 = 115200,
|
BaudRate115200 = 115200,
|
||||||
|
//% block=57600
|
||||||
|
BaudRate56700 = 57600,
|
||||||
//% block=9600
|
//% block=9600
|
||||||
BaudRate9600 = 9600
|
BaudRate9600 = 9600
|
||||||
};
|
};
|
||||||
@ -86,16 +85,19 @@ namespace serial {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Dynamically configuring the serial instance to use pins other than USBTX and USBRX.
|
* Dynamically configuring the serial instance to use pins other than USBTX and USBRX.
|
||||||
* @param tx the new transmission pins
|
* @param tx the new transmission pins, eg: SerialPin.P0
|
||||||
* @param rx the new reception pin
|
* @param rx the new reception pin, eg: SerialPin.P1
|
||||||
* @param baud the new baud rate. eg: 115200
|
* @param rate the new baud rate. eg: 115200
|
||||||
*/
|
*/
|
||||||
//% weight=10
|
//% weight=10
|
||||||
//% help=serial/redirect-to
|
//% help=serial/redirect-to
|
||||||
//% blockId=serial_redirect block="serial|redirect to|TX %tx|RX %rx|at baud rate %rate"
|
//% blockId=serial_redirect block="serial|redirect to|TX %tx|RX %rx|at baud rate %rate"
|
||||||
//% blockExternalInputs=1
|
//% blockExternalInputs=1
|
||||||
void redirect(SerialPin tx, SerialPin rx, BaudRate rate) {
|
void redirect(SerialPin tx, SerialPin rx, BaudRate rate) {
|
||||||
uBit.serial.redirect((PinName)tx, (PinName)rx);
|
MicroBitPin* txp = getPin(tx); if (!tx) return;
|
||||||
|
MicroBitPin* rxp = getPin(rx); if (!rx) return;
|
||||||
|
|
||||||
|
uBit.serial.redirect(txp->name, rxp->name);
|
||||||
uBit.serial.baud((int)rate);
|
uBit.serial.baud((int)rate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
32
libs/core/shims.d.ts
vendored
32
libs/core/shims.d.ts
vendored
@ -40,8 +40,8 @@ declare interface Image {
|
|||||||
*/
|
*/
|
||||||
//% help=images/show-image weight=80 blockNamespace=images
|
//% help=images/show-image weight=80 blockNamespace=images
|
||||||
//% blockId=device_show_image_offset block="show image %sprite|at offset %offset" blockGap=8
|
//% blockId=device_show_image_offset block="show image %sprite|at offset %offset" blockGap=8
|
||||||
//% parts="ledmatrix" shim=ImageMethods::showImage
|
//% parts="ledmatrix" async interval.defl=400 shim=ImageMethods::showImage
|
||||||
showImage(xOffset: number): void;
|
showImage(xOffset: number, interval?: number): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws the ``index``-th frame of the image on the screen.
|
* Draws the ``index``-th frame of the image on the screen.
|
||||||
@ -118,8 +118,8 @@ declare interface Image {
|
|||||||
* @param frame TODO
|
* @param frame TODO
|
||||||
*/
|
*/
|
||||||
//% weight=70 help=images/show-frame
|
//% weight=70 help=images/show-frame
|
||||||
//% parts="ledmatrix" shim=ImageMethods::showFrame
|
//% parts="ledmatrix" interval.defl=400 shim=ImageMethods::showFrame
|
||||||
showFrame(frame: number): void;
|
showFrame(frame: number, interval?: number): void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -555,7 +555,7 @@ declare namespace music {
|
|||||||
//% help=music/play-tone weight=90
|
//% help=music/play-tone weight=90
|
||||||
//% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" icon="\uf025" blockGap=8
|
//% blockId=device_play_note block="play|tone %note=device_note|for %duration=device_beat" icon="\uf025" blockGap=8
|
||||||
//% parts="speaker" async shim=music::playTone
|
//% parts="speaker" async shim=music::playTone
|
||||||
function playTone(freqency: number, ms: number): void;
|
function playTone(frequency: number, ms: number): void;
|
||||||
}
|
}
|
||||||
declare namespace pins {
|
declare namespace pins {
|
||||||
|
|
||||||
@ -651,7 +651,8 @@ declare namespace pins {
|
|||||||
* Sets the pin used when using `pins->analog pitch`.
|
* Sets the pin used when using `pins->analog pitch`.
|
||||||
* @param name TODO
|
* @param name TODO
|
||||||
*/
|
*/
|
||||||
//% help=pins/analog-set-pitch weight=12 shim=pins::analogSetPitchPin
|
//% blockId=device_analog_set_pitch_pin block="analog set pitch pin %name"
|
||||||
|
//% help=pins/analog-set-pitch weight=3 advanced=true shim=pins::analogSetPitchPin
|
||||||
function analogSetPitchPin(name: AnalogPin): void;
|
function analogSetPitchPin(name: AnalogPin): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -659,7 +660,8 @@ declare namespace pins {
|
|||||||
* @param frequency TODO
|
* @param frequency TODO
|
||||||
* @param ms TODO
|
* @param ms TODO
|
||||||
*/
|
*/
|
||||||
//% help=pins/analog-pitch weight=14 async shim=pins::analogPitch
|
//% blockId=device_analog_pitch block="analog pitch %frequency|for (ms) %ms"
|
||||||
|
//% help=pins/analog-pitch weight=4 async advanced=true blockGap=8 shim=pins::analogPitch
|
||||||
function analogPitch(frequency: number, ms: number): void;
|
function analogPitch(frequency: number, ms: number): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -671,6 +673,16 @@ declare namespace pins {
|
|||||||
//% blockId=device_set_pull block="set pull|pin %pin|to %pull" shim=pins::setPull
|
//% blockId=device_set_pull block="set pull|pin %pin|to %pull" shim=pins::setPull
|
||||||
function setPull(name: DigitalPin, pull: PinPullMode): void;
|
function setPull(name: DigitalPin, pull: PinPullMode): void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures the events emitted by this pin. Events can be subscribed to
|
||||||
|
* using ``control.onEvent()``.
|
||||||
|
* @param name pin to set the event mode on, eg: DigitalPin.P0
|
||||||
|
* @param type the type of events for this pin to emit, eg: PinEventType.Edge
|
||||||
|
*/
|
||||||
|
//% help=pins/set-events weight=4 advanced=true
|
||||||
|
//% blockId=device_set_pin_events block="set pin %pin|to emit %type|events" shim=pins::setEvents
|
||||||
|
function setEvents(name: DigitalPin, type: PinEventType): void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new zero-initialized buffer.
|
* Create a new zero-initialized buffer.
|
||||||
* @param size number of bytes in the buffer
|
* @param size number of bytes in the buffer
|
||||||
@ -739,9 +751,9 @@ declare namespace serial {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Dynamically configuring the serial instance to use pins other than USBTX and USBRX.
|
* Dynamically configuring the serial instance to use pins other than USBTX and USBRX.
|
||||||
* @param tx the new transmission pins
|
* @param tx the new transmission pins, eg: SerialPin.P0
|
||||||
* @param rx the new reception pin
|
* @param rx the new reception pin, eg: SerialPin.P1
|
||||||
* @param baud the new baud rate. eg: 115200
|
* @param rate the new baud rate. eg: 115200
|
||||||
*/
|
*/
|
||||||
//% weight=10
|
//% weight=10
|
||||||
//% help=serial/redirect-to
|
//% help=serial/redirect-to
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "pxt-calliope",
|
"name": "pxt-calliope",
|
||||||
"version": "0.8.9",
|
"version": "0.8.32",
|
||||||
"description": "Calliope Mini editor for PXT",
|
"description": "Calliope Mini editor for PXT",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"JavaScript",
|
"JavaScript",
|
||||||
@ -34,7 +34,7 @@
|
|||||||
"semantic-ui-less": "^2.2.4"
|
"semantic-ui-less": "^2.2.4"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pxt-core": "0.11.13"
|
"pxt-core": "0.12.14"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "node node_modules/pxt-core/built/pxt.js travis"
|
"test": "node node_modules/pxt-core/built/pxt.js travis"
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
"loopsBlocks": true,
|
"loopsBlocks": true,
|
||||||
"logicBlocks": true,
|
"logicBlocks": true,
|
||||||
"variablesBlocks": true,
|
"variablesBlocks": true,
|
||||||
|
"textBlocks": true,
|
||||||
"onStartColor": "#54C9C9",
|
"onStartColor": "#54C9C9",
|
||||||
"onStartNamespace": "basic"
|
"onStartNamespace": "basic"
|
||||||
},
|
},
|
||||||
@ -170,8 +171,8 @@
|
|||||||
"yottaTarget": "calliope-mini-classic-gcc",
|
"yottaTarget": "calliope-mini-classic-gcc",
|
||||||
"yottaCorePackage": "microbit",
|
"yottaCorePackage": "microbit",
|
||||||
"githubCorePackage": "calliope-mini/microbit",
|
"githubCorePackage": "calliope-mini/microbit",
|
||||||
"gittag": "v2.0.0-rc7-calliope-p8_1",
|
"gittag": "v2.0.0-rc7-calliope-p9-2016-2",
|
||||||
"serviceId": "microbit"
|
"serviceId": "calliope"
|
||||||
},
|
},
|
||||||
"serial": {
|
"serial": {
|
||||||
"manufacturerFilter": "^mbed$",
|
"manufacturerFilter": "^mbed$",
|
||||||
@ -193,9 +194,10 @@
|
|||||||
"privacyUrl": "https://go.microsoft.com/fwlink/?LinkId=521839",
|
"privacyUrl": "https://go.microsoft.com/fwlink/?LinkId=521839",
|
||||||
"termsOfUseUrl": "https://go.microsoft.com/fwlink/?LinkID=206977",
|
"termsOfUseUrl": "https://go.microsoft.com/fwlink/?LinkID=206977",
|
||||||
"githubUrl": "https://github.com/Microsoft/pxt-calliope",
|
"githubUrl": "https://github.com/Microsoft/pxt-calliope",
|
||||||
"organization": "Microsoft",
|
"crowdinProject": "kindscript",
|
||||||
"organizationUrl": "https://pxt.io/",
|
"organization": "Microsoft MakeCode",
|
||||||
"organizationLogo": "./static/Microsoft-logo_rgb_c-gray.png",
|
"organizationUrl": "https://makecode.com/",
|
||||||
|
"organizationLogo": "./static/Microsoft-logo_rgb_c-gray-square.png",
|
||||||
"organizationWideLogo": "./static/Microsoft-logo_rgb_c-white.png",
|
"organizationWideLogo": "./static/Microsoft-logo_rgb_c-white.png",
|
||||||
"browserSupport": [
|
"browserSupport": [
|
||||||
{
|
{
|
||||||
|
@ -129,10 +129,11 @@ namespace pxsim.images {
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace pxsim.ImageMethods {
|
namespace pxsim.ImageMethods {
|
||||||
export function showImage(leds: Image, offset: number) {
|
export function showImage(leds: Image, offset: number, interval: number) {
|
||||||
pxtrt.nullCheck(leds)
|
pxtrt.nullCheck(leds)
|
||||||
leds.copyTo(offset, 5, board().ledMatrixState.image, 0)
|
leds.copyTo(offset, 5, board().ledMatrixState.image, 0)
|
||||||
runtime.queueDisplayUpdate()
|
runtime.queueDisplayUpdate()
|
||||||
|
basic.pause(interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function plotImage(leds: Image, offset: number): void {
|
export function plotImage(leds: Image, offset: number): void {
|
||||||
@ -155,8 +156,8 @@ namespace pxsim.ImageMethods {
|
|||||||
ImageMethods.plotImage(leds, frame * Image.height);
|
ImageMethods.plotImage(leds, frame * Image.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function showFrame(leds: Image, frame: number) {
|
export function showFrame(leds: Image, frame: number, interval: number) {
|
||||||
ImageMethods.showImage(leds, frame * Image.height);
|
ImageMethods.showImage(leds, frame * Image.height, interval);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function pixel(leds: Image, x: number, y: number): number {
|
export function pixel(leds: Image, x: number, y: number): number {
|
||||||
|
@ -119,6 +119,9 @@ namespace pxsim.pins {
|
|||||||
export function getPinAddress(name: number) {
|
export function getPinAddress(name: number) {
|
||||||
return getPin(name)
|
return getPin(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function setEvents(name: number, event: number) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace pxsim.devices {
|
namespace pxsim.devices {
|
||||||
|
@ -1728,7 +1728,7 @@ namespace pxsim.visuals {
|
|||||||
let ay = (ev.clientY - bbox.height / 2) / (bbox.height / 3);
|
let ay = (ev.clientY - bbox.height / 2) / (bbox.height / 3);
|
||||||
|
|
||||||
let x = - Math.max(- 1023, Math.min(1023, Math.floor(ax * 1023)));
|
let x = - Math.max(- 1023, Math.min(1023, Math.floor(ax * 1023)));
|
||||||
let y = Math.max(- 1023, Math.min(1023, Math.floor(ay * 1023)));
|
let y = - Math.max(- 1023, Math.min(1023, Math.floor(ay * 1023)));
|
||||||
let z2 = 1023 * 1023 - x * x - y * y;
|
let z2 = 1023 * 1023 - x * x - y * y;
|
||||||
let z = Math.floor((z2 > 0 ? -1 : 1) * Math.sqrt(Math.abs(z2)));
|
let z = Math.floor((z2 > 0 ? -1 : 1) * Math.sqrt(Math.abs(z2)));
|
||||||
|
|
||||||
|
4
tests/i2c.ts
Normal file
4
tests/i2c.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
let item = pins.i2cReadNumber(123, NumberFormat.Int8LE)
|
||||||
|
pins.i2cWriteNumber(123, 0, NumberFormat.Int8LE)
|
||||||
|
let item = pins.i2cReadNumber(123, NumberFormat.Int8LE, true)
|
||||||
|
pins.i2cWriteNumber(123, 0, NumberFormat.Int8LE, true)
|
Reference in New Issue
Block a user