Every inventor began with one small project. Pick one and bring your idea to life today!
Great inventors and great teachers all started with one small step. Take yours today!
The same kits we use in 40+ school labs โ grab yours and build something youโre proud of.
Log in to continue
Give your project a voice and a rainbow! One line plays a door bell, a police siren or Jana Gana Mana on a buzzer, and one line paints an RGB LED in any of millions of colours โ blinking, breathing, chasing and twinkling all by itself.
Plays a ready-made tone or song: buzzer_play(speaker, "door_bell"). The next line runs when it ends.
A buzzer that can play different notes, so tunes sound like music. An active buzzer can only beep the rhythm.
An LED with a red, green and blue light inside. TinkerPy uses WS2812B RGB LEDs: a board with 1, 2 or 3 LEDs, or a strip of up to 60.
Lights one LED or all in a colour: rgb_color(lamp, all, "cyan", 60) โ the brightness 0โ100 is optional.
Mixes any colour from red, green and blue, 0โ255 each: rgb_hex_color(lamp, 1, 255, 120, 0) is orange.
Move the red, green and blue sliders to mix a colour โ those three numbers are what rgb_hex_color() needs.
Sort each buzzer_play() tone name into its group.
# Add the libraries you need import buzzer # Give your pins easy-to-remember names i1 = set_name("bell_button") i2 = set_name("party_button") o1 = set_name("speaker") # ===== Musical doorbell ===== # This code block executes only once setup: bell_button = set_input(push_button, active_low) party_button = set_input(push_button, active_low) speaker = set_output(buzzer, passive) # This code block executes forever loop: if bell_button == ON: # when bell_button is ON buzzer_play(speaker, "door_bell") # play the "door_bell" tone on the buzzer (speaker) โ the next line waits until it ends elif party_button == ON: # otherwise, when party_button is ON buzzer_play(speaker, "happy_birthday") # play the "happy_birthday" tone on the buzzer (speaker) โ the next line waits until it ends
A musical doorbell on a passive buzzer named speaker: bell_button plays the ding-dong door_bell, party_button plays Happy Birthday. Because buzzer_play waits until the sound ends, one press plays the whole tone.
# Add the libraries you need import rgb_three # Give your pins easy-to-remember names i1 = set_name("mode_button") i2 = set_name("knob") o1 = set_name("lamp") # ===== Mood lamp ===== # This code block executes only once setup: mode_button = set_input(push_button, active_low) knob = set_input(potentiometer, adc) lamp = set_output(rgb_led, 3) # This code block executes forever loop: if mode_button == ON: # when mode_button is ON rgb_flip(lamp, 3, "warm_white") # press: LED 3 reading light on / off wait(300) # pause here for 300 milliseconds before continuing k = analog_read(knob) # 0 to 100 if k < 10: # when k < 10 rgb_breathe(lamp, 1, "purple", 3000) # calm breathing elif k < 50: # otherwise, when k < 50 rgb_color(lamp, 1, "cyan", k * 2) # brighter as you turn else: # otherwise rgb_hex_color(lamp, 1, 255, 255 - k * 2, 0) # orange to red wait(100) # pause here for 100 milliseconds before continuing
A mood lamp on a 3-LED board. The knob chooses the mood for LED 1: breathing purple at the bottom, cyan that gets brighter in the middle, then orange to red mixed with rgb_hex_color. Each press of mode_button flips LED 3 on as a warm white reading light, then off again.
# Add the libraries you need import rgb_strip # Give your pins easy-to-remember names o1 = set_name("strip") # ===== Festival light show ===== # This code block executes only once setup: strip = set_output(rgb_led, 8) # This code block executes forever loop: rgb_wipe(strip, all, "orange", 60) # fill up, one LED at a time wait(2000) # pause here for 2000 milliseconds before continuing rgb_chase(strip, all, "rainbow", 80) # a moving rainbow wait(4000) # pause here for 4000 milliseconds before continuing rgb_twinkle(strip, all, "warm_white", 120) # fairy lights wait(4000) # pause here for 4000 milliseconds before continuing rgb_swap(strip, all, "red", "blue", 300) # police lights wait(4000) # pause here for 4000 milliseconds before continuing rgb_blink(strip, all, "random", 300) # a new colour every blink wait(4000) # pause here for 4000 milliseconds before continuing
A festival light show on an 8-LED strip: wipe, chase, twinkle, swap and blink. Each effect runs by itself, so the program only waits a few seconds before starting the next one.
# Add the libraries you need import dht11 import ultrasonic import rgb_strip import rgb_single # Give your pins easy-to-remember names i1 = set_name("weather") o1 = set_name("meter") o2 = set_name("heat_lamp") # ===== Heat and level meter ===== # This code block executes only once setup: weather = set_input(dht11) i3 = set_input(ultrasonic_trig) # cannot be changed i4 = set_input(ultrasonic_echo) # cannot be changed meter = set_output(rgb_led, 8) heat_lamp = set_output(rgb_led, 1) # This code block executes forever loop: d = distance() # set d to distance() if d < 0: # when d < 0 d = 100 # nothing in range: treat it as far away rgb_bar(meter, all, "rainbow", 100 - d, 100) # more LEDs as you come closer t = dht_temperature(weather) # set t to dht_temperature(weather) rgb_heat(heat_lamp, 1, "red", t, 20, 40) # blue when cool, red when hot wait(500) # pause here for 500 milliseconds before continuing
Two meters (TinkerPy Mega): the 8-LED meter strip fills up as something comes closer to the ultrasonic sensor, and the 1-LED heat_lamp turns from blue (20 ยฐC) to red (40 ยฐC) with the DHT11 on i1.
A passive buzzer can play happy_birthday โ hide one inside a gift box with a button and surprise a friend.
Festival light strings are often the same kind of RGB LEDs โ rgb_chase and rgb_twinkle make them dance.
Red, green and blue each have 256 levels, so rgb_hex_color() can mix over 16 million different colours.
Two buttons, one passive buzzer: the front door plays door_bell and the back door plays marimba_ring. Add an RGB LED that flashes with rgb_blink while the bell rings.
๐งฐ You need: TinkerPy board, passive buzzer, 2 push buttons, RGB LED boardPut a 3-LED RGB board inside a paper lantern. A knob mixes the colour with rgb_hex_color and a button switches a calm rgb_breathe mode on and off.
๐งฐ You need: TinkerPy board, RGB LED board, potentiometer, push button, paper lanternEach WS2812B RGB LED has its own tiny chip inside, so a whole strip of 60 LEDs needs only one data wire from your board.
5 quick questions to check yourself โ free with your TinkerPy account.
Log in