simple demultiplexing

hello guys. what is the simplest way to demultiplex my two digital output pin into 4bit. thanks a lot.

TTL: 74155 Dual 2-Line To 4-Line Decoders/Demultiplexers

CMOS: 4052 - Analogue multiplexer/demultiplexer (Dual 1-of-4 switch);

Now tell us what you actually want to do rather than what you think you need to do to solve your problem.

This is because that question is not very good and leaves a whole bunch of questions hanging.

For example to demultiplex four lines into two lines you will need two more lines to switch the demultiplexer. So if you have four lines available anyway why do you need a demultiplexer?

oh im sorry sirs... my bad. im using an arduino.. i have only 2 digital pin left.. and i need 4 drivers for my ventelation for my green house.. there are still four conditions to satisfy..i live in an hot area.. so i have three temp sensors..outside of my greenhouse, inside of the separate rooms of my plants.. inside of my greenhouse.... the aircon, the external fan, the exhaust and the internal fan.. my problem is i still have 2 set of fans left to control..

sorry..i got confused.. is multiplexing the right term?

Yes, multiplexing. Part like 74LS138 - 2 lines in, one of 4 outputs will go low based on the inputs. One output will always be low tho.

Maybe what you need is a serial-in parallel out shift register - 3 lines from the arduino, serial data, clock, latch clock with shiftout() commaand, or use SPI pins MOSI, SCK, SS and SPI.transer() for faster loades - you can have any combination of highs & lows out depending on the data you shift into it, and you can daisy chain them to have 8, 16, 24 outputs.

Same for retrieving data - connect any number of devices to a parallel-in shift-out register. One control line that you use to capture the state of the inputs, and a clock line to shift the data into the arduino. shiftin() command, or SPI.transfer again.

wow. thanks a lot sirs.. it answered a bunch of my problems.. good day XD

You haven't said what you are using all the other pins for. It may be simpler to multiplex the other pin functions rather than the fans.