Skip to content
This repository was archived by the owner on Nov 7, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The format is loosely inspired by Keep a Changelog.

### Changed

- **Web 0.14.29, VisuBot commands grouped by colour:** in the palette every mBot2 box gets a 4 px stripe on the left and every group heading a dot in the colour of its group: driving and wheels orange, light (LEDs) yellow-green, sound magenta, screen and emotions indigo, waiting and stopwatch grey, all sensors turquoise. The boxes themselves stay yellow (statement), and the structure chart and the code are unchanged. The former group „Licht, Ton und Bildschirm“ is split into „Licht“, „Ton“ and „Bildschirm“ in the palette and in the VisuBot Nachschlagen (de/en), whose `###` headings show the same dots. New lesson syntax `### Überschrift {.klasse}`. With „Blöcke farbig“ off, stripes and dots disappear. Every sub-group also gets a symbol in the palette (all languages) and in the Nachschlagen headings: 🚗 driving, ⚙️ wheels, 💡 LEDs, 🔊 sound, 🖥️ screen, 😊 emotions, ⏱️ waiting, 📏 distance, ➖ line, 🎨 colours, 🕹️ buttons/joystick, 🔆 light/loudness, 📐 tilt, 🔋 stopwatch/battery.
- **Web 0.14.27, VisuBot: `forward`/`backward` overloaded with a unit:** besides `mbot.forward()` (10 cm) and `mbot.forward(30)` there is now `mbot.forward(2, "Umdrehungen")` and `mbot.forward(30, "cm")` (en `"rotations"`, pt `"rotações"`), same for `backward`. One wheel rotation is π · 6.5 cm ≈ 20.4 cm; the action stores the distance in cm, so simulation, exercise check and the real robot (`mbot2.straight`) work unchanged, and the console shows e.g. „2 Umdrehungen vorwärts (40.84 cm)“. An unknown unit is an error naming the allowed units. The CyberPi program export gets the same overload. VisuBot lesson 22 gets a step „Gleicher Name, andere Parameter: Überladung“ with the three headers, a Ludwig Angeberwissen asking pupils to measure their own robot with a printable test record (PDF, de/en, `website/visubot/messprotokoll-radumdrehung.pdf` / `test-record-wheel-rotation.pdf`: wheel diameter, five test cases expected vs. actual, evaluation, causes, feedback for the teacher, box „So testet man Softwaresysteme“), the exercise „Quadrat mit Umdrehungen“ and a quiz; Nachschlagen, glossary („Überladung“) and code completion list the new variants (de/en).
- **Web 0.14.26, animation: nested loop fills a times table in lesson 14:** in step „Schleife in der Schleife“, after the triangle example (which keeps the names `zeile`/`stern`), a new sentence says experienced programmers call the counters `i` and `j`, followed by an animated structure chart: the active block lights up, a variables box shows `i`, `j` and `text` (pt `texto`), and the console fills line by line with `1 2 3 4`, `2 4 6 8`, `3 6 9 12`. It shows that `j` starts again at 1 on every new line. Plays once when visible, „Noch einmal abspielen“ replays it (de/en/pt).
- **Web 0.14.25, „Bombe entschärfen“: tap part of a line:** a bomb round can name the wrong part with `stelle:` (e.g. `stelle: i++`). Such rounds show the parts of every line as tappable boxes (the three fields of a `for` header, the condition of `if`/`while`, target and value of an assignment, call and arguments split at `+`); right line but wrong part gives its own hint. Lesson 13 (6 of 8 rounds) and lesson 15 (all 6 rounds) use it (de/en/pt, texts in all 21 languages).
Expand Down
44 changes: 28 additions & 16 deletions web/lessons/de/visubot/nachschlagen.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Ein Befehl sagt dem mBot2, was er **tun** soll. Jeder Befehl beginnt mit `mbot.` und endet mit Klammern. In die Klammern schreibst du oft eine Zahl.

### Fahren und Drehen
### 🚗 Fahren und Drehen {.bot-fahren}

Der mBot2 fährt geradeaus oder dreht sich auf der Stelle.

Expand All @@ -24,7 +24,7 @@ mbot.turnRight(180) dreht sich ganz um
> Für ein Vieleck dreht er sich insgesamt einmal ganz herum: Dreieck 3 × 120°, Quadrat 4 × 90°, Sechseck 6 × 60°.
### Räder einzeln
### ⚙️ Räder einzeln {.bot-fahren}

