the keypress version works instantly it must be a problem with the ttl code part