set variable when some key is pressed

Did you mean like this? (though not exec line connected to set speed now)

Because I am not sure whether I can access character variable inside state machine.