Control of motor on Keypress

hey guys , let me cut to the chase , If i have to control a motor via serial port i`ll press the button and press enter on serial port monitor that would increase/increment the speed etc.

Now the situation is that i`m in a far more reactive environment , I dont want to press the enter key and the need is to transmit the signal as soon as the key is pressed for example , if i press the ‘w’ key the speed of motor must continue to increase until the key is unpressed or the speed is maximum .

Kindly guide me with the general procedure to this