After trying to work with the TI4051 multiplexer chip with 8 analog pots, I've decided to make a new object for it. I can't seem to open the example patch provided in this thread, and using a script object with 2 ins and 2 outlets seems like a bad time. This is the first object I've tried to make.
The new object I've been working on has 11 outlets (8 from the mutiplexer out channels, 3 for the 3 bit digital selection channels) and 1 inlet for any analog in pin. I went this route, as opposed to hard coding gpio, so you can use gpio objects to select whatever pins you'd like to use.
My plan was to use a simple for loop with a switch statement inside. I have this all set up in the K-rate section. The switch works wonderfully, and if I comment out my for loop, and just set my increment to specific switch values, they work exactly as they are supposed to. The pot connected to the selected channel is the only one that outputs. but when the for loop is un-commented, the object only outputs on the final switch case, where a normal for loop would end. The main problem(i think), is that nothing is resetting my incremental, and once it hits 7 (it's highest value defined in the for loop), it just stays 7 instead of resetting. I've tried to figure out a way to re-set my increment, both inside and outside the for loop, but axo just crashes becuase the patch "takes to long to upload".
I was under the impression that the code in the K and S rate sections are constantly looping. Kind of like the void loop section of arduino code. Is that not the case? If not, what is the best way to constantly scan for muxed input?
I can paste the code here if anyone wants to take a look at it. (my description probably wasn't the clearest, the code is just very long). Or if there is a way to upload individual objects, I'm not 100% sure how to do that. The problem might also be where i'm defining/instantiating my increment? or maybe the gpio digital out pins can't write fast enough?
I'm probably missing something super basic. heh...
anyway, thanks for reading, let me know what you think.