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 hour984
Measuring Presence of a Car

Things used in this project

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

7 projects • 10 followers

Comments