1) functions in arrays addressable by index and the index is the bit that has changed.
2) indeed - because memory is in very short supply in MCs.
3) Polling or interrupt driven, both methods will provided the bits that are pressed, and the application has to figure what happened by comparing to the previously received bits. Yes, you would make one of the capacitive pads to turn on the C# - when the bits switches to 1 - and the other turn if of C#. The functions would turn on the signal generator that is tuned to a C#. The question is how many signal (generator) you have... I assume you have one for every key.
I'm not an audio engineer, but from the past I know you can use various devices to turn on the path and let the signal pass to a sum... I'm thinking about a 4916 or better a 4066 - see for example https://www.ti.com/lit/ds/symlink/cd74hc4016.pdf?ts=1632556242364 , or a DG408LE https://www.vishay.com/docs/78084/dg408le.pdf. You could also use an op-amp.
For producing a sound based on a rotary device: yes you can use a pot and poll with an ADC... (I did this with a circuit to excite an (RF) LC circuit to figure its resonance frequencies... see Espruino controlling LC resonance experiment in HAM Radio class). But you also can just use an encoder that delivers you pulses and a direction - clock and counter clock wise. You set a watch - like you do on an interrupt of a device - and then read the direction in the function and adjust the frequency... In my ham circuit I used watch and polling: watched buttons that increase / lower the frequency, and polling of a sliding pot... The pot I use two ways: controlling the frequency increment/decrement speed when clicking (and holding) the red and green buttons, and when pressed at the same time, the app switches into the analog mode where I poll pot and map it to a frequency.
© Espruino, powered by microcosm.
Report a problem