# Detect key press (with input debounce and without terminal echo)

**URL:** <https://discourse.julialang.org/t/detect-key-press-with-input-debounce-and-without-terminal-echo/10772>\
**Category:** General Usage\
**Created:** [May 8, 2018, 6:12am UTC](https://discourse.julialang.org/t/detect-key-press-with-input-debounce-and-without-terminal-echo/10772 "2018-05-08T06:12:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![scelles](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/scelles/32/220408_2.png) [@scelles](https://discourse.julialang.org/u/scelles)\
**Post date:** [May 8, 2018, 6:12am UTC](https://discourse.julialang.org/t/detect-key-press-with-input-debounce-and-without-terminal-echo/10772/1 "2018-05-08T06:12:56Z")

</div>

Hello,

I’d like to detect key press (with input debounce and without terminal echo)  
I did:

```julia
using SFML

dt = now()
dt_last = dt
td_debounce = Dates.Millisecond(500)

while true
  if is_key_pressed(KeyCode.K)
    dt = now()
    td = dt - dt_last
    if td >= td_debounce
      println("NEXT")
      dt_last = dt
    end
  end
end

```

But this solution require SFML.jl which is a bit overkilled.  
Moreover adding more keys is not easy because I will need to put condition like

```julia
    if td >= td_debounce
      ...
    end

```

for each condition `is_key_pressed(...)`.

A last point is that, terminal echo is enabled which is not something I like for my application.

Is there a way to do it for Windows, Linux and Mac OS (without too much dependencies)?

Kind regards
