Read the value of a sensor attached to an analog input pin
Simulink Coder Support Package for ARM Cortex-based VEX Microcontroller/Sensors
Read the voltage of the selected analog port (pin). Use the analog input pin to measure the
output of sensors (voltage), such as potentiometer. The 12-bit sensor value has a range of 0
to 4095 reflecting an input voltage of 0V to 5V. You can use up to 8 analog IO pins on the
VEX microcontroller. For information on the digital pin layout of the microcontroller, see
VEX Cortex Pin-out
.
During code generation, any simulation block that is connected to the input port of the Analog Input block is ignored and has no effect on the generated code.
During simulations, without the hardware, this block emits zeroes if there is no Source block connected the simulation input port. See Block Produces Zeros or Does Nothing in Simulation. Connect a Source block from the Utilities library in VEX Microcontroller library for achieving simulation behavior.
For the code generated from this block to work properly on a VEX microcontroller that is tethered to the PC, make sure that you connect a VEX 7.2V Battery to the microcontroller and turn on the battery.
Select an analog channel (or port), a value between 1 and 8.
Do not assign the same channel number to multiple blocks within your model.
Select this check box to simulate the analog input block.
Specify how often this block should read the pin value, in seconds. This parameter value defaults to 1/5 second. If you select Add input port for simulation check box, the Sample time parameter is hidden and the value is inherited (Sample time = -1).