Serial Monitor Control

Hello,

Simple question really. I just cannot find the answer.

I currently am controlling a remote micro controller via the serial monitor.
I press w, it goes forward and keeps going forward untill I hit w again. Toggle
basically. I want it to be push and hold. I am already thinking this probably is
not possible. However Id like to find out!

Sorry for the re-post. If my last one shows up, It was not there when I posted this.
Thanks.

(deleted)

Ya know, That was the best guess I could come up with. That the end of this question?

Your PC program needs to detect the key-pressed and key-released events. Send (say) 'W' when the key is pressed and 'w' (lower case) when it is released.

...R

Hi,
Could be simpler.. Try out your serial monitor. Set to "No Line Ending". Holding down "w" sends a long series of W until you let go.

Just handle that in the Arduino..

Trying what you said, no line ending... So far no matter what I try it all is the same. Type then enter. Thanks!

terryking228:
Hi,
Could be simpler.. Try out your serial monitor. Set to "No Line Ending". Holding down "w" sends a long series of W until you let go.

No, it doesn't send anything until you click on "send"

You need to use a real terminal emulator.

Thank you Groove, I think that sums it up.

Hi,

No, it doesn't send anything until you click on "send"

Oh... I Knew That! (Quote: Miss Piggy)

Hmm.. I wonder if other PC terminal programs will send as typed??

Instead of serial monitor use PuTTY or another terminal emulator that sends keystrokes immediately.

Holding down "w" sends a long series of W until you let go.

There is absolutely NO reason to send a long series of anything. A key has only 2 states UP or DOWN so you only need to send data when the state changes.

...R

jgreene33:
I want it to be push and hold. I am already thinking this probably is
not possible. However Id like to find out!

It is possible if you use a terminal emulator that sends keys as they are typed, not Serial Monitor.

You have made your PC into the user interface. What it does when you press/release a key is what it is configured to do. Most PCs have key repeat speed in their settings to 4/second by default which makes “is typed pressed or released?” moot.

I set up (and saved the settings under a name) a PuTTY session to interact with this sketch:

void setup( void )
{
  Serial.begin( 250000 );
  Serial.println( "\nserial connected..." );

}

char ch;

void loop( void )
{
  if ( Serial.available())
  {
    ch = Serial.read();
    Serial.write( ch );
    Serial.write( '\n' );
  }
}

When I press a key it echoes back on the terminal screen, adding a newline (’\n’). When I hold the key down it repeats.