Have you ever thought to develop a library for arduino with your code?, it's better that another existing libraries, because it don't trow fake keys, Congrats again.
Congrats, good design, if I can try with a STM32 wich is 3.3v analog in, I'll need to do any modifications? or just with the built in analog reference is sufficient?
You can use any MCU running at any voltage. Just use the same voltage Vin for the keyboard and for the ADC's Vref (literaly the same, Vin connected to Vref) - it makes the reference voltage accuracy not important at all.
Hi! Unfortunately no code for that but I think it is something like that: while(1) // system main loop { delay(1); // wait 1ms if(key_state != key_state_old) // detect the change { if(key_state == 1) // detect the key is pressed { timeout = 100; // start the timeout counting } else // the key is released { timeout = 0; // stop time counting } } key_state_old = key_state; // remember it for future usage if(timeout) // timeout counting in progress { timeout--; // time goes down if(time == 0) // finished { on_key_held_down(); // the key was constantly pressed for 100 * 1ms } } } However it looks like a code for debouncing... Hope you come out with your own solution!
Well... That's more complicated than I thought :/
Have you ever thought to develop a library for arduino with your code?, it's better that another existing libraries, because it don't trow fake keys, Congrats again.
Congrats, good design, if I can try with a STM32 wich is 3.3v analog in, I'll need to do any modifications? or just with the built in analog reference is sufficient?
You can use any MCU running at any voltage. Just use the same voltage Vin for the keyboard and for the ADC's Vref (literaly the same, Vin connected to Vref) - it makes the reference voltage accuracy not important at all.
it's me again, with a doubt. I need to implement long press functions do you have any code to implement some like that?
Regards
Hi! Unfortunately no code for that but I think it is something like that:
while(1) // system main loop
{
delay(1); // wait 1ms
if(key_state != key_state_old) // detect the change
{
if(key_state == 1) // detect the key is pressed
{
timeout = 100; // start the timeout counting
}
else // the key is released
{
timeout = 0; // stop time counting
}
}
key_state_old = key_state; // remember it for future usage
if(timeout) // timeout counting in progress
{
timeout--; // time goes down
if(time == 0) // finished
{
on_key_held_down(); // the key was constantly pressed for 100 * 1ms
}
}
}
However it looks like a code for debouncing... Hope you come out with your own solution!