Go Down

Topic: 4051 as demux? (Read 750 times) previous topic - next topic

sbx

hi everybody, its the first time i write in this forum... :)

im very much of a beginner in everything concers arduino... i hope that u got some patiance for some slow questions...

im trying to build a box wich has 16 buttons and 16 leds... the idea is very simple , i press a button, and a led goes on.. (revolutionery, isnt it?) it suppose to be a kind of step sequencer controller... ive mannaged to multiplex 16 inputs to the arduino and to read it in max/msp, but i have no luck doing the opposite, i mean operating the leds... i could not find any info about the 4051 as demux on the web...woud anybody have any suggstions on how to keep on going? would sombody be kind enough to post am example code, even the simple of the simplest, just to give me an idea?  


thanks very much for your time....


sbx



sbx

thanks for replying...yea, i did... unfortunatly, when i try to use the example code of the arduino 4051 tutorial, i get this error:

In function 'void loop()':
error: 'count' was not declared in this scope


and about the other thread with the links, none of them is arduino related... (except of this excelnt little scale blog, which in this case deals with multiplexing, not with de multiplexing...)




mem

If you remove  all occurrences of the double slash '//'  it will compile

Leave all backslashes '\\' as they are

sbx

thanks, manged to complie... but im a shame to say that i didnt got any further by communicating with the mux thrugh max... :) but mybe my questions are too slow for this forum....i just dont really know where to start...


thanks very much for ur time!

sbx

btw, correct me if im wrong, but the code example on the 4051 tutorial is only about multiplying inputs, aint it?

John_Ryan

For outputs, try

http://www.arduino.cc/en/Tutorial/ShftOut22

74hc595's x 2 is enough to control 16 LEDs from 3 DO's


mrmeval

#7
Jan 08, 2008, 04:57 am Last Edit: Jan 08, 2008, 04:58 am by mrmeval Reason: 1
Two 74HC595's  for 16 out, they daisy chain, you use them with with shift out, they latch so you can flip the latch and the arduino can do something else like run two 74HC165 for 16 *digital* in chips in a continuous loop looking for a low or high showing a button push. This needs you to learn to use pulse in which is tricky but doable.

If it was designed by man it can be repaired by man.

John_Ryan

Better still, here's a pic of the 595's

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1185507207

At about page 3, I've added 4021's, plus an RFID reader - the inputs and outputs are derived from these tutorials:-

http://www.arduino.cc/en/Tutorial/ShiftIn

and  

http://www.arduino.cc/en/Tutorial/ShiftOut

Throw them both together, and you can have an unlimited number of inputs and outputs, plus the chips are inexpensive.

sbx

#9
Jan 09, 2008, 01:23 am Last Edit: Jan 09, 2008, 01:29 am by sbx Reason: 1
thanks! ive ordered the 595´s... should take them a week or so... btw, how complicated would it be to combine 2 x 595 as shift in, 2 x 595 for shift out, and 2 x 4051 for analog read? (codewise?)





Go Up