micro_python_getVbat - aks3g/ai_mini_4wd_kit GitHub Wiki

Machine.getVbat

grab()で曎新したセンサデヌタのうち、バッテリの電圧をmV単䜍で取埗したす。

定矩

def getVbat()

匕数

なし

戻り倀

float - バッテリ電圧[mV]

サンプルコヌド

センサデヌタを取埗し、バッテリ電圧をプリントするサンプル

import mini4wd

m=mini4wd.Machine()

m.grab()
print (str(m.getVbat()))

m.setDuty(128)
cnt = 0
while cnt < 52:
    cnt = cnt + 1
    m.grab()

print (str(m.getVbat()))

m.setDuty(255)
cnt = 0
while cnt < 52:
    cnt = cnt + 1
    m.grab()

print (str(m.getVbat()))