Skip to content
Parallax Learn

Parallax Learn

  • Welcome
  • Tutorials
        • Tutorial Series head tag

          Tutorial Series
        • Tutorial Series

          The special, classroom-ready series pages are organized collections of tutorials for our most popular hardware and/or languages. The tutorials for each topic are conveniently accessible from a single page, shown in the order it is recommended that they be completed.
        • Robotics Series Head tag

          Robotics Series
        • Robotics Series

          • Artificial Intelligence
          • Cybersecurity: Radio Data tutorialCybersecurity
          • cyber:bot + Python
          • cyber:bot + MakeCode
          • Boe-Bot Tutorial SeriesBoe-Bot
          • Arduino Shield-Bot
          • ActivityBot with C TutorialsActivityBot + C
          • ActivityBot with BlocklyProp Tutorial SeriesActivityBot + BlocklyProp
          • Scribbler 3 Tutorial SeriesScribbler 3
        • Electronics & Programming Series Head tag

          Electronics & Programming Series
          • BS2 Board of Education Tutorial SeriesBS2 Board of Education
          • Propeller C-Language BasicsPropeller C Basics
          • FLiP Try-It Kit C Tutorial SeriesFLiP Try-It Kit + C
          • FLiP Try-It Kit BlocklyProp TutorialsFLiP Try-It Kit + BlocklyProp
          • Badge WX Tutorial SeriesBadge WX
          • Propeller BlocklyProp Basics and ProjectsPropeller BlocklyProp Basics
          • View All Tutorial Series »
        • Browse Tutorials
        • Browse Tutorials

          Individual tutorials sorted by robot or kit, and language.
        • By Robot or Kit
          • ActivityBot
          • SumoBot WX
          • Boe-Bot
          • Shield-Bot
          • cyber:bot
          • Badge WX
          • ELEV-8
          • ARLO
        • By Language
        • By Language

          • Propeller C
          • Arduino
          • BlocklyProp
          • PBASIC
          • Python
          • MakeCode
          • View All Tutorials »
  • Educators
  • Reference
  • Downloads
  • Home
  • All Courses
  • Sensors with the micro:bit and MakeCode

Sensors with the micro:bit and MakeCode

Pushbutton

High/Low Signal Output

Our first class of sensors have high low signal outputs.  These are very easy to read with a micro:bit script.  We’ll start with sensors that send high/low signals that indicate detection on a single line.  Then, we’ll expand to sensors that report with high/low signals on multiple lines.

Single Line

Pushbutton

The pushbutton is also called a tact switch.  When not pressed, a pushbutton like the one below leaves the closer pair of pins disconnected from the ones in the back.  When pressed, it shorts the front row to the back row. 

Parts

(1) Tact Switch 400-00002
(1) Resistor 220 Ω (red-red-brown-gold)
(1) Resistor 10 kΩ (brown-black-red-gold)
(1) Jumper wire (red)

Schematic

This circuit allows the pushbutton to apply a high (3.3 V) signal to the P8 I/O pin when pressed, and a low (0 V) signal when not pressed.

Wiring

Script

New to writing micro:bit programs with MakeCode?  Here are two links that will help you get started.

  • Get started with micro:bit and MakeCode
  • Writing micro:bit programs

After learning to write scripts and load them into the micro:bit, build and run this program.


Tests

Verify that the micro:bit’s 5×5 LED matrix display shows the checkmark ✔ for 1 second after each time the button is pressed.  It should otherwise display an X.


Printer-friendly version
Build your Prototyping Setup
Prev
PIR Motion
Next

DISCUSSION FORUMS | PARALLAX INC. STORE

About | Terms of Use | Feedback: learn@parallax.com | Copyright©Parallax Inc. 2024

© 2025 Parallax Learn • Built with GeneratePress