Read GPIO pin status
Simulink Support Package for Raspberry Pi Hardware / Basic
Use the GPIO Read block to read the logical value of a digital pin of your Raspberry Pi™ board.
You can damage your target hardware by:
Exceeding the maximum voltage that can be applied to GPIO pins.
Shorting a GPIO pin to ground.
Shorting a GPIO pin with high voltage to another GPIO pin with low voltage.
Connecting a GPIO pin to a voltage source greater than the maximum voltage.
Exceeding the maximum current by driving multiple GPIO pins high simultaneously.
Port_1 — Output port containing logical value
The block outputs the logical value of a digital pin.
Board — Raspberry Pi hardware board
Model B+ (default) |
Model B Rev1 |
Model B Rev2 |
Pi 2 Model B |
Pi 3 Model B |
Pi 3 Model B+ |
Pi Zero W |
Pi 4 Model B
Select your Raspberry Pi hardware board. You can find this information on the target hardware, product packaging, or product documentation.
GPIO number — GPIO pin of Raspberry Pi hardware board
17 (default) |
Select a GPIO pin of the Raspberry Pi hardware board to read its logical status. Do not use the same GPIO pin in multiple blocks within the Simulink® model. For more information on Raspberry Pi GPIO pins, click View pin map.
Sample time — Time interval to read logical status on GPIO pin
0.1 (default) | scalar
Enter the sample time to reading the logical value of the GPIO pin. Smaller values require the processor to complete the same number of instructions in less time, which can cause task overruns. Enter a value greater than zero.