Hier gibst du jedem Rad selbst Gas. Die Zahlen sind Prozent: 100 ist volles Gas, 0 ist Stillstand, eine Zahl mit Minus fährt rückwärts. Der mBot2 fährt so lange weiter, bis ein anderer Fahrbefehl kommt.

Expand All @@ -35,24 +35,36 @@ mbot.drive(40, -40) ein Rad vor, eins zurück: dreht sich
mbot.stop() hält an
```

### Licht, Ton und Bildschirm
### 💡 Licht {.bot-licht}

Der mBot2 kann leuchten, piepen und Text zeigen.
Der mBot2 hat fünf LEDs mit den Nummern 0 bis 4.

```
mbot.setLed(255, 0, 0) alle LEDs leuchten rot
mbot.ledOff() alle LEDs aus
mbot.led(0).setColor("grün") nur LED 0 leuchtet grün
mbot.led(0).setColor("aus") nur LED 0 aus
```

Bei `setLed` mischst du Rot, Grün und Blau, jedes von 0 (aus) bis 255 (ganz hell).

### 🔊 Ton {.bot-ton}

```
mbot.playTone(440, 300) spielt einen Ton
```

Die erste Zahl ist die Tonhöhe. Je größer, desto höher. Die zweite Zahl ist die Länge in Millisekunden (1000 Millisekunden sind 1 Sekunde).

### 🖥️ Bildschirm {.bot-anzeige}

```
mbot.showText("Hallo") zeigt Hallo auf dem Bildschirm
```

- **LEDs:** Es gibt fünf LEDs mit den Nummern 0 bis 4. Bei `setLed` mischst du Rot, Grün und Blau, jedes von 0 (aus) bis 255 (ganz hell).
- **Ton:** Die erste Zahl ist die Tonhöhe. Je größer, desto höher. Die zweite Zahl ist die Länge in Millisekunden (1000 Millisekunden sind 1 Sekunde).
- **Bildschirm:** Mit `+` hängst du Text und Zahlen aneinander: `mbot.showText("Abstand: " + mbot.getDistance())`.
Mit `+` hängst du Text und Zahlen aneinander: `mbot.showText("Abstand: " + mbot.getDistance())`.

### Gefühle
### 😊 Gefühle {.bot-anzeige}

Der mBot2 zeigt ein Gefühl mit Licht, Ton und Wackeln. Das siehst du nur am echten mBot2.

Expand All @@ -64,7 +76,7 @@ mbot.emotion("wow") staunt

Weitere Gefühle: hello, yeah, proud, yummy, naughty, uh_oh, hurt, angry, startle, shiver, dizzy, sleepy, zzz, wake_up, blink, yes, no, look_up, look_down, look_left, look_right, look_around

### Warten und Stoppuhr
### ⏱️ Warten und Stoppuhr {.bot-warten}

```
mbot.pause(1000) wartet 1 Sekunde
Expand All @@ -77,7 +89,7 @@ Die Zeit der Stoppuhr liest du mit dem Sensor `mbot.getTimer()` (unten bei **Sto

Ein Sensor **misst** etwas und gibt dir einen Wert zurück. Den Wert benutzt du in einer Bedingung, zum Beispiel in einer Schleife oder Verzweigung. Manche Sensoren liefern eine **Zahl**, manche **wahr oder falsch**, einer einen **Text**.

### Abstand
### 📏 Abstand {.bot-sensor}

Der Ultraschallsensor vorn misst, wie weit die nächste Wand weg ist, in Zentimetern.

Expand All @@ -87,7 +99,7 @@ mbot.getDistance() > 15 ist vorn mehr als 15 cm frei?
int abstand = mbot.getDistance() Abstand in einer Variablen merken
```

### Linie
### ➖ Linie {.bot-sensor}

Unter dem mBot2 sitzen vier Fühler. Sie sehen, ob der Boden schwarz ist.

Expand All @@ -99,7 +111,7 @@ mbot.isLineLeft() sieht der linke mittlere Fühler Schwarz?
mbot.isLineRight() sieht der rechte mittlere Fühler Schwarz?
```

### Farben
### 🎨 Farben {.bot-sensor}

Derselbe Sensor unten erkennt auch Farben. `mbot.getColor()` gibt dir den Namen der Farbe als Text: `"rot"`, `"grün"`, `"blau"`, `"gelb"`, `"weiß"` oder `"schwarz"`.

Expand All @@ -110,7 +122,7 @@ mbot.getColor().equals("rot") steht er auf Rot?

> Texte vergleichst du mit `.equals(…)`, nicht mit `==`. Das `!` davor heißt **nicht**.
### Tasten und Joystick
### 🕹️ Tasten und Joystick {.bot-sensor}

Auf dem CyberPi gibt es die Tasten A und B und einen kleinen Joystick. Jeder Sensor sagt **wahr**, solange gedrückt wird.

Expand All @@ -123,14 +135,14 @@ mbot.isJoystickLeft() Joystick nach links gedrückt?
mbot.isJoystickRight() Joystick nach rechts gedrückt?
```

### Licht und Lautstärke
### 🔆 Licht und Lautstärke {.bot-sensor}

```
mbot.getBrightness() wie hell? 0 ist dunkel, 100 ist hell
mbot.getLoudness() wie laut? 0 ist still, 100 ist laut
```

### Neigung und Schütteln
### 📐 Neigung und Schütteln {.bot-sensor}

```
mbot.getPitch() nach vorn oder hinten gekippt? (in Grad)
Expand All @@ -140,7 +152,7 @@ mbot.isShaken() wird er geschüttelt?

> Liegt der mBot2 flach, sind beide Neigungen 0. In der Simulation stellst du diese Werte unter **🎛 Sensoren ausprobieren** ein.
### Stoppuhr und Akku
### 🔋 Stoppuhr und Akku {.bot-sensor}

```
mbot.getTimer() Sekunden seit dem Start oder seit resetTimer()
Expand Down
44 changes: 28 additions & 16 deletions web/lessons/en/visubot/nachschlagen.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A command tells the mBot2 what to **do**. Every command starts with `mbot.` and ends with brackets. Often you write a number in the brackets.

### Driving and turning
### 🚗 Driving and turning {.bot-fahren}

The mBot2 drives straight or turns on the spot.

Expand All @@ -24,7 +24,7 @@ mbot.turnRight(180) turns all the way round
> For a polygon it turns all the way round once in total: triangle 3 × 120°, square 4 × 90°, hexagon 6 × 60°.
### Wheels separately
### ⚙️ Wheels separately {.bot-fahren}

Here you give each wheel gas yourself. The numbers are percent: 100 is full gas, 0 is standing still, a number with a minus drives backwards. The mBot2 keeps going until another driving command comes.

Expand All @@ -35,24 +35,36 @@ mbot.drive(40, -40) one wheel forward, one back: it turns
mbot.stop() stops
```

### Light, sound and screen
### 💡 Light {.bot-licht}

The mBot2 can light up, beep and show text.
The mBot2 has five LEDs with the numbers 0 to 4.

```
mbot.setLed(255, 0, 0) all LEDs light up red
mbot.ledOff() all LEDs off
mbot.led(0).setColor("green") only LED 0 lights up green
mbot.led(0).setColor("off") only LED 0 off
```

With `setLed` you mix red, green and blue, each from 0 (off) to 255 (very bright).

### 🔊 Sound {.bot-ton}

```
mbot.playTone(440, 300) plays a tone
```

The first number is the pitch. The bigger, the higher. The second number is the length in milliseconds (1000 milliseconds are 1 second).

### 🖥️ Screen {.bot-anzeige}

```
mbot.showText("Hello") shows Hello on the screen
```

- **LEDs:** There are five LEDs with the numbers 0 to 4. With `setLed` you mix red, green and blue, each from 0 (off) to 255 (very bright).
- **Tone:** The first number is the pitch. The bigger, the higher. The second number is the length in milliseconds (1000 milliseconds are 1 second).
- **Screen:** With `+` you join text and numbers: `mbot.showText("Distance: " + mbot.getDistance())`.
With `+` you join text and numbers: `mbot.showText("Distance: " + mbot.getDistance())`.

### Emotions
### 😊 Emotions {.bot-anzeige}

The mBot2 shows a feeling with light, sound and wiggling. You only see it on the real mBot2.

Expand All @@ -64,7 +76,7 @@ mbot.emotion("wow") is amazed

More feelings: hello, yeah, proud, yummy, naughty, uh_oh, hurt, angry, startle, shiver, dizzy, sleepy, zzz, wake_up, blink, yes, no, look_up, look_down, look_left, look_right, look_around

### Waiting and stopwatch
### ⏱️ Waiting and stopwatch {.bot-warten}

```
mbot.pause(1000) waits 1 second
Expand All @@ -77,7 +89,7 @@ You read the stopwatch time with the sensor `mbot.getTimer()` (below under **Sto

A sensor **measures** something and gives you a value back. You use the value in a condition, for example in a loop or a branch. Some sensors give a **number**, some **true or false**, one gives a **text**.

### Distance
### 📏 Distance {.bot-sensor}

The ultrasonic sensor at the front measures how far away the next wall is, in centimetres.

Expand All @@ -87,7 +99,7 @@ mbot.getDistance() > 15 is there more than 15 cm free ahead?
int distance = mbot.getDistance() remember the distance in a variable
```

### Line
### ➖ Line {.bot-sensor}

Under the mBot2 there are four probes. They see whether the floor is black.

Expand All @@ -99,7 +111,7 @@ mbot.isLineLeft() does the left middle probe see black?
mbot.isLineRight() does the right middle probe see black?
```

### Colours
### 🎨 Colours {.bot-sensor}

The same sensor underneath also recognises colours. `mbot.getColor()` gives you the name of the colour as text: `"red"`, `"green"`, `"blue"`, `"yellow"`, `"white"` or `"black"`.

Expand All @@ -110,7 +122,7 @@ mbot.getColor().equals("red") is it standing on red?

> You compare texts with `.equals(…)`, not with `==`. The `!` in front means **not**.
### Buttons and joystick
### 🕹️ Buttons and joystick {.bot-sensor}

On the CyberPi there are the buttons A and B and a small joystick. Each sensor says **true** while it is being pressed.

Expand All @@ -123,14 +135,14 @@ mbot.isJoystickLeft() joystick pushed left?
mbot.isJoystickRight() joystick pushed right?
```

### Light and loudness
### 🔆 Light and loudness {.bot-sensor}

```
mbot.getBrightness() how bright? 0 is dark, 100 is bright
mbot.getLoudness() how loud? 0 is silent, 100 is loud
```

### Tilt and shaking
### 📐 Tilt and shaking {.bot-sensor}

```
mbot.getPitch() tipped forward or back? (in degrees)
Expand All @@ -140,7 +152,7 @@ mbot.isShaken() is it being shaken?

> When the mBot2 lies flat, both tilts are 0. In the simulation you set these values under **🎛 Try the sensors**.
### Stopwatch and battery
### 🔋 Stopwatch and battery {.bot-sensor}

```
mbot.getTimer() seconds since the start or since resetTimer()
Expand Down
4 changes: 2 additions & 2 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "visustruct-web",
"private": true,
"version": "0.14.27",
"version": "0.14.29",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
4 changes: 3 additions & 1 deletion web/src/i18n/de.strings
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,9 @@
"web_visubot_preview_limit" = "läuft sehr lange (Endlosschleife?), gezeigt ist der Anfang";
"web_visubot_group_drive" = "Fahren und Drehen";
"web_visubot_group_wheels" = "Räder einzeln";
"web_visubot_group_output" = "Licht, Ton und Bildschirm";
"web_visubot_group_leds" = "Licht";
"web_visubot_group_sound" = "Ton";
"web_visubot_group_screen" = "Bildschirm";
"web_visubot_group_emotion" = "Gefühle";
"web_visubot_group_wait" = "Warten und Stoppuhr";
"web_visubot_group_distance" = "Abstand";
Expand Down
4 changes: 3 additions & 1 deletion web/src/i18n/en.strings
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,9 @@
"web_visubot_preview_limit" = "runs for a very long time (endless loop?), showing the start";
"web_visubot_group_drive" = "Driving and turning";
"web_visubot_group_wheels" = "Wheels separately";
"web_visubot_group_output" = "Light, sound and screen";
"web_visubot_group_leds" = "Light";
"web_visubot_group_sound" = "Sound";
"web_visubot_group_screen" = "Screen";
"web_visubot_group_emotion" = "Emotions";
"web_visubot_group_wait" = "Waiting and stopwatch";
"web_visubot_group_distance" = "Distance";
Expand Down
4 changes: 3 additions & 1 deletion web/src/i18n/pt-PT.strings
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,9 @@
"web_visubot_preview_limit" = "demora muito (ciclo infinito?), mostra-se o início";
"web_visubot_group_drive" = "Andar e rodar";
"web_visubot_group_wheels" = "Rodas separadas";
"web_visubot_group_output" = "Luz, som e ecrã";
"web_visubot_group_leds" = "Luz";
"web_visubot_group_sound" = "Som";
"web_visubot_group_screen" = "Ecrã";
"web_visubot_group_emotion" = "Emoções";
"web_visubot_group_wait" = "Esperar e cronómetro";
"web_visubot_group_distance" = "Distância";
Expand Down
5 changes: 4 additions & 1 deletion web/src/learn/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ export function markdownToHTML(source: string): string {
const heading = /^(#{2,4})\s+(.*)$/.exec(line)
if (heading) {
const level = heading[1].length
out.push(`<h${level}>${inline(heading[2])}</h${level}>`)
// `### Licht {.bot-licht}`: Klasse an der Überschrift (Farbpunkt der VisuBot-Gruppe im Nachschlagen)
const cls = /\s*\{\.([a-z][a-z-]*)\}$/.exec(heading[2])
const text = cls ? heading[2].slice(0, cls.index) : heading[2]
out.push(`<h${level}${cls ? ` class="${cls[1]}"` : ''}>${inline(text)}</h${level}>`)
i++
continue
}
Expand Down
11 changes: 8 additions & 3 deletions web/src/ui/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import { progress } from '../learn/progress'
import { codeKeywords, currentLanguage, offeredLanguages, setCodeKeywords, setLanguage, t, type LanguageCode } from './i18n'
import * as Export from './exporter'
import { SimulationPanel } from './simulationPanel'
import { mbotLinkText, setVisuBotMode, setVisuFlowWorld, setVisuObjectWorld, visuBotBrand, toggleMBotLink, visuBotEnabled, visuBotMode, visuBotSensors, visuBotTemplates, VisuBotView, worldChooserHTML, worldChosen, type WorldChoice } from './visubotView'
import { mbotLinkText, setVisuBotMode, setVisuFlowWorld, setVisuObjectWorld, visuBotBrand, toggleMBotLink, visuBotEnabled, visuBotGroupColor, visuBotGroupIcon, visuBotMode, visuBotSensors, visuBotTemplates, VisuBotView, worldChooserHTML, worldChosen, type WorldChoice } from './visubotView'
import { canConnectMBot, mbotLink } from '../core/mbotLink'
import { uploadToMBot } from './mbotUpload'
import { lessons, tasks, useVisuBotContent, world } from '../learn/content'
Expand Down Expand Up @@ -744,9 +744,10 @@ export class App {
const groupTitle = (list: HTMLUListElement, group: string) => {
const li = document.createElement('li')
li.className = 'palette-group'
li.dataset.botColor = visuBotGroupColor(group)
const button = document.createElement('button')
button.type = 'button'
button.textContent = t(`web_visubot_group_${group}`)
button.textContent = [visuBotGroupIcon[group], t(`web_visubot_group_${group}`)].filter(Boolean).join(' ')
const show = (open: boolean) => {
button.setAttribute('aria-expanded', String(open))
for (const item of list.querySelectorAll<HTMLElement>(`[data-group="${group}"]`)) item.hidden = !open
Expand All @@ -765,7 +766,11 @@ export class App {
const grouped = <T extends { group: string }>(list: HTMLUListElement, items: T[], add: (item: T) => HTMLElement) => {
for (const group of new Set(items.map((i) => i.group))) {
const apply = groupTitle(list, group)
for (const item of items.filter((i) => i.group === group)) add(item).dataset.group = group
for (const item of items.filter((i) => i.group === group)) {
const el = add(item)
el.dataset.group = group
el.dataset.botColor = visuBotGroupColor(group)
}
apply()
}
}
Expand Down
Loading
Loading