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
A doorbell button is either pressed or not โ but a fan regulator knob can be anywhere in between. Your TinkerPy board can read both kinds: digital inputs that are just ON or OFF, and analog inputs that give a number from 0 to 100.
An input that has only two states: ON or OFF. Buttons, touch pads and motion sensors are digital.
The module pulls its wire LOW (to 0 volts) when it is ON. Most modules work like this, so it is the usual setting (โ ) in Circuit Connections.
The module makes its wire HIGH when it is ON. The touch sensor and the PIR motion sensor are active high.
An input that gives a number from 0 to 100 instead of just ON or OFF โ like a knob or a light level. Only the input pins i1โi4 can do this.
Reads an analog input: level = analog_read(knob) puts a number from 0 to 100 into level.
Drag the knob slider. Watch the analog reading, the volts on the pin and what the Knob light level program does with the lamp.
Tap each mode to see what it means and which modules use it.
# Add the libraries you need import buzzer # Give your pins easy-to-remember names i1 = set_name("bell_button") o1 = set_name("bell") # ===== Doorbell ===== # This code block executes only once setup: bell_button = set_input(push_button, active_low) bell = set_output(buzzer) # This code block executes forever loop: if bell_button == ON: # when bell_button is ON bell = ON # turn bell ON else: # otherwise bell = OFF # turn bell OFF
A doorbell: the buzzer named bell rings only while the push button is pressed. When you picked Push button on i1 (named bell_button) and Buzzer on o1 (named bell), Circuit Connections wrote the name lines, import buzzer and the two setup lines for you โ including the usual mode, active_low.
# Give your pins easy-to-remember names i1 = set_name("button") o5 = set_name("touch_pad") o1 = set_name("lamp") # ===== Button or touch ===== # This code block executes only once setup: button = set_input(push_button, active_low) touch_pad = set_input(touch, active_high) lamp = set_output(led) # This code block executes forever loop: if button == ON or touch_pad == ON: # when button is ON or touch_pad is ON lamp = ON # turn lamp ON else: # otherwise lamp = OFF # turn lamp OFF
Two digital inputs in two modes: a push button on i1 (active_low) and a touch pad on output pin o5 used as an input (active_high). Pressing either one lights the lamp. The code looks the same for both โ the mode only tells the board how each module is wired.
# Give your pins easy-to-remember names i2 = set_name("knob") o1 = set_name("lamp") # ===== Knob light level ===== # This code block executes only once setup: knob = set_input(potentiometer, adc) lamp = set_output(led) # This code block executes forever loop: level = analog_read(knob) # read the knob: a number from 0 to 100 if level > 70: # when level > 70 lamp = pwm(100) # knob turned high: bright elif level > 30: # otherwise, when level > 30 lamp = pwm(40) # knob in the middle: dim else: # otherwise lamp = OFF # turn lamp OFF wait(100) # pause here for 100 milliseconds before continuing
An analog input: a knob (potentiometer) on i2 set to adc. analog_read(knob) gives 0 to 100, and the if / elif / else picks off, dim or bright. Try it in the Simulator by dragging the knob slider.
Every button in a lift is a digital input โ the lift only needs to know โpressedโ or โnot pressedโ for each floor.
The knob on a fan regulator is not just ON or OFF โ it can be anywhere in between, just like an analog input.
Many phones have a light sensor near the camera. It measures how bright the room is and changes the screen brightness by itself.
Put a push button on i1 and a buzzer on o1 and name them in Circuit Connections. Make the buzzer ring while the button is pressed, and add an LED on o2 that lights at the same time.
๐งฐ You need: push button, buzzer, LED, TinkerPy board or SimulatorPut a knob (potentiometer) on i2 in adc mode and an LED on o1. Make four levels: off below 25, then pwm(30), pwm(60) and pwm(100). Test every level by dragging the slider in the Simulator.
๐งฐ You need: potentiometer, LED, TinkerPy board or SimulatorInside every computer, phone and TinkerPy board, all information is stored as tiny ON/OFF signals called bits โ even photos, songs and this very sentence!
5 quick questions to check yourself โ free with your TinkerPy account.
Log in