Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
60f921c173
@ -1,3 +1,3 @@
|
||||
{
|
||||
"appref": "v0.8.2"
|
||||
"appref": "v0.8.16"
|
||||
}
|
||||
|
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/)
|
33
jenkins.groovy
Normal file
33
jenkins.groovy
Normal file
@ -0,0 +1,33 @@
|
||||
import jobs.generation.Utilities;
|
||||
import jobs.generation.InternalUtilities;
|
||||
|
||||
def project = GithubProject
|
||||
def branch = GithubBranchName
|
||||
|
||||
[true, false].each { isPR ->
|
||||
def newJobName = InternalUtilities.getFullJobName(project, "Default", isPR)
|
||||
def newJob = job(newJobName) {
|
||||
steps {
|
||||
shell("chmod +x ./jenkins.sh")
|
||||
shell("./jenkins.sh ${isPR}")
|
||||
}
|
||||
|
||||
if (!isPR) {
|
||||
wrappers {
|
||||
credentialsBinding {
|
||||
string('PXT_ACCESS_TOKEN', 'pxt_access_token')
|
||||
string('PXT_RELEASE_REPO', 'pxt_release_repo_calliope')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Utilities.setMachineAffinity(newJob, 'Ubuntu', '20161020')
|
||||
InternalUtilities.standardJobSetup(newJob, project, isPR, "*/*")
|
||||
|
||||
if (isPR) {
|
||||
Utilities.addGithubPRTrigger(newJob, "Default Testing")
|
||||
} else {
|
||||
Utilities.addGithubPushTrigger(newJob)
|
||||
}
|
||||
}
|
55
jenkins.sh
Normal file
55
jenkins.sh
Normal file
@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Set up NVM
|
||||
export NVM_DIR="/home/dotnet-bot/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
|
||||
|
||||
nvm install 5
|
||||
|
||||
# Set up build environment variables
|
||||
echo ---------- Setting build environment variables
|
||||
echo Git branch: $GIT_BRANCH
|
||||
echo isPR: $1
|
||||
|
||||
originRegex="^origin/.*"
|
||||
branchRegex="^origin/\K.*(?=$)"
|
||||
|
||||
if [[ "$GIT_BRANCH" =~ $originRegex ]]; then
|
||||
branchName=$(echo ${GIT_BRANCH} | grep -oP $branchRegex)
|
||||
echo Setting TRAVIS_BRANCH to ${branchName}
|
||||
export TRAVIS_BRANCH=${branchName}
|
||||
else
|
||||
echo Setting TRAVIS_BRANCH to $GIT_BRANCH
|
||||
export TRAVIS_BRANCH=$GIT_BRANCH
|
||||
fi
|
||||
|
||||
if [ "$1" == "false" ]; then
|
||||
echo Setting TRAVIS_PULL_REQUEST to false
|
||||
export TRAVIS_PULL_REQUEST=false
|
||||
|
||||
if [ $TRAVIS_BRANCH == "master" ]; then
|
||||
if [[ -z $PXT_RELEASE_REPO ]]; then
|
||||
echo Cannot find release repo; skipping tag checks
|
||||
else
|
||||
gitTag=$(git describe --tags --exact-match 2> /dev/null)
|
||||
builtTag=$(git ls-remote --tags $PXT_RELEASE_REPO | grep -o "refs/tags/$gitTag$")
|
||||
|
||||
echo Current tag: $gitTag
|
||||
echo Built tag: $builtTag
|
||||
|
||||
if [[ ! -z $gitTag && -z $builtTag ]]; then
|
||||
echo Built tag not found; building tag
|
||||
echo Setting TRAVIS_BRANCH to $gitTag
|
||||
export TRAVIS_BRANCH=$gitTag
|
||||
echo Setting TRAVIS_TAG to $gitTag
|
||||
export TRAVIS_TAG=$gitTag
|
||||
else
|
||||
echo Not a tag build
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Perform build
|
||||
npm install
|
||||
npm test
|
@ -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.uartWriteValue": "Schreibt ein ``Namen: Wert`` Wertepaar auf die serielle Schnittstelle.",
|
||||
"bluetooth.uartWriteValue|param|name": "Name des Wertestreams, z.B.: x",
|
||||
|
@ -138,7 +138,7 @@ function getNoteName(frequency: number): string {
|
||||
}
|
||||
}
|
||||
|
||||
var notes = [
|
||||
let notes = [
|
||||
note(Note.E, BeatFraction.Quarter), note(Note.E, BeatFraction.Quarter), note(Note.F, BeatFraction.Quarter),
|
||||
note(Note.G, BeatFraction.Quarter), note(Note.G, BeatFraction.Quarter), note(Note.F, BeatFraction.Quarter),
|
||||
note(Note.E, BeatFraction.Quarter), note(Note.D, BeatFraction.Quarter), note(Note.C, BeatFraction.Quarter),
|
||||
@ -166,7 +166,7 @@ var notes = [
|
||||
note(Note.C, BeatFraction.Eighth), note(Note.C, BeatFraction.Half)
|
||||
];
|
||||
|
||||
for (var t = 0; t < notes.length; t++) {
|
||||
for (let t = 0; t < notes.length; t++) {
|
||||
music.playTone(notes[t][0], notes[t][1]);
|
||||
basic.showString(getNoteName(notes[t][0]));
|
||||
music.rest(whole - notes[t][1]);
|
||||
|
@ -230,6 +230,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|param|name": "pin to write to",
|
||||
"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|param|name": "pin to set the pull mode on",
|
||||
"pins.setPull|param|pull": "one of the mbed pull configurations: PullUp, PullDown, PullNone ",
|
||||
|
@ -83,18 +83,22 @@
|
||||
"Note.GSharp4|block": "G#4",
|
||||
"Note.GSharp5|block": "G#5",
|
||||
"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.PullNone|block": "none",
|
||||
"PinPullMode.PullUp|block": "up",
|
||||
"Rotation.Pitch|block": "pitch",
|
||||
"Rotation.Roll|block": "roll",
|
||||
"String.charAt|block": "char from %this|at %pos",
|
||||
"String.compare|block": "compare %this| to %that",
|
||||
"String.concat|block": "join %this|%other",
|
||||
"String.charAt|block": "char from %this=text|at %pos",
|
||||
"String.compare|block": "compare %this=text| to %that",
|
||||
"String.concat|block": "join %this=text|%other",
|
||||
"String.fromCharCode|block": "text from char code %code",
|
||||
"String.isEmpty|block": "%this| is empty",
|
||||
"String.isEmpty|block": "%this=text| is empty",
|
||||
"String.length|block": "length of %VALUE",
|
||||
"String.substr|block": "substring of %this|from %start|of length %length",
|
||||
"String.substr|block": "substring of %this=text|from %start|of length %length",
|
||||
"String|block": "String",
|
||||
"basic.clearScreen|block": "clear screen",
|
||||
"basic.color|block": "%c",
|
||||
@ -164,8 +168,10 @@
|
||||
"music.setTempo|block": "set tempo to (bpm)|%value",
|
||||
"music.tempo|block": "tempo (bpm)",
|
||||
"music|block": "music",
|
||||
"pins.analogPitch|block": "analog pitch %frequency|for (ms) %ms",
|
||||
"pins.analogReadPin|block": "analog read|pin %name",
|
||||
"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.digitalReadPin|block": "digital read|pin %name",
|
||||
"pins.digitalWritePin|block": "digital write|pin %name|to %value",
|
||||
@ -177,6 +183,7 @@
|
||||
"pins.pulseIn|block": "pulse in (µs)|pin %name|pulsed %value",
|
||||
"pins.servoSetPulse|block": "servo set pulse|pin %value|to (µs) %micros",
|
||||
"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.spiWrite|block": "spi write %value",
|
||||
"pins|block": "pins",
|
||||
|
@ -71,7 +71,6 @@
|
||||
"control.waitMicros|param|micros": "Anzahl der Mikrosekunden, die gewartet werden soll, z.B.: 4",
|
||||
"game": "Eine Einzel-LED-Sprite-Spielumgebung",
|
||||
"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|param|points": "Anzahl von zu verändernden Punkten, z.B.: 1",
|
||||
"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.life": "Ruft das aktuelle Leben ab",
|
||||
"game.removeLife": "Entfernt ein Leben",
|
||||
"game.removeLife|param|life": "TODO",
|
||||
"game.score": "Ruft den aktuellen Punktestand ab",
|
||||
"game.setLife": "Setzt den aktuellen Wert der Leben",
|
||||
"game.setLife|param|value": "TODO",
|
||||
"game.setScore": "Setzt den aktuellen Wert des Spielstands",
|
||||
"game.setScore|param|value": "TODO",
|
||||
"game.showScore": "Zeigt den Spielstand auf dem Display.",
|
||||
"game.startCountdown": "Startet einen Spiel-Countdown",
|
||||
"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.",
|
||||
"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|param|dimension": "TODO",
|
||||
"input.buttonIsPressed": "Erhalte den Sie den Tastenstatus (gepresst oder nicht) für ``A`` und ``B``.",
|
||||
"input.calibrate": "Veraltet, Kompasskalibrierung erfolgt automatisch.",
|
||||
"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.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|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|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|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|param|body": "TODO",
|
||||
"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|name": "Der Pin, der gehalten werden muss",
|
||||
"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|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|param|body": "TODO",
|
||||
"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|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|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|param|kind": "TODO",
|
||||
"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|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.enable": "Schaltet das Display an und aus",
|
||||
"led.fadeIn": "Blendet die Bildschirmanzeige ein.",
|
||||
"led.fadeIn|param|ms": "TODO",
|
||||
"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.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|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.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|param|x": "TODO",
|
||||
"led.point|param|y": "TODO",
|
||||
"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|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.toggle": "Schaltet ein bestimmtes Pixel ein",
|
||||
"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|param|x": "TODO",
|
||||
"led.unplot|param|y": "TODO",
|
||||
"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.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|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|param|name": "der Name der Notiz",
|
||||
"music.playTone": "Spielt einen Ton für den angegebenen Zeitraum auf dem Lautsprecher ab.",
|
||||
"music.playTone|param|ms": "Tondauer in Millisekunden (ms)",
|
||||
"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.",
|
||||
"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|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|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|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|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.createBuffer": "Erstellt einen Null-initialisierten Zwischenspeicher.",
|
||||
"pins.createBuffer|param|size": "Anzahl der Bytes im Zwischenspeicher",
|
||||
"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|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.i2cReadBuffer": "Lese `Größe`bytes 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|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|param|name": "Pin, auf den geschrieben werden soll",
|
||||
"pins.servoWritePin|param|value": "Winkel oder Rotationsbeschleunigung, z.B.: 180,90,0",
|
||||
"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.spiWrite": "Schreibe in den SPI-Slave und gebe die Antwort aus",
|
||||
"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|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|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.writeNumber": "Gibt einen numerischen Wert an die serielle",
|
||||
"serial.writeString": "Sendet ein Stück Text über serielle Verbindung.",
|
||||
|
@ -57,6 +57,10 @@ enum EventBusValue {
|
||||
MICROBIT_BUTTON_EVT_CLICK_ = MICROBIT_BUTTON_EVT_CLICK,
|
||||
MICROBIT_RADIO_EVT_DATAGRAM_ = MICROBIT_RADIO_EVT_DATAGRAM,
|
||||
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_ALARM2_ = MES_ALERT_EVT_ALARM2,
|
||||
MES_ALERT_EVT_ALARM3_ = MES_ALERT_EVT_ALARM3,
|
||||
|
31
libs/core/enums.d.ts
vendored
31
libs/core/enums.d.ts
vendored
@ -176,6 +176,10 @@ declare namespace input {
|
||||
MICROBIT_BUTTON_EVT_CLICK = 3, // MICROBIT_BUTTON_EVT_CLICK
|
||||
MICROBIT_RADIO_EVT_DATAGRAM = 1, // MICROBIT_RADIO_EVT_DATAGRAM
|
||||
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_ALARM2 = 7, // MES_ALERT_EVT_ALARM2
|
||||
MES_ALERT_EVT_ALARM3 = 8, // MES_ALERT_EVT_ALARM3
|
||||
@ -310,16 +314,25 @@ 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 {
|
||||
P0 = 7, // MICROBIT_ID_IO_P0
|
||||
P1 = 8, // MICROBIT_ID_IO_P1
|
||||
P2 = 9, // MICROBIT_ID_IO_P2
|
||||
//P8 = MICROBIT_ID_IO_P8,
|
||||
//P12 = MICROBIT_ID_IO_P12,
|
||||
//P13 = MICROBIT_ID_IO_P13,
|
||||
//P14 = MICROBIT_ID_IO_P14,
|
||||
//P15 = MICROBIT_ID_IO_P15,
|
||||
//P16 = MICROBIT_ID_IO_P16
|
||||
C16 = 9, // MICROBIT_ID_IO_P2
|
||||
C17 = 15, // MICROBIT_ID_IO_P8
|
||||
P0 = 19, // MICROBIT_ID_IO_P12
|
||||
P1 = 7, // MICROBIT_ID_IO_P0
|
||||
P2 = 8, // MICROBIT_ID_IO_P1
|
||||
P3 = 23, // MICROBIT_ID_IO_P16
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,9 +43,9 @@ namespace ImageMethods {
|
||||
*/
|
||||
//% help=images/show-image weight=80 blockNamespace=images
|
||||
//% blockId=device_show_image_offset block="show image %sprite|at offset %offset" blockGap=8
|
||||
//% parts="ledmatrix"
|
||||
void showImage(Image sprite, int xOffset) {
|
||||
uBit.display.print(MicroBitImage(sprite), -xOffset, 0, 0);
|
||||
//% parts="ledmatrix" async
|
||||
void showImage(Image sprite, int xOffset, int interval = 400) {
|
||||
uBit.display.print(MicroBitImage(sprite), -xOffset, 0, 0, interval);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -150,7 +150,7 @@ namespace ImageMethods {
|
||||
*/
|
||||
//% weight=70 help=images/show-frame
|
||||
//% parts="ledmatrix"
|
||||
void showFrame(Image i, int frame) {
|
||||
showImage(i, frame * 5);
|
||||
void showFrame(Image i, int frame, int interval = 400) {
|
||||
showImage(i, frame * 5, interval);
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,17 @@ enum class PinPullMode {
|
||||
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) {
|
||||
switch (id) {
|
||||
case MICROBIT_ID_IO_P0: return &uBit.io.P0;
|
||||
@ -223,7 +234,8 @@ namespace pins {
|
||||
* Sets the pin used when using `pins->analog pitch`.
|
||||
* @param name TODO
|
||||
*/
|
||||
//% help=pins/analog-set-pitch weight=12
|
||||
//% blockId=device_analog_set_pitch_pin block="analog set pitch pin %name"
|
||||
//% help=pins/analog-set-pitch weight=3 advanced=true
|
||||
void analogSetPitchPin(AnalogPin name) {
|
||||
pitchPin = getPin((int)name);
|
||||
}
|
||||
@ -233,9 +245,11 @@ namespace pins {
|
||||
* @param frequency TODO
|
||||
* @param ms TODO
|
||||
*/
|
||||
//% help=pins/analog-pitch weight=14 async
|
||||
//% blockId=device_analog_pitch block="analog pitch %frequency|for (ms) %ms"
|
||||
//% help=pins/analog-pitch weight=4 async advanced=true blockGap=8
|
||||
void analogPitch(int frequency, int ms) {
|
||||
if (pitchPin == NULL) return;
|
||||
if (pitchPin == NULL)
|
||||
analogSetPitchPin(AnalogPin::P1);
|
||||
if (frequency <= 0) {
|
||||
pitchPin->setAnalogValue(0);
|
||||
} else {
|
||||
@ -267,6 +281,18 @@ namespace pins {
|
||||
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.
|
||||
* @param size number of bytes in the buffer
|
||||
|
@ -1,15 +1,12 @@
|
||||
#include "pxt.h"
|
||||
|
||||
enum SerialPin {
|
||||
P0 = MICROBIT_ID_IO_P0,
|
||||
P1 = MICROBIT_ID_IO_P1,
|
||||
P2 = MICROBIT_ID_IO_P2,
|
||||
//P8 = MICROBIT_ID_IO_P8,
|
||||
//P12 = MICROBIT_ID_IO_P12,
|
||||
//P13 = MICROBIT_ID_IO_P13,
|
||||
//P14 = MICROBIT_ID_IO_P14,
|
||||
//P15 = MICROBIT_ID_IO_P15,
|
||||
//P16 = MICROBIT_ID_IO_P16
|
||||
C16 = MICROBIT_ID_IO_P2,
|
||||
C17 = MICROBIT_ID_IO_P8,
|
||||
P0 = MICROBIT_ID_IO_P12,
|
||||
P1 = MICROBIT_ID_IO_P0,
|
||||
P2 = MICROBIT_ID_IO_P1,
|
||||
P3 = MICROBIT_ID_IO_P16,
|
||||
};
|
||||
|
||||
enum BaudRate {
|
||||
|
24
libs/core/shims.d.ts
vendored
24
libs/core/shims.d.ts
vendored
@ -40,8 +40,8 @@ declare interface Image {
|
||||
*/
|
||||
//% help=images/show-image weight=80 blockNamespace=images
|
||||
//% blockId=device_show_image_offset block="show image %sprite|at offset %offset" blockGap=8
|
||||
//% parts="ledmatrix" shim=ImageMethods::showImage
|
||||
showImage(xOffset: number): void;
|
||||
//% parts="ledmatrix" async interval.defl=400 shim=ImageMethods::showImage
|
||||
showImage(xOffset: number, interval?: number): void;
|
||||
|
||||
/**
|
||||
* Draws the ``index``-th frame of the image on the screen.
|
||||
@ -118,8 +118,8 @@ declare interface Image {
|
||||
* @param frame TODO
|
||||
*/
|
||||
//% weight=70 help=images/show-frame
|
||||
//% parts="ledmatrix" shim=ImageMethods::showFrame
|
||||
showFrame(frame: number): void;
|
||||
//% parts="ledmatrix" interval.defl=400 shim=ImageMethods::showFrame
|
||||
showFrame(frame: number, interval?: number): void;
|
||||
}
|
||||
|
||||
|
||||
@ -651,7 +651,8 @@ declare namespace pins {
|
||||
* Sets the pin used when using `pins->analog pitch`.
|
||||
* @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;
|
||||
|
||||
/**
|
||||
@ -659,7 +660,8 @@ declare namespace pins {
|
||||
* @param frequency 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;
|
||||
|
||||
/**
|
||||
@ -671,6 +673,16 @@ declare namespace pins {
|
||||
//% blockId=device_set_pull block="set pull|pin %pin|to %pull" shim=pins::setPull
|
||||
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.
|
||||
* @param size number of bytes in the buffer
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pxt-calliope",
|
||||
"version": "0.8.3",
|
||||
"version": "0.8.18",
|
||||
"description": "Calliope Mini editor for PXT",
|
||||
"keywords": [
|
||||
"JavaScript",
|
||||
@ -34,6 +34,9 @@
|
||||
"semantic-ui-less": "^2.2.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"pxt-core": "0.10.15"
|
||||
"pxt-core": "0.11.26"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node node_modules/pxt-core/built/pxt.js travis"
|
||||
}
|
||||
}
|
||||
|
@ -14,8 +14,8 @@
|
||||
"cloud": {
|
||||
"workspace": false,
|
||||
"packages": true,
|
||||
"sharing": true,
|
||||
"publish": true,
|
||||
"sharing": false,
|
||||
"publishing": false,
|
||||
"preferredPackages": [
|
||||
],
|
||||
"githubPackages": true
|
||||
@ -55,6 +55,7 @@
|
||||
"loopsBlocks": true,
|
||||
"logicBlocks": true,
|
||||
"variablesBlocks": true,
|
||||
"textBlocks": true,
|
||||
"onStartColor": "#54C9C9",
|
||||
"onStartNamespace": "basic"
|
||||
},
|
||||
@ -167,11 +168,11 @@
|
||||
}
|
||||
},
|
||||
"compileService": {
|
||||
"yottaTarget": "bbc-microbit-classic-gcc",
|
||||
"yottaTarget": "calliope-mini-classic-gcc",
|
||||
"yottaCorePackage": "microbit",
|
||||
"githubCorePackage": "calliope-mini/microbit",
|
||||
"gittag": "2.0.0-rc7-calliope-p2",
|
||||
"serviceId": "microbit"
|
||||
"gittag": "v2.0.0-rc7-calliope-p9",
|
||||
"serviceId": "calliope"
|
||||
},
|
||||
"serial": {
|
||||
"manufacturerFilter": "^mbed$",
|
||||
@ -193,6 +194,7 @@
|
||||
"privacyUrl": "https://go.microsoft.com/fwlink/?LinkId=521839",
|
||||
"termsOfUseUrl": "https://go.microsoft.com/fwlink/?LinkID=206977",
|
||||
"githubUrl": "https://github.com/Microsoft/pxt-calliope",
|
||||
"crowdinProject": "kindscript",
|
||||
"organization": "Microsoft",
|
||||
"organizationUrl": "https://pxt.io/",
|
||||
"organizationLogo": "./static/Microsoft-logo_rgb_c-gray.png",
|
||||
|
@ -223,10 +223,10 @@ namespace pxsim {
|
||||
return DAL.MICROBIT_ACCELEROMETER_EVT_TILT_UP;
|
||||
|
||||
if (this.getZ() < (-1000 + DAL.MICROBIT_ACCELEROMETER_TILT_TOLERANCE))
|
||||
return DAL.MICROBIT_ACCELEROMETER_EVT_FACE_UP;
|
||||
return DAL.MICROBIT_ACCELEROMETER_EVT_FACE_DOWN;
|
||||
|
||||
if (this.getZ() > (1000 - DAL.MICROBIT_ACCELEROMETER_TILT_TOLERANCE))
|
||||
return DAL.MICROBIT_ACCELEROMETER_EVT_FACE_DOWN;
|
||||
return DAL.MICROBIT_ACCELEROMETER_EVT_FACE_UP;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -129,10 +129,11 @@ namespace pxsim.images {
|
||||
}
|
||||
|
||||
namespace pxsim.ImageMethods {
|
||||
export function showImage(leds: Image, offset: number) {
|
||||
export function showImage(leds: Image, offset: number, interval: number) {
|
||||
pxtrt.nullCheck(leds)
|
||||
leds.copyTo(offset, 5, board().ledMatrixState.image, 0)
|
||||
runtime.queueDisplayUpdate()
|
||||
basic.pause(interval);
|
||||
}
|
||||
|
||||
export function plotImage(leds: Image, offset: number): void {
|
||||
@ -155,8 +156,8 @@ namespace pxsim.ImageMethods {
|
||||
ImageMethods.plotImage(leds, frame * Image.height);
|
||||
}
|
||||
|
||||
export function showFrame(leds: Image, frame: number) {
|
||||
ImageMethods.showImage(leds, frame * Image.height);
|
||||
export function showFrame(leds: Image, frame: number, interval: number) {
|
||||
ImageMethods.showImage(leds, frame * Image.height, interval);
|
||||
}
|
||||
|
||||
export function pixel(leds: Image, x: number, y: number): number {
|
||||
|
@ -119,6 +119,9 @@ namespace pxsim.pins {
|
||||
export function getPinAddress(name: number) {
|
||||
return getPin(name)
|
||||
}
|
||||
|
||||
export function setEvents(name: number, event: number) {
|
||||
}
|
||||
}
|
||||
|
||||
namespace pxsim.devices {
|
||||
|
@ -1728,7 +1728,7 @@ namespace pxsim.visuals {
|
||||
let ay = (ev.clientY - bbox.height / 2) / (bbox.height / 3);
|
||||
|
||||
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 z = Math.floor((z2 > 0 ? -1 : 1) * Math.sqrt(Math.abs(z2)));
|
||||
|
||||
|
@ -7,4 +7,3 @@ export KS_FORCE_CLOUD=yes
|
||||
(cd libs/lang-test0; node ../../node_modules/pxt-core/built/pxt.js test)
|
||||
(cd libs/lang-test1; node ../../node_modules/pxt-core/built/pxt.js test)
|
||||
node node_modules/pxt-core/built/pxt.js testdir tests
|
||||
(cd libs/hello; node ../../node_modules/pxt-core/built/pxt.js testconv https://az851932.vo.msecnd.net/files/td-converter-tests-v1.json)
|
||||
|
Loading…
Reference in New Issue
Block a user