Measure voltage of analog input pin
Simulink Coder Support Package for BBC micro:bit/Basic
Simulink Coder Support Package for STMicroelectronics Nucleo Boards/ Common
Simulink Coder Support Package for STMicroelectronics Discovery Boards/ STM32F746G-Discovery
Simulink Coder Support Package for STMicroelectronics Discovery Boards/ STM32F769I-Discovery
The Analog Input block measures the voltage of an analog pin relative to the analog input reference voltage on the hardware. The block outputs the measurement as a float value in the range 0–1.
If the measured voltage equals the ground voltage, the block emits
If the measured voltage equals the analog reference voltage, the block emits
During the external mode simulation, the block outputs the simulation results returned from the executable running on the target hardware.
During simulation in all other modes, the block outputs zeroes.
Port_1 — Voltage of analog input pin
If the measured voltage equals the ground voltage, the block
0. If the measured voltage equals the analog
reference voltage, the block emits
Pin — Pin name of the analog input
Specify the digital pin.
To open the pin mapping table, click View pin map.
Make sure to assign different pin name to the different blocks of your model.
Apart from the pins names mentioned in the pin mapping table, there are
other alternate pin names
(Px_y_ALTz) that can be used to
access other hardware peripherals connected to the same pin. To know more,
Usage of Alternate Pin Names.
The alternate pin names are only applicable for Simulink® Coder™ Support Package for STMicroelectronics® Nucleo Boards and Discovery boards.
Sample time — Frequency at which the block reads the input pin value
Specify how often this block measures the voltage of the analog input pin, in seconds.
When you specify this parameter as
determines the best sample time for the block based on the block context
within the model.