Powered by TinkerSpace
Join free
TinkerPy Tutorial ๐Ÿ“˜ Part 1 ยท Starter ยท Chapter 1 of 24

About TinkerPy Coding

A fan that switches on when the room gets hot, a robot that stops before a wall, a lamp you control from your phone โ€” someone wrote the instructions for every one of them. In this course you become that someone, with TinkerPy!

๐Ÿ“–Key words

Program (code)

A list of exact instructions that a computer or a board follows, one by one, in order.

Coding language

The special words and rules we use to write a program. Python, Scratch and TinkerPy are coding languages.

TinkerPy

A simple coding language made for TinkerPy boards. It looks like Python, so what you learn here helps you with โ€œrealโ€ coding too.

TinkerPy board

A small computer (a microcontroller) that reads inputs like buttons and sensors and controls outputs like LEDs, buzzers and motors. There are two: TinkerPy Mini and TinkerPy Mega.

TinkerPy Code

The free coding website at tinkerpy.com where you write, check, test and send your programs to the board.

๐ŸŽฌSee it work

From your screen to the board

Press Compile & Upload and follow your code all the way to the board.

Input or output?

Does the board READ it (input) or CONTROL it (output)? Tap the right group for each part.

๐Ÿง How it works

What is a program?

  • A program is like a recipe: exact steps, in the right order. Miss a step and the dish goes wrong!
  • A board is very fast but not clever โ€” it does exactly what the code says, nothing more.
  • Most gadget programs follow one simple pattern: read the inputs โ†’ decide โ†’ control the outputs, again and again.
  • Your eyes and ears are inputs, your brain decides, your hands and voice are outputs. A board works the same way.

TinkerPy: Python for boards

  • TinkerPy looks like Python: lines that end with a colon (:), indented blocks, # comments, if / else and for i in range().
  • It adds easy words for hardware: lamp = ON, lamp = OFF, wait(500), if button == ON:.
  • Every program has two blocks: setup: runs once when the board starts and loop: runs again and again โ€” all about them in chapter 3.
  • TinkerPy is kept small on purpose: whole numbers only and no long words to remember, so you can build real gadgets from day one.

From idea to working gadget

  • 1. Connect: in TinkerPy Code, open Circuit Connections, tap a pin, pick what is plugged in and give it a name โ€” the setup lines are written for you.
  • 2. Write what should happen in the loop.
  • 3. Compile โ€” TinkerPy checks every line, fixes small mistakes and explains real ones in simple words.
  • 4. Simulate on a virtual board, then 5. Upload to your board over WiFi or Bluetooth. Chapter 2 shows every step.

What can you build?

  • Smart lights and alarms: night lamps, doorbells, fire and gas alarms.
  • Robots: cars that drive, turn and stop before a wall; arms that move with servos.
  • Phone-controlled projects: make your own app in TinkerPy App and control the board over Bluetooth or the internet (IoT).
  • Screens and sensors: weather stations, counters, clocks and games on a small OLED display. Share your best apps on AppSpace!

๐Ÿ’ปCode

Python
# Python on a computer: say hello 3 times
for i in range(3):
    print("Hello, TinkerPy!")

This is Python, a language used all over the world. Look at the colon at the end of the for line and the 4 spaces in front of print. TinkerPy uses the very same rules, so your TinkerPy skills carry over to Python.

# Give your pins easy-to-remember names
o1 = set_name("lamp")

# ===== Hello, board! =====

# This code block executes only once
setup:
    lamp = set_output(led)

# This code block executes forever
loop:
    lamp = ON  # turn lamp ON
    wait(500)  # pause here for 500 milliseconds before continuing
    lamp = OFF  # turn lamp OFF
    wait(500)  # pause here for 500 milliseconds before continuing

Your first TinkerPy program: an LED that blinks forever. When you picked LED on o1 in Circuit Connections and named it lamp, the lines at the top and in setup were written for you. You only type the four lines in loop: ON, wait half a second, OFF, wait half a second. The words after # are comments that TinkerPy adds when you press Enter.

# Give your pins easy-to-remember names
i1 = set_name("light_sensor")
o1 = set_name("lamp")

# ===== Night lamp =====

# This code block executes only once
setup:
    light_sensor = set_input(light_sensor, active_low)
    lamp = set_output(led)

# This code block executes forever
loop:
    if light_sensor == ON:  # is it dark?
        lamp = ON  # turn lamp ON
    else:  # otherwise
        lamp = OFF  # turn lamp OFF

A real smart gadget in a few lines: a night lamp. The light sensor module on i1 is ON when it is dark, so the lamp switches on at night and off in the day. Read it like English: if it is dark, lamp on, otherwise lamp off.

Open TinkerPy Code

๐ŸŽ‰Fun examples

๐Ÿค–Robots follow orders

A robot does not โ€œknowโ€ how to walk or dance. A programmer wrote every move, step by step.

๐ŸงƒPrograms everywhere

Washing machines, traffic signals, microwave ovens and water coolers all run programs on small microcontroller boards โ€” just like yours.

๐ŸPythonโ€™s funny name

Python was named after a British comedy show, not the snake! TinkerPy borrows Pythonโ€™s neat style for boards.

๐ŸŒWhere itโ€™s used

๐Ÿ› ๏ธProject ideas

Explore the TinkerPy Code editor

Open tinkerpy.com, start a New Project and look around: tap a pin in Circuit Connections to see the parts you can pick, find setup: and loop:, the Code Library, Compile, Simulator and Upload. Then type the four blink lines and press Compile.

๐Ÿงฐ You need: a phone, tablet or computer with a browser
Inputs & outputs hunt at home

Pick 5 gadgets at home (TV remote, fridge, washing machine, mixer, ceiling fan). For each, write its inputs (buttons, sensors) and outputs (lights, motors, sounds) in a two-column table.

๐Ÿงฐ You need: notebook and pencil

โญPoints to remember

  1. A program is a list of exact instructions followed in order.
  2. The board does exactly what the code says โ€” nothing more.
  3. Gadgets read inputs, decide, then control outputs, again and again.
  4. Inputs are read by the board: buttons and sensors.
  5. Outputs are controlled by the board: LEDs, buzzers, motors, servos.
  6. TinkerPy is a coding language made for TinkerPy boards.
  7. TinkerPy looks like Python: colons, indents, # comments, if / else.
  8. TinkerPy maths works with whole numbers.
  9. There are two boards: TinkerPy Mini and TinkerPy Mega.
  10. You write code in TinkerPy Code at tinkerpy.com.
  11. Circuit Connections writes the setup lines for the parts you pick.
  12. The steps are: connect, write, compile, simulate, upload.
  13. Upload goes over WiFi or Bluetooth.
  14. TinkerPy App makes phone apps that talk to your board.
๐Ÿคฏ
Did you know?

A modern car has dozens of small computers like microcontrollers inside โ€” for the brakes, windows, lights and even the seats!

โ“Mini quiz

๐Ÿ”‘
Log in to try the mini quiz

5 quick questions to check yourself โ€” free with your TinkerPy account.

Log in
Chat with TinkerPy ๐Ÿ‘‹