DIY sysex fader box status and questions.

Jay Vaughan jayv at synth.net
Sat Apr 21 14:31:49 CEST 2012


> OK, so i put the 2 bits for each pot together and make it a word? Isn't that the same as an int? So i end up with a value of 0 to 3. look at previous value and go from there. (can I put 4 bytes into 1 word? what is the benefit of doing this?)

I'm sorry Tom, I misunderstood what you said and thought you were getting 4 bytes from the decoder, when in fact you're getting 4 bits.  ;)  I guess I was thrown off by your representation here:

2 bits per encoder
Sequence CW rotation:
00 10 11 01
Sequence CCW rotation:
00 01 11 10

.. which is in fact, binary coding (right?), so you have just one byte.  But, even then, can you  not just treat it as a const char and base a switch/if-else sequence off of it?

Its been too long since I've had to deal with reading the encoders myself on my MIDI shield for Arduino - but I see that in my current project I just collect the bytes using analogRead(KNOB1)/KNOB2 and I end up with a long val .. perhaps you can look at the low-level details in the Arduino analogRead() library function to see how the bit-fiddling is dealt with there?


;
--
Jay Vaughan






More information about the music-bar mailing list