Logicarium

Tutorial: Your First Circuit

Build a simple interactive circuit using the script editor

This tutorial will guide you through creating a simple interactive circuit using the script editor. We will build a basic Logic Tester that lights up an LED when two buttons are pressed.

Prerequisites

Make sure you have Logicarium installed. See the Installation guide if needed.

Building an AND Gate Circuit

Open the Script Editor

Launch Logicarium. If the script editor on the right is collapsed, click the < button at the top-right corner to expand it.

You can also press Tab to toggle the script editor.

Add Components

In the script editor, we'll define our components. We need:

  • Two switches (Inputs)
  • One AND gate
  • One LED (Output)

Clear any existing script and paste:

In switch1 @ 100, 100
In switch2 @ 100, 250
AND logic @ 300, 175
Out led @ 500, 175

Click Apply (or the refresh icon). Four nodes should appear on the canvas.

Connect the Wires

Now we tell the signals where to flow. Add these lines to connect:

  • switch1 and switch2 to the logic gate inputs
  • The logic output to the led
switch1.out -> logic.in0
switch2.out -> logic.in1
logic.out -> led.in

Click Apply. Wires now connect your nodes!

Test Your Circuit!

  1. Click the button inside switch1 — it toggles to ON
  2. The LED is still OFF (AND requires both inputs HIGH)
  3. Click switch2 to toggle it ON
  4. The LED lights up! Both inputs are HIGH.

Congratulations! You've built a working AND gate circuit.

Complete Script

Here's the full script for reference:

In switch1 @ 100, 100
In switch2 @ 100, 250
AND logic @ 300, 175
Out led @ 500, 175

switch1.out -> logic.in0
switch2.out -> logic.in1
logic.out -> led.in

Variations

Momentary Push Buttons

Want buttons that only stay ON while held? Add the momentary flag:

In switch1 @ 100, 100 momentary
In switch2 @ 100, 250 momentary
AND logic @ 300, 175
Out led @ 500, 175

switch1.out -> logic.in0
switch2.out -> logic.in1
logic.out -> led.in

Now buttons show PUSH and only send a signal while clicked.

Simple Inverter

A NOT gate inverts the input signal:

In switch @ 100, 100
NOT inverter @ 250, 100
Out led @ 400, 100

switch -> inverter -> led

When the switch is OFF, the LED is ON (and vice versa).

Building an OR Gate

Since only AND and NOT are built-in, let's build OR using De Morgan's Law:

// Define OR: NOT(NOT(a) AND NOT(b))
define OR(a, b) -> (out):
  na = NOT a
  nb = NOT b
  t = na AND nb
  out = NOT t
end

// Use it
In switch1 @ 100, 100
In switch2 @ 100, 250
OR logic @ 300, 175
Out led @ 500, 175

switch1 -> logic.in0
switch2 -> logic.in1
logic -> led

The LED lights up when either switch is ON.

Understanding the Syntax

CodeMeaning
In name @ x, yCreate an input switch at position (x, y)
Out name @ x, yCreate an output LED at position (x, y)
AND name @ x, yCreate an AND gate at position (x, y)
NOT name @ x, yCreate a NOT gate at position (x, y)
a.out -> b.inConnect a's output to b's input
momentaryMakes input a push-button instead of toggle

What's Next?

On this page