Products for USB Sensing and Control
It is currently Thu Jun 20, 2013 1:55 am

All times are UTC - 7 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Wait For Keyboard Input.
PostPosted: Tue Apr 17, 2012 4:43 pm 
Offline
Phidgetsian

Joined: Wed Jan 19, 2011 3:03 pm
Posts: 5
How would I go abouts writing some code that would run on the SBC2, wait for keyboard input then continue. Currently I have this code working when I have the phidgets connected to windows using Scanner. When I run it from the SBC2 (with a usb keyboard attached) everything works except the text input... In windows I input it via the console. Thoughts?


Top
 Profile Send private message  
 
PostPosted: Wed Apr 18, 2012 8:41 am 
Offline
Engineering

Joined: Thu Nov 19, 2009 4:41 pm
Posts: 188
I found one that seems to work well for me. Its a linux implementation of the DOS function kbhit().

http://linux-sxs.org/programming/kbhit.html

Try that out and see what you think.


Top
 Profile Send private message  
 
PostPosted: Wed Apr 18, 2012 12:27 pm 
Offline
Phidgetsian

Joined: Wed Jan 19, 2011 3:03 pm
Posts: 5
and just to confirm, once i compile / run this on the sbc board, even though it's in c/c++ it will still work with my java app correct? this will just tell the board to listen for keystrokes, but any keystrokes will be sent to my java-app?


Top
 Profile Send private message  
 
PostPosted: Wed Apr 18, 2012 2:29 pm 
Offline
Engineering

Joined: Thu Nov 19, 2009 4:41 pm
Posts: 188
oh i am sorry, i have a habit of not looking at the specific forum this is in, and thus didnt realize it was a java question. I will start paying more attention.

The solution i posted was a c/c++ solution, and so it wont compile for java (whoops!). Let me take a look for java solutions this time.

(or switch to c/c++ :D)


Top
 Profile Send private message  
 
PostPosted: Wed Apr 18, 2012 2:33 pm 
Offline
Phidgetsian

Joined: Wed Jan 19, 2011 3:03 pm
Posts: 5
I'm starting to think the problem might be usb keyboard compatibility on the board. It's throwing java.util.InputMismatchException when I press ANY button on the keyboard. (cannot reproduce problem on windows with built-in laptop keyboard -or- usb keyboard). and after some fooling about I noticed when I press the numlock button the light flashes instead of sticking then kinda goes out, flashes more, etc. So I suppose this isn't a java post anymore (unless theres a way to fix it with java) but if anyone knows of how I would go abouts enabling so that a usb keyboard works for input / console, that would be awesome :)


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 7 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group