three projects down
This commit is contained in:
parent
346ec3d1a6
commit
0c40f79dec
@ -4,12 +4,16 @@
|
|||||||
|
|
||||||
![](/static/mb/projects/a1-display.png)
|
![](/static/mb/projects/a1-display.png)
|
||||||
|
|
||||||
[Flashing Heart](/projects/flashing-heart)
|
## [Flashing Heart](/projects/flashing-heart)
|
||||||
|
|
||||||
![](/static/mb/projects/a2-buttons.png)
|
![](/static/mb/projects/a2-buttons.png)
|
||||||
|
|
||||||
|
## [Smiley Buttons](/projects/smiley-buttons)
|
||||||
|
|
||||||
![](/static/mb/projects/a3-pins.png)
|
![](/static/mb/projects/a3-pins.png)
|
||||||
|
|
||||||
|
## [Love Meter](/projects/love-meter)
|
||||||
|
|
||||||
![](/static/mb/projects/a4-motion.png)
|
![](/static/mb/projects/a4-motion.png)
|
||||||
|
|
||||||
![](/static/mb/projects/a5-compass.png)
|
![](/static/mb/projects/a5-compass.png)
|
||||||
@ -24,5 +28,5 @@
|
|||||||
|
|
||||||
![](/static/mb/projects/a10-watch.png)
|
![](/static/mb/projects/a10-watch.png)
|
||||||
|
|
||||||
[Rock Paper Scissors](/projects/rock-paper-scissors)
|
## [Rock Paper Scissors](/projects/rock-paper-scissors)
|
||||||
|
|
||||||
|
48
docs/projects/love-meter.md
Normal file
48
docs/projects/love-meter.md
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
![](/static/mb/projects/a3-pins.png)
|
||||||
|
|
||||||
|
Use pins P0, P1 and P2 to change the display by creating a circuit with your body.
|
||||||
|
|
||||||
|
## Step 1
|
||||||
|
|
||||||
|
Use [on pin pressed](/reference/input/on-pin-pressed) to show a random number
|
||||||
|
when pin P0 is pressed (hold the GND pin with other hand):
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
input.onPinPressed(TouchPin.P0, () => {
|
||||||
|
basic.showNumber(Math.random(11));
|
||||||
|
});
|
||||||
|
```
|
||||||
|
## Step 2
|
||||||
|
|
||||||
|
Show a string when pin P1 is pressed:
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
input.onPinPressed(TouchPin.P0, () => {
|
||||||
|
basic.showNumber(Math.random(11));
|
||||||
|
});
|
||||||
|
input.onPinPressed(TouchPin.P1, () => {
|
||||||
|
basic.showString("LOVE?");
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Step 3
|
||||||
|
|
||||||
|
Show a heart when pin P2 is pressed:
|
||||||
|
|
||||||
|
```blocks
|
||||||
|
input.onPinPressed(TouchPin.P0, () => {
|
||||||
|
basic.showNumber(Math.random(11));
|
||||||
|
});
|
||||||
|
input.onPinPressed(TouchPin.P1, () => {
|
||||||
|
basic.showString("LOVE?");
|
||||||
|
});
|
||||||
|
input.onPinPressed(TouchPin.P2, () => {
|
||||||
|
basic.showLeds(`
|
||||||
|
. # # # .
|
||||||
|
# # # # #
|
||||||
|
# # # # #
|
||||||
|
. # # # .
|
||||||
|
. . # . .
|
||||||
|
`);
|
||||||
|
});
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user