Learn to code — from zero

Never written a line of code? Perfect. On this page you'll make a real light blink and a real buzzer play a tune, just by writing a few simple lines — no wiring, no setup, nothing to install. If you can write a shopping list, you can do this.

Start right now: open the Simulator in the IDE — it's a little pretend board inside your browser, with three coloured lights, a buzzer and a button. Everything here works there first, with no hardware at all.

What is a program?

A program is just a list of instructions a machine follows, one at a time, from top to bottom — like a recipe, or the steps of a dance. The machine is fast and very obedient: it does exactly what you wrote, in the order you wrote it. Nothing more, nothing less.

So "coding" is mostly about breaking what you imagine into small, clear steps. "Turn the red light on. Wait one second. Turn it off." That's already a program.

BASIC, and our Chip BASIC

BASIC is a programming language invented in 1964 to teach complete beginners — the name literally stands for "Beginner's All-purpose Symbolic Instruction Code". It reads almost like plain English, which is exactly why we use it here.

Our version is called Chip BASIC, and it's two things in one that you use together in the same program: the timeless BASIC core — line numbers, GOTO, IF…THEN, LET, variables and maths, the same ideas as BASIC since 1964 — plus our own commands that talk to the board: LED, WAIT, SOUND, PLAY, BUTTON and whole MISSIONs.

10 LET a = 0
20 LED green, on
30 WAIT 1s
40 LED green, off
50 a = a + 1
60 IF a < 3 THEN GOTO 20
70 MISSION "ALLARME"

One program, both layers at once: classic BASIC (LET, maths, IF…THEN, GOTO) runs the loop, and our commands (LED, WAIT, MISSION) make the board act. There's no mode to switch — you just mix them on whatever line you like.

Chip BASIC's golden rule: every line starts with a number (10, 20, 30…). Those numbers set the order the lines run in and give each line a name you can jump to. Count by tens, not 1-2-3, so you can slip new lines in between later — a line between 10 and 20 becomes 15.

How Text to Chip works

You write BASIC. The browser translates it into a list of tiny, simple instructions (we call it bytecode). A small "player" then runs those instructions — either in the Simulator on screen, or on a real chip (an ESP32-S3) connected by USB.

The clever part: it's the same translated program in both places. What you see blink in the simulator is what blinks on the real board. So you can build and test everything with no hardware, then run the exact same thing on a real chip later.

The big idea: you say what you want to happen — "red light on", "play a coin sound" — not how to wire a circuit. The board already knows how.

Your first program

Let's blink the red light. Open the IDE, make sure the Simulator is selected, and type these five lines into the editor:

10 LED red, on
20 WAIT 1s
30 LED red, off
40 WAIT 1s
50 GOTO 10

Now press ▶ run (top-left). The red light turns on for a second, off for a second, on again… forever. You just wrote a program! Press ■ stop to end it.

Here's what each line says:

  • 10 LED red, on — turn the red light on.
  • 20 WAIT 1swait 1 second (the light stays on while we wait).
  • 30 LED red, off — turn the red light off.
  • 40 WAIT 1s — wait another second (now it stays off).
  • 50 GOTO 10jump back to line 10 and do it all again. That's what makes it blink forever.
Try it: change 1s to 0.2s on both WAIT lines and run again — the light blinks much faster. Changing numbers and watching what happens is how you learn.

How the lines run

The player starts at the smallest line number and walks down: 10, then 20, then 30… If it reaches the end with nothing left, it stops.

GOTO changes that path: it jumps to whatever line you name. GOTO 10 sends the player back to line 10, which creates a loop — a piece that repeats. Loops are how a traffic light keeps cycling and a blink keeps blinking.

The toolbox — every instruction

These are all the "words" Chip BASIC understands and turns into real action — the classic BASIC ones and our board commands side by side. Each card shows the shape of the instruction, what it does, and a tiny example. You don't need to memorise them — peek back here whenever you need one.

Lights, time & repeating

LED <colour>, <on|off>

Turns one of the three coloured lights on or off. Colours are red, yellow and green.

10 LED green, on
WAIT <n>s · WAIT <n>ms

Pauses the program. Use s for seconds or ms for milliseconds (1000 ms = 1 s). Decimals like 0.5s are fine. Whatever was on or off stays that way while it waits.

20 WAIT 2s
GOTO <line>

Jumps to another line number — the program carries on from there. Use it to loop, or to skip ahead.

50 GOTO 10
END

Stops the program cleanly. (A program that loops with GOTO never reaches an END — you stop it with the ■ button.)

90 END
REM <note>

A note to yourself. The machine ignores everything after REM, so use it to explain what a part does.

10 REM blink the light
<statement> : <statement>

