LoginSignup
3
2

More than 3 years have passed since last update.

micro:bitで電池の電圧を計測する

Posted at

概要

micro:bitを電池チェッカーとして使用するために単純なテストを行いました。

ブロックプログラミング

PG.JPG

電圧を、0~1023の値(0~3.3V)として読み取ることができるので、
入力:0~1023
出力:0~3300mV
として表示しています。

参考:サヌキテックネット

コード

Vchecker.js
basic.forever(function () {
    basic.showNumber(Math.round(Math.map(pins.analogReadPin(AnalogPin.P0), 0, 1023, 0, 3300)))
    basic.pause(2000)
})

参考)電池を外した状態の表示

0にはならず、下記の状態でした。
テスター:292mv
micro:bit:516mv

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2