Microbit analogue input sensors

This tutorial covers how to connect analogue input sensors to your Microbit and how to read their values.

Example input sensors that this tutorial is suitable for:

OLYMPUS DIGITAL CAMERA

  • Temperature sensors ( Thermistors)
  • Light sensors ( LDRs)
  • Resistance sensors ( Variable resistors)
  • Pressure sensors
  • Many more…

 

In order to read input from analogue sensors such as temperature sensors and light sensors, you will need the following components:

Click to enlarge
Click to enlarge
Click to enlarge
Click to enlarge

 

 

 

 

 

 

 

 

Demo code 1 – Say the sensor value.

Click to enlarge
Click to enlarge

Depending on the light in the room, the Microbit will say about:

  • 1008 in the light
  • 700 in the dark

Note

If you have used a different size resistor then you will probably get different values to me. It doesn’t matter, you will just have to adapt the code in the next section!

Demo code 2 – using the sensor value

microbit analogue input sensor demo code 2 rising falling bar
Click to enlarge
Challenge -
Challenge -
Challenge -
Challenge -
Challenge -
Challenge -