Puts two instructions on the same line, separated by : — handy for short steps that belong together.

10 LED red, on : WAIT 1s

Making decisions

IF <condition> THEN <action>

Makes a decision: if the condition is true, then it does the action; otherwise it skips it. Conditions compare numbers with &gt;, &lt;, = and can join with AND.

30 IF a > 5 THEN LED red, on
BUTTON("A")

Is true while button A is being pressed. Put it inside an IF to react to a press.

30 IF BUTTON("A") THEN SOUND "coin"

Remembering numbers

LET <var> = <value> ( a … z )

Remembers a number under a name. You have 26 little boxes named a to z. LET is optional — a = 0 works too.

10 LET a = 0
+ - * / > < = AND ABS()

Do arithmetic with + - * /, compare with &gt; &lt; =, combine conditions with AND, and get a positive value with ABS(). Great for counting things.

20 a = a + 1

Making sound

SOUND "<name>"

Plays a sound on the buzzer: a short beep, or a named tune — mario, tada, coin, win, siren, scale.

40 SOUND "coin"
PLAY "<notes>"

Plays your own melody. Write notes as a letter + octave: c5, e5, g5. A - is a rest (silence), and :500 after a note sets its length in milliseconds.

50 PLAY "c5 e5 g5 c6"

Reusable blocks & whole missions

GOSUB <line> … RETURN

Jumps to a line like GOTO, but RETURN sends it back to where it came from. Use it for a block you want to reuse from several places (a "mini-program").

10 GOSUB 100
MISSION "<NAME>" [WITH k=v …]

Runs a whole ready-made behaviour in one line — a traffic light, a metronome, an alarm… Tune it with WITH name=value. More on this just below.

10 MISSION "SEMAFORO" WITH green=4s

Ready-made missions

A mission is a complete behaviour someone already built for you. Instead of writing the whole traffic-light dance line by line, you call it in one line:

10 MISSION "SEMAFORO" WITH green=4s yellow=1s red=4s beep=slow
20 GOTO 10

The WITH part tweaks it: how long green lasts, the beep speed, and so on. Each mission allows certain settings within safe limits (a traffic light won't let you switch red off — that would be unsafe). The available ones are in the Library in the sidebar: SEMAFORO (traffic light), PIANOLA (keyboard), METRONOMO (beat) and ALLARME (alarm).

Easiest way to change a mission's settings: click the MISSION line in the editor — a little form opens with every option, ready to adjust.

Let the assistant help (the @ helper)

Stuck, or in a hurry? At the bottom of the editor there's an @ describe a change box. Type what you want in plain words — "make the light blink faster" or "play a happy tune when I press the button" — and the assistant writes or edits the BASIC for you.

It always answers in real BASIC lines, right in the editor — so you can read them, run them, and learn from them. The assistant is a teacher that shows its work, not a black box.

Tip: it replies in your chosen language. Switch the language in the header and the explanations follow.

A few complete programs

Paste any of these into the editor and press run. Then change a number and see what happens — that's the whole game.

A traffic light

10 LED red, on
20 WAIT 5s
30 LED red, off
40 LED yellow, on
50 WAIT 1s
60 LED yellow, off
70 LED green, on
80 WAIT 5s
90 LED green, off
100 GOTO 10

Red for 5 seconds, yellow for 1, green for 5, then GOTO 10 starts the cycle over. Try changing the wait times.

Press the button → coin sound

10 IF BUTTON("A") THEN SOUND "coin"
20 GOTO 10

Line 10 checks the button over and over (line 20 loops straight back to it). Hold button A in the simulator and you'll hear the coin tune.

Play a little melody

10 PLAY "c5 e5 g5 c6"
20 END

Four notes going up, then it ends. Change the notes — try "c5 d5 e5 f5 g5" — and run it again.

Tips & common mistakes

  • Every line needs a number. A line without one (just LED red, on) won't run — write 10 LED red, on.
  • Count by tens (10, 20, 30) so you can slip a new line in between later.
  • Times need a unit: WAIT 2s (seconds) or WAIT 500ms (milliseconds). A bare WAIT 2 means 2 milliseconds — almost nothing!
  • A GOTO loop never stops on its own. That's usually what you want (a blinking light) — press the ■ stop button to end it.
  • The console talks to you. If something's wrong, the console under the editor shows a yellow warning or a red error with the line number. Read it — it's trying to help.
  • Small steps win. Run often. Change one thing, run, look. You learn far more from ten tiny experiments than one big guess.

Where to go next

You now know enough to make lights dance and buzzers sing. Open the IDE, try the missions in the Library, and keep changing numbers. When you're ready to run your programs on a real chip, the technical Docs walk you through it.