Stephan Noller
Published © CC BY

Measuring Presence of a Car

The presence of a car can be measured by changes in the magnetic field. We are using the magnetometer to build a tiny parking sensor.

EasyWork in progress1 hour917
Measuring Presence of a Car

Things used in this project

Hardware components

Calliope mini
×1
BBC micro:bit board
BBC micro:bit board
×1

Story

Read more

Code

parking sensor

JavaScript
senses strength of magnetic field and transmits it via RF to another Calliope mini
let Platzhalter = 0
radio.onDataPacketReceived(({receivedNumber}) => {
    basic.showString("r:")
    basic.showNumber(receivedNumber)
})
input.onButtonPressed(Button.A, () => {
    for (let i = 0; i < 100; i++) {
        Platzhalter = input.magneticForce(
            Dimension.Strength
        )
        radio.sendNumber(Platzhalter)
        basic.showString("s:")
        basic.showNumber(Platzhalter)
        basic.pause(2000)
    }
})

Credits

Stephan Noller

Stephan Noller

1 project • 10 followers
Contact

Comments

Add projectSign up / LoginAbout BBC micro:bit