Measure voltage of analog input pin
Simulink Support Package for Arduino® Hardware/Common
Measure the voltage of an analog pin relative to the analog input reference voltage on the Arduino hardware. Output the measurement as a value that ranges from 0 to 1023.
If the measured voltage equals the ground voltage, the block output emits
If the measured voltage equals the analog reference voltage, the block
The default value of the analog input reference voltage for most of the Arduino boards is 5 V. To change the Analog input reference voltage parameter in your model Configuration Parameters, select Tools > Run on Target Hardware > Options.
The analog input reference voltage for Arduino Due, Nano IoT 33, and MKR boards is 3.3 V. You cannot change this value.
During simulations without the hardware, this block emits zeroes.
The range of the voltage that can be applied to the analog input pin depends on the analog input reference voltage. For details, read the documentation for your Arduino hardware.
Enter the number of the analog input pin.
Do not assign the same pin number for different types of blocks as this may cause resource management conflicts.
Click View pin map to open the Arduino Pin Mapping table.
To know how to assign pins for the block, see Pin Mapping on Arduino Blocks.
Specify how often this block measures the voltage of the analog input
pin, in seconds. Enter a value greater than zero. This value defaults to
a sample time of
1 second. The minimum value is
Smaller values require the processor to complete the same number of instructions in less time, which can cause task overruns.