Measures voltage of battery in EV3 brick
Simulink® Support Package for LEGO® MINDSTORMS® EV3 Hardware
The Battery block measures the voltage of the battery in the
MINDSTORMS EV3 brick, in millivolts. For example, when the six 1.5-volt batteries
are fully charged, the output value is approximately
During simulations without hardware, this block emits zeros. See Block Produces Zeros or Does Nothing in Simulation (Simulink).
legoev3lib block library as described in
Open Block Library for LEGO MINDSTORMS EV3 Hardware.
Copy the Battery and the Display blocks to a new model and connect these blocks.
Prepare and run the model on the EV3 brick as described in Run Model on EV3 Hardware. Observe the battery voltage, in millivolts, on the LCD display of the EV3 brick.
Specify how often the block reads battery values. This value defaults
0.1. Shorter sample times, such as
0.01, may produce unreliable measurements.
Smaller values require the processor to complete the same number of instructions in less time, which can cause task overruns.