LEGO EV3: unsupported operand type(s) for *: 'NoneType' and 'NoneType'

42 Views Asked by At

First of all I'm new Python programmer. I get an understanding error in the very simple code below:

from pybricks.hubs import EV3Brick

def getbatV(lego):
    v=lego.battery.voltage()
    return(v)

def getbatI(lego):
    i=lego.battery.current()
    return(i)

ev3 = EV3Brick()
intensite = getbatI(ev3)
voltage = getbatV(ev3)
print("   Paramètres au repos: ", voltage, '--', intensite)

I confirm that getbatV & getbatI refer to correct Lego instructions. But the code give this result:

Paramètres au repos:  None -- None

Translated:

Parameters at rest: None -- None

I presume that ev3 was not correctly initiated? So what can I do to do it?

Have a nice day,

Henri

0

There are 0 best solutions below