移位寄存器
移位寄存器用于向 Arduino 板添加额外的输入或输出。您可以使用串行输入/并行输出移位寄存器来控制多个输出,或使用并行输入/串行输出移位寄存器来收集多个输入,这些只需使用 Arduino 板上的一个引脚即可完成。例如,您可以使用 Arduino 板上的单个引脚控制多个 LED 灯。您可以使用移位寄存器函数对串行数据进行读取或写入。支持以下移位寄存器:
在使用移位寄存器函数之前,请使用 arduino
创建一个 Arduino 对象。有关详细信息,请参阅Connect to Arduino Hardware。
函数
shiftRegister | Connection to shift register on Arduino hardware |
read | Read data from shift register |
write | Write data to shift register |
reset | Clear all outputs of shift register |
主题
- Push Button Control with 74HC165 Shift Register
This example shows how to use the MATLAB® Support Package for Arduino® Hardware to collect large number of push button states with a 74HC165 8-bit parallel-in-serial-out shift register.
- Control 7-Segment Display with 74HC595 Shift Register
This example shows how to use the MATLAB® Support Package for Arduino® Hardware to control a 1-Digit 7-Segment display with a 74HC595 8-bit serial-in-parallel-out shift register.
- Control LEDs with 74HC595 Shift Register
This example shows how to use the MATLAB® Support Package for Arduino® Hardware to control multiple LEDs with two 74HC595 8-bit serial-in-parallel-out shift registers.