12. Input Devices¶
12.8 Probe an input device’s analog levels and digital signals(as group assignment)¶
I checked analog output levels of the micro:bit on-board accelerometer(LSM303AGR) via PC’s serial port and serial monitor.
Result:
Cap.1(moving):
Cap.2(Static):
Analog levels(lower/upper limit): -2048 to 2048 (milli-g) for x/y/z axis
Digital signals: N/A
It seems that gravitational acceleration are detected in z axis(See Cap.2).
Javascript program for micro:bit:
basic.forever(() => {
serial.writeValue(“X”, input.acceleration(Dimension.X))
serial.writeValue(“Y”, input.acceleration(Dimension.Y))
serial.writeValue(“Z”, input.acceleration(Dimension.Z))
serial.writeLine(“----------“)
basic.pause(500)
})
Last update:
June 29, 2022