Hi, I'm quite a noobe(!) and want to create a device to test individual notes on my sampler and other hardware. So to do this I want to press 1,2,3 and it plays midi note '123', or 3,6 and it plays midi note number '36' , etc, etc. I've seen code that addresses a single key and then sends that out, but how to log a string of 2 or 3 digits on the keypad (e.g. 113) and then send that to midi?? Cheers :)
You need to know when you have finished the string of 2 (or is that 3) digits. The challenge is usually solved by either sending an end of input character, like return, or by using a timeout, like tv remotes do for the channel number.
Once you have the end of number defined, the rest is easy. Initialize the number to zero. Then for each digit multiply the number by 10 and add the new number in. So the sequence could be 0, 1, 1x10+2=12, 12x10+3=123, etc.