im using arduino and im out of pins.

I need something like a decoder but the problem is that the decoders only change one output pin I.E. for 0011 the output will be 0001000000000000 what i need is to have the first outputs on I.E for 1000 the output will be 111111111000000000 i basically need to light up to 16leds and im out of pins so i was wondering is there is any IC that does this for me if i have 1111 it will output 16 ones.


You can use one (or more, daisy-chained) shift register for that.

It will normally take you 3 pins and provide 8 outputs, or 8n where n is the number of chained shift registers still using only 3 Arduino pins.

One example of a shift register that fits your situation is the 74HC595.

On Arduino, you can use shiftOut function to help handle those ICs.


You could use the MCP23017 an i2c 16 input/output port expander. (datasheet)

It allows you to control 16 I/O pins via a simple I2C interface (only 2 pins needed). And an Arduino library exists for it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.