0

I am interested in creating a bluetooth remote control with buttons for use with Android phones AND iPhone. Is it possible to press one button once (single click NOT long press) and send multiple key codes?

For example a single click sends a key code for brightness down 20 times in a row. The end result is the screen of the phone dims down to zero brightness.

This could be done by assigning a single key code and performing a LONG press but that would take 2-3 seconds. I want to do this with a single click instead. Any ideas?

1 Answers1

0

Have you tried event.preventDefault() on keypresee like below

$('#myID').on('keyup keypress', function(e) {
  var keyCode = e.keyCode || e.which;
  if (keyCode === 13) {
   e.preventDefault();
  }
});
teju c
  • 336
  • 2
  • 8
  • Thanks for the suggestion. I am not sure I understand because my background is not in programming. What programming language is this? What is keycode 13 and what does preventDefault do? – Nikolaos Beratlis Sep 06 '17 at 03:36
  • well that is key code for enter key, you will need to change that with your key code, this is JS. on keypress of key code this will check keycode of your button. and e.preventDefault will prevent ot from multiple submit on single press. just try to add e.preventDefault in your event. https://www.w3schools.com/jquery/event_preventdefault.asp – teju c Sep 06 '17 at 06:42