I have a project where I want to use several motors (servo and stepper) which are activated with an RFID and show info on a display.
What’s common practice or a smart way to get past such limitations?
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It only takes a minute to sign up.Sign up to join this community
Basically there are 4 ways to go if you run out of pins:
Which of the above is best for you depends on your project and your requirements. Here are some notes about the options:
millis()and a non-blocking coding style like in the
shiftOut()functions to control them.
SPIlibrary directly (after reading and understanding the communication protocol in the datasheet of the port expander) or you might find a fitting third party library for your specific port expander.
I hope this helps as an orientation. More definitive answers can only be given here, when you describe your exact situation.
There are several ways, but I recommend these:
1: MUX and DEMUX can make you use more pins with little pins. For example, you can control extra 2^n pins with n pins. The advantage of MUX and DEMUX is that it respond immediately. However you have to use more pins if you want to control lots of pins and it can only control one pin at a time.
2: You can use additional peripherals to use specific functions like PWM, SPI, ADC and so on. The advantage of this method is that you can use more functions and, in some cases, you control lots of peripherals with less pins. Because of these good features, the peripheral devices are relatively expensive.