Sense Pushbutton Presses

What it’s About

Pushbuttons are common in devices we use every day.  How many pushbuttons do you see on the keyboard you are using?  What other devices do you use with pushbuttons?  Does your game controller have more than just two buttons?  How about your phone, maybe power, volume up and volume down?  

Just as many devices have pushbuttons, some inventions and prototypes need more than just the two (A & B) pushbuttons built into the micro:bit.  So, you might find experience with building testing and incorporating pushbuttons into projects useful at some point.  Understanding how they work can also come in handy, especially if a prototype with pushbuttons isn’t behaving as expected.  
In these activities, you will:

  • Build and test an individual pushbutton circuit
  • Write scripts that monitor the pushbutton circuit’s pressed/not pressed state
  • Write scripts that respond to the pushbutton’s state by controlling a light in different ways
  • Learn how a pushbutton connects certain terminals electrically when it is pressed as you probe its pins for continuity
  • Learn how a pushbutton circuit behaves electrically as you probe the voltages it applies to an I/O pin
  • Expand applications with more than one pushbutton, using scripts that control multiple lights and light sequences
  • Plot pushbutton and light electrical signals with an oscilloscope
  • Learn how to make the oscilloscope clearly display the results of events even though you cannot necessarily predict when they will occur

Before you start

These lessons use a specific kit and build on earlier material.    

You will need:

Complete these tutorials first:

After You Finish

You will be able to:

  • Build, test, and incorporate pushbuttons into circuit projects
  • Understand how voltages a pushbutton circuit applies to an I/O pin are translated into binary states (1s and 0s)
  • Measure continuity in pushbuttons and voltages at key points in pushbutton circuits
  • Work with scripts that monitor and respond to more than one pushbutton
  • Measure two voltage signals with an oscilloscope.
  • Operate the oscilloscope’s trigger settings to catch events and make them appear in a position where they can be examined.  

Although this activity just uses pushbuttons to control lights, you will use them to control other devices, including a motor, in upcoming activities.