Anish Ansari
Published © LGPL

How to Create Temperature Gauge Using Micro:bit

By the end of this tutorial, you will be able to make your own simple temperature gauge using micro:bit.

BeginnerFull instructions provided30 minutes10,895

Things used in this project

Story

Read more

Schematics

Connection

Connection for the servo

Code

Code for temperature gauge

JavaScript
This is the code for temperature gauge
let temperature = 0
basic.forever(() => {
    temperature = input.temperature()
    if (temperature < 20) {
        temperature = 20
    } else if (temperature > 35) {
        temperature = 35
    }
    pins.servoWritePin(AnalogPin.P0, pins.map(
    temperature,
    20,
    35,
    0,
    180
    ))
})

Credits

Anish Ansari

Anish Ansari

11 projects • 42 followers
Azure and IoT

Comments