Skip to content

Commit

Permalink
fix workbook tutorials in v6 (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
Amerlander authored Sep 24, 2024
1 parent f1ed402 commit 956d325
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 25 deletions.
6 changes: 3 additions & 3 deletions docs/calliope/arbeitsheft/23-4_fitness.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 23 4_Fitness

```ghost
let Tempo = 1000
let tempo = 1000
basic.setLedColor(0xff0000)
basic.pause(tempo)
for (let index = 0; index < 2; index++) {
Expand Down Expand Up @@ -37,8 +37,8 @@ Complete your program.
## Use variables @showdialog
Use a variable to define the speed of your animation and adjust it easily.

## Create variable Tempo
Create a ``||variables.variable||`` and name it "Tempo".
## Create variable tempo
Create a ``||variables.variable||`` and name it "tempo".

```
```
Expand Down
11 changes: 6 additions & 5 deletions docs/calliope/arbeitsheft/33-4_licht.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
# 33 4 Light

```ghost
let brightness = input.lightLevel();
input.onButtonEvent(Button.B, input.buttonEventClick(), function () {
basic.showNumber(Licht)
basic.showNumber(brightness)
})
```

## Task @showdialog
Write a program that saves the measured light value in a variable when the LED matrix is switched off and then display the saved value on the LED matrix.

## Create variable
Create a ``||variables.variable||`` and name it "Light".
Create a ``||variables.variable||`` and name it "brightness".

```
```
![](https://calliope.cc/tutorials/variable_licht.png)

## Save light intensity @showdialog
If button A is clicked, save the measured light intensity in the variable "Light".
If button A is clicked, save the measured light intensity in the variable "brightness".

## Define input
Select the block ``||input.on button A is clicked|||`` as input.
Expand All @@ -28,15 +29,15 @@ Use the ``||variables.set light to||`` block to set the value of the variable to


## Show light intensity @showdialog
When button B is clicked, show the value of the variable "Light".
When button B is clicked, show the value of the variable "brightness".

## Define input
Place another block ``|| input.on button A ||`` clicked and change it to ``|| input.on button B ||`` clicked.

![Button B](https://calliope.cc/tutorials/kopf_a_b.png)

## Define output
Use the ``|| basic.show number||`` block and display the value of the variable``||variables.light||``.
Use the ``|| basic.show number||`` block and display the value of the variable``||variables.brightness||``.


## Done! 👏
Expand Down
4 changes: 2 additions & 2 deletions docs/calliope/arbeitsheft/35-1_smart-licht.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

```ghost
basic.forever(function () {
if (input.lightLevel() > 20) {
if (input.soundLevel() > 20) {
basic.showLeds(`
# # # # #
# # # # #
Expand All @@ -28,7 +28,7 @@ The clapping is recognized via a permanent query of the measured volume values.

## Create condition
Define a threshold value, e.g. `20` for the volume of your clap!
Replace the "true" block in the query with a ``||logic.compare (=)||`` block to compare the measured ``||input.light level||`` with the threshold value.
Replace the "true" block in the query with a ``||logic.compare (=)||`` block to compare the measured ``||input.sound level||`` with the threshold value.



Expand Down
21 changes: 11 additions & 10 deletions docs/calliope/arbeitsheft/42-2_orakel.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# 42 2 Oracle

```ghost
let Zufall = 0
let zufall = 0
input.onGesture(Gesture.Shake, function () {
Zufall = randint(0, 2)
if (Zufall == 1) {
basic.showString("Ja")
}
if (Zufall == 2) {
basic.showString("Nein")
}
if (Zufall == 3) {
basic.showString("Vielleicht")
zufall = randint(0, 2)
if (zufall == 1) {
basic.showString("Ja")
}
if (zufall == 2) {
basic.showString("Nein")
}
if (zufall == 3) {
basic.showString("Vielleicht")
}
}
```

Expand Down
8 changes: 4 additions & 4 deletions docs/calliope/arbeitsheft/49-1_schaetzspiel.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# 49 1 Estimation game

```ghost
let Entfernung = 0
let distance = 0
input.onButtonEvent(Button.A, input.buttonEventValue(ButtonEvent.Click), function () {
Entfernung = Math.round(grove.measureInCentimeters(DigitalPin.C16))
distance = Math.round(grove.measureInCentimeters(DigitalPin.C16))
})
input.onButtonEvent(Button.B, input.buttonEventValue(ButtonEvent.Click), function () {
basic.showNumber(Entfernung)
basic.showNumber(distance)
})
basic.forever(function () {
basic.showLeds(`
Expand All @@ -32,7 +32,7 @@ Press button A to measure the distance and save it in a variable. Press button B
Insert the block ``||input.on button A is clicked||`` twice and change the button to ``B`` for one block. Tip: You can duplicate the block by right-clicking.

## Define variable
To save the distance when the button is pressed and retrieve it later, create a ``||variable.variable||`` and name it *Distance*.
To save the distance when the button is pressed and retrieve it later, create a ``||variable.variable||`` and name it *distance*.


```
Expand Down
2 changes: 1 addition & 1 deletion docs/calliope/arbeitsheft/50-2_personenzaehler.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ Click on ``|Download|`` to transfer your program to your Calliope mini and test

```package
grove=github:calliope-edu/pxt-grove
```

0 comments on commit 956d325

Please sign in to comment.