How to turn 4x4 keypad into one wire analog signal and how to make this design robust?

Поделиться
HTML-код
  • Опубликовано: 15 сен 2024

Комментарии • 7

  • @KangJangkrik
    @KangJangkrik 5 лет назад +1

    Well... That's more complicated than I thought :/

  • @franciscocasas2082
    @franciscocasas2082 7 лет назад

    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.

  • @franciscocasas2082
    @franciscocasas2082 7 лет назад

    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?

    • @InsaneInvader
      @InsaneInvader  7 лет назад

      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.

  • @franciscocasas2082
    @franciscocasas2082 6 лет назад

    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

    • @InsaneInvader
      @InsaneInvader  6 лет назад

      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!