Dear all,

Background: Rabbit Microcontroller.
Accessing the board via Telnet. TCP/IP
Uses VT100 Emulation Telnet.

I had been thinking how do I check whether a user had keyed in an UP ARROW. I tried to do a HEX key capture and they returned me 3 HEX numbers.

I am using a Switch Case, I can't combine these 3 HEX codes together and view it as one case.

Each of my character is received from a buffer and not captured as a input string stream.

Meaning, one char by one char it goes into a char variable from the buffer.

HEX KEY for UP arrow is 1b 5b 41

I checked up the net and they gave me 1E as UP ARROW but funny thing is it can't work!

Example:

case '\x1E':
do somthing...
break;

offhand, i don't think you should be using quotes around a numeric. try case 0x1E: or case 30: other than that, i believe Rabbit uses Dynamic-C, which is pretty much out of the scope of this forum, as it's not standard and has its own extensions for these sorts of things

I'm pretty certain you'll have much more luck getting an answer on Rabbit's forums than you will here.


.

This is a perfectly legitimate question for this forum. It's about reading special key sequences. The hardware is just a red herring in this case :icon_wink:


1B 5B 41 is called an escape sequence. In this case ESC [A . So...

When you read a 1B set a flag that remembers that an ESC sequence is being read.
Read the next char, verify it's 5B and forget it.
Read the next char, use a special switch statement for ESC sequences only which processes the arrow and whatever other sequences you deem necessary, and clear your flag.

Comments
thanks for correcting
This article has been dead for over six months. Start a new discussion instead.