Go to Post first post and the FRC "well what is a stick" comes in. Toothpick, does it need to be round, does a carbon fiber chain of Buckie balls count as a stick. CD posters are sooooo predictable. - Foster [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 22-04-2008, 21:41
Alex Dinsmoor's Avatar
Alex Dinsmoor Alex Dinsmoor is offline
Are our seeding points over 9000?
FRC #0201 (FEDS)
Team Role: Alumni
 
Join Date: Dec 2007
Rookie Year: 2008
Location: Rochester Hills, MI
Posts: 528
Alex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant future
Send a message via AIM to Alex Dinsmoor
Joystick and keyboard output question (PC)

I am trying to write a code for converting joystick outputs to keyboard controls, but I can't seam to find where I can call the outputs from. If someone can show me where to find these variables. I also need to know the same things for keyboard outputs (in specific the arrow keys).

Thanks,
Alex Dinsmoor
FRC 201
__________________

'08, '09, '10
4 Years | 14 Competitions | 194 Matches | 119 Wins | 77 Losses | 2 Silver | 1 Gold
  #2   Spotlight this post!  
Unread 22-04-2008, 23:01
whitetiger0990's Avatar
whitetiger0990 whitetiger0990 is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Mar 2006
Rookie Year: 2006
Location: Earth
Posts: 157
whitetiger0990 is a glorious beacon of lightwhitetiger0990 is a glorious beacon of lightwhitetiger0990 is a glorious beacon of lightwhitetiger0990 is a glorious beacon of lightwhitetiger0990 is a glorious beacon of light
Re: Joystick and keyboard output question (PC)

I.. think this is what you are asking.
http://www.ifirobotics.com/docs/lega...e-2004-1-7.pdf

Look at the different tables they have on the ports. The variables are named like "p1_sw_trig" (see the Variable Name column)

This doesn't cover keyboard input or anything. Could you elaborate more on what you are looking for?
__________________
print$q=chr(ord($q)+$1)while("7443-0201-8465130105-12-03135-82482113-06-7672-070208-0613-70"=~/(-?\d\d)/g);
  #3   Spotlight this post!  
Unread 23-04-2008, 07:41
Roger Roger is offline
Registered User
FRC #1153
 
Join Date: Jan 2006
Rookie Year: 1900
Location: Walpole MA
Posts: 685
Roger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond reputeRoger has a reputation beyond repute
Re: Joystick and keyboard output question (PC)

If you are looking for keyboard output (keyboard meaning a computer keyboard, not a robot one?), I think what you're looking for are scan codes (wiki article), which is what the keyboard sends as a number when a key is pressed. Are you trying to use a keyboard to control a robot instead of a joystick?

Here is a very simple routine I did once to test C (not C++) keyboard output:

Code:
void stream (void)  //type out info
{
    int ch;
    while ( (ch=getch()) != '\r')   //loop until ENTER key pressed
    {
          
          if (ch==0xE0)                      //signals 2 char arrow code
          {
              RShow(ch);
              //printf("%c=[%d] or [%X]  ", ch, ch, ch);
              ch=getch();                    //get second character
              RShow(ch);
              //printf("%c=[%d] or [%X]\n", ch, ch, ch);
          }
          else if (ch==0x00)                 //signals 2 char function key
          {
              printf("%c=[%d] or [%X]  ", ch, ch, ch);
              ch=getch();                    //get second character
              printf("%c=[%d] or [%X]\n", ch, ch, ch);
          }
          else   //regular old ASCII code (single character)
          {
          printf("%c=[%d] or [%X]\n", ch, ch, ch);
          }
          //putch(ch);   //display char
        
    }
    printf("%c=[%d] or [%X]\n", ch, ch, ch);
}

void RShow ( char ch )
{
     printf("%c", ch);
     printf("=[%-3d]",ch);
     printf(" or [0x%-2X]",ch);
    
 printf("\n");
}
Most keys are sent as ASCII codes, but the special keys (arrows and function keys) are, well, special, and sent as two numbers. For arrows, the first number is 0XE0 (hexidecimal number); the second key indicates the arrow type. For Function keys, first number is a zero.

Come to think of it, these might not be true "scan codes", but are actually semi-processed numbers. True scan codes I think send the actual keyboard key and you have to figure out what key that represents (depending on hardware), and then mix in the shift/ctrl/alt key(s) separately. (Making a Dvorak keyboard from a QWERTY, for example, back in DOS days.) That's more assembler than C code, so don't worry about it.

What whitetiger0990 has are the codes the robot controller gives you for joystick output. Normally joysticks and keyboards don't mix, so I too am curious on what you may be trying to do.
____________________________
"If it weren't for electricity we'd all be watching television by candlelight." - George Gobel
  #4   Spotlight this post!  
Unread 23-04-2008, 15:07
Alex Dinsmoor's Avatar
Alex Dinsmoor Alex Dinsmoor is offline
Are our seeding points over 9000?
FRC #0201 (FEDS)
Team Role: Alumni
 
Join Date: Dec 2007
Rookie Year: 2008
Location: Rochester Hills, MI
Posts: 528
Alex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant future
Send a message via AIM to Alex Dinsmoor
Re: Joystick and keyboard output question (PC)

Yup that's what I was looking for. I'm trying to make it so when I go forward on the joystick it will automatically press the arrow key that corresponds with the direction. I'm toying with this for online games and such that use the arrow keys.
__________________

'08, '09, '10
4 Years | 14 Competitions | 194 Matches | 119 Wins | 77 Losses | 2 Silver | 1 Gold
  #5   Spotlight this post!  
Unread 23-04-2008, 15:14
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Joystick and keyboard output question (PC)

Does JoyToKey do what you want?
  #6   Spotlight this post!  
Unread 23-04-2008, 21:11
Alex Dinsmoor's Avatar
Alex Dinsmoor Alex Dinsmoor is offline
Are our seeding points over 9000?
FRC #0201 (FEDS)
Team Role: Alumni
 
Join Date: Dec 2007
Rookie Year: 2008
Location: Rochester Hills, MI
Posts: 528
Alex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant futureAlex Dinsmoor has a brilliant future
Send a message via AIM to Alex Dinsmoor
Re: Joystick and keyboard output question (PC)

Quote:
Originally Posted by Alan Anderson View Post
Does JoyToKey do what you want?
It does!!! Thanks for the program, it saves me a lot of time!!!
__________________

'08, '09, '10
4 Years | 14 Competitions | 194 Matches | 119 Wins | 77 Losses | 2 Silver | 1 Gold
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Keyboard Question Molten Chit-Chat 11 10-02-2008 12:49
Joystick Output Values? compwiz2008 Programming 5 17-01-2008 22:40
Question about CMUCAM servo output itsme Programming 9 13-01-2007 17:44
joystick buttons and a quick question h0x4r Programming 2 17-02-2005 00:18
Dashboard Output Question jnossen Technical Discussion 5 02-02-2002 19:52


All times are GMT -5. The time now is 00:59.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi