Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
559a43e17b | ||
|
|
7671bc46ad | ||
|
|
b3c5f2926d | ||
|
|
7fbbb5e65a | ||
|
|
51ebc29887 | ||
|
|
f5d1722eae | ||
|
|
5f876d5ea9 | ||
|
|
31de8892fa | ||
|
|
0d0a68122d | ||
|
|
4ad660568e | ||
|
|
58e82a571d | ||
|
|
e629b866d5 | ||
|
|
f0ac2b7a05 | ||
|
|
e3c8db28e4 | ||
|
|
2c0e19a120 | ||
|
|
595eb788b2 | ||
|
|
2e15d22e9e | ||
|
|
57082654a9 | ||
|
|
8cbf7d38e3 | ||
|
|
a99a7325bf | ||
|
|
fa3ed9dd21 | ||
|
|
45fd40a553 | ||
|
|
5a18bea9eb | ||
|
|
d310312841 | ||
|
|
a4b93f7199 | ||
|
|
538a4b7bbf | ||
|
|
0078e7bc12 | ||
|
|
d2726133a9 | ||
|
|
00f4c9cbb3 | ||
|
|
e15da5dee1 | ||
|
|
85dda4ea84 | ||
|
|
a3ffe4e1cf | ||
|
|
90c4d4f73b | ||
|
|
6484d559d6 | ||
|
|
357436f14d |
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"appref": "v0.6.36"
|
||||
"appref": "v0.7.41"
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ and press **A** to scroll your text.
|
||||
### Step 5
|
||||
|
||||
Place more blocks to display a smiley when button **B** is pressed.
|
||||
Use the dropdown to find ``B``!
|
||||
|
||||
```block
|
||||
input.onButtonPressed(Button.B, () => {
|
||||
@@ -59,3 +60,15 @@ input.onGesture(Gesture.Shake, () => {
|
||||
`)
|
||||
})
|
||||
```
|
||||
|
||||
### Step 7
|
||||
|
||||
Drag more blocks to display a random number when pin ``P0`` is touched.
|
||||
Hold your right thumb on the ``GND`` metal pin
|
||||
at press the ``0`` pin with your right hand to trigger this event.
|
||||
|
||||
```block
|
||||
input.onPinPressed(TouchPin.P0, () => {
|
||||
basic.showNumber(Math.random(7))
|
||||
})
|
||||
```
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"versions": {
|
||||
"0": {
|
||||
"latest": "v0.7.23",
|
||||
"latest": "v0.7.41",
|
||||
"banned": [],
|
||||
"prompt": "v1.0.0"
|
||||
"prompt": "v0.7.41"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
<xml xmlns="http://www.w3.org/1999/xhtml">
|
||||
<block type="pxt-on-start"></block>
|
||||
<block type="device_forever"></block>
|
||||
</xml>
|
||||
@@ -338,10 +338,10 @@ namespace pxt {
|
||||
|
||||
void Segment::print()
|
||||
{
|
||||
printf("Segment: %x, length: %u, size: %u\n", data, (uint)length, (uint)size);
|
||||
for(uint i = 0; i < size; i++)
|
||||
printf("Segment: %x, length: %u, size: %u\n", data, (uint32_t)length, (uint32_t)size);
|
||||
for(uint32_t i = 0; i < size; i++)
|
||||
{
|
||||
printf("%d ",(uint)data[i]);
|
||||
printf("%d ",(uint32_t)data[i]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "pxt-microbit",
|
||||
"version": "0.7.28",
|
||||
"version": "0.7.42",
|
||||
"description": "micro:bit target for PXT",
|
||||
"keywords": [
|
||||
"JavaScript",
|
||||
@@ -36,6 +36,6 @@
|
||||
"semantic-ui-less": "^2.2.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"pxt-core": "0.9.5"
|
||||
"pxt-core": "0.10.13"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
"deployDrives": "(MICROBIT|MBED)",
|
||||
"driveName": "MICROBIT",
|
||||
"hexMimeType": "application/x-microbit-hex",
|
||||
"openocdScript": "source [find interface/cmsis-dap.cfg]; source [find target/nrf51.cfg]",
|
||||
"upgrades": [
|
||||
{
|
||||
"type": "package",
|
||||
@@ -72,7 +73,8 @@
|
||||
"logicBlocks": true,
|
||||
"variablesBlocks": true,
|
||||
"onStartColor": "#0078D7",
|
||||
"onStartNamespace": "basic"
|
||||
"onStartNamespace": "basic",
|
||||
"onStartWeight": 54
|
||||
},
|
||||
"simulator": {
|
||||
"autoRun": true,
|
||||
@@ -337,4 +339,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ namespace pxsim {
|
||||
radioState: RadioState;
|
||||
// TODO: not singletons
|
||||
neopixelState: NeoPixelState;
|
||||
servosState: MicroServosState;
|
||||
fileSystem: FileSystemState;
|
||||
|
||||
constructor() {
|
||||
@@ -53,7 +52,13 @@ namespace pxsim {
|
||||
0,
|
||||
DAL.MICROBIT_ID_IO_P19,
|
||||
DAL.MICROBIT_ID_IO_P20
|
||||
]
|
||||
],
|
||||
servos: {
|
||||
"P0": DAL.MICROBIT_ID_IO_P0,
|
||||
"P1": DAL.MICROBIT_ID_IO_P1,
|
||||
"P2": DAL.MICROBIT_ID_IO_P2,
|
||||
"P3": DAL.MICROBIT_ID_IO_P3
|
||||
}
|
||||
});
|
||||
this.builtinParts["radio"] = this.radioState = new RadioState(runtime);
|
||||
this.builtinParts["accelerometer"] = this.accelerometerState = new AccelerometerState(runtime);
|
||||
@@ -62,12 +67,7 @@ namespace pxsim {
|
||||
this.builtinParts["lightsensor"] = this.lightSensorState = new LightSensorState();
|
||||
this.builtinParts["compass"] = this.compassState = new CompassState();
|
||||
this.builtinParts["neopixel"] = this.neopixelState = new NeoPixelState();
|
||||
this.builtinParts["microservo"] = this.servosState = new MicroServosState({
|
||||
"P0": DAL.MICROBIT_ID_IO_P0,
|
||||
"P1": DAL.MICROBIT_ID_IO_P1,
|
||||
"P2": DAL.MICROBIT_ID_IO_P2,
|
||||
"P3": DAL.MICROBIT_ID_IO_P3
|
||||
});
|
||||
this.builtinParts["microservo"] = this.edgeConnectorState;
|
||||
|
||||
this.builtinVisuals["buttonpair"] = () => new visuals.ButtonPairView();
|
||||
this.builtinVisuals["ledmatrix"] = () => new visuals.LedMatrixView();
|
||||
|
||||
@@ -76,8 +76,7 @@ namespace pxsim.pins {
|
||||
if (!pin) return;
|
||||
|
||||
analogSetPeriod(pinId, 20000);
|
||||
const state = board().servosState.servoState(pinId);
|
||||
state.setAngle(value);
|
||||
pin.servoAngle = value;
|
||||
}
|
||||
|
||||
export function servoSetPulse(pinId: number, micros: number) {
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace pxsim {
|
||||
this.data = data;
|
||||
}
|
||||
public print() {
|
||||
console.log(`Image id:${this.id} refs:${this.refcnt} size:${this.width}x${Image.height}`)
|
||||
// console.debug(`Image id:${this.id} refs:${this.refcnt} size:${this.width}x${Image.height}`)
|
||||
}
|
||||
public get(x: number, y: number): number {
|
||||
if (x < 0 || x >= this.width || y < 0 || y >= 5) return 0;
|
||||
|
||||
Reference in New Issue
Block a user