Skip to content

Commit 6636adf

Browse files
authored
Add js code block for illustrating usage of DigiSim
1 parent 3220e33 commit 6636adf

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

00_Einfuehrung.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ für die Anwendbarkeit in der (Informatik-)Lehre sprechen:
299299
* Quizze Tests und Aufgaben
300300
* spezifische Tools für die Modellierung Simulation etc.
301301

302-
```cpp
302+
```cpp ArduinoSimulator.ino
303303
void setup() {
304304
Serial.println("Hello stuff.");
305305
}
@@ -320,6 +320,31 @@ void loop() {
320320
```
321321
@NetSwarm.loop
322322
323+
```js
324+
// Init components
325+
AND(["and1", "and2"], ["and3"], "AND1");
326+
OR(["or1", "or2"], ["or3"], "OR1");
327+
XOR(["xor1", "xor2"], ["xor3"], "XOR1");
328+
Button("btn1", "BUTTON1");
329+
Button("btn2", "BUTTON2");
330+
Button("btn3", "BUTTON3");
331+
Button("btn4", "BUTTON4");
332+
Lamp("lmp1", "LAMP1");
333+
334+
// IO IN
335+
wire("btn1", "and1");
336+
wire("btn2", "and2");
337+
wire("btn3", "or1");
338+
wire("btn4", "or2");
339+
340+
// AND, OR -> XOR
341+
wire("and3", "xor1");
342+
wire("or3", "xor2");
343+
344+
// IO OUT
345+
wire("xor3", "lmp1", "Main Output");
346+
```
347+
323348
``` js @DigiSim.eval
324349
// Init components
325350
AND(["and1", "and2"], ["and3"], "AND1");

0 commit comments

Comments
 (0)