NXC: MS NumPad now usable as an alpha-numerical keyboard

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
Post Reply
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

NXC: MS NumPad now usable as an alpha-numerical keyboard

Post by HaWe »

for all owners of a Mindsensors Numpad: now usable as a keyboard (0-9, A-Z, +-*/ in combination with function keys [*], [#], [*#] )
(operation admittedly somewhat fiddly):
http://www.mindstormsforum.de/viewtopic ... 112#p60112
EDIT (bugfix 1.2):
getch() now works like with ANSI C and waits for a keyboard input without echo on the screen.
If a screen echo is wished, one himself must provide for it (by printf or TextOut).
Last edited by HaWe on 09 Jun 2013, 15:36, edited 1 time in total.
HaWe
Posts: 2500
Joined: 04 Nov 2014, 19:00

Re: NXC: MS NumPad now usable as an alpha-numerical keyboard

Post by HaWe »

the C-like I/O console is finished for a start. (link see above!)
digits 0...9
letters A...Z
symbols (updated, by keypresses *#6...*#9) + - . :

after the print issue has been fixed you may use the following key presses:
// digit + optionally * or # or #*
// long press * => Backspace
// long press # => Space (Blank)
// long press *# => Enter (end of input)

in the example code (link) the console input is copied to a string;
after long press of *# (Enter) the input is terminated and the input string is shown again in a seperate line for control (fw-based possibly cut off)

Code: Select all

// featuring C-like functions from <stdio.h>, <conio.h> :
//=======================================================
// int    getch()              // reads key from numpad, no echo on screen
// string gets(string)         // reads string from numpad + echo on screen
// char   (bool) kbdhit()      // tests if key hit on numpad, no return, no echo
// char   cin (no pipelining)  // reads single key from numpad, no echo on screen
// printf (fmtstring, variant) // displays formatted char, string, int, float
share and enjoy!
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 0 guests