Teensy key wasd configuration - why?

General GBZ-related chat goes here. Share ideas, tips and tricks, or ask questions that don't fit into the hardware/software help forums.
User avatar
statikeffeck
Posts: 31
Joined: Tue Jul 05, 2016 8:35 pm
Has thanked: 23 times
Been thanked: 5 times

Teensy key wasd configuration - why?

Post by statikeffeck » Wed Jul 27, 2016 5:54 pm

I was wondering why map the gameboy controller in keyboard layout to letter keys like wasd q z and so on and not use arrow keys, enter key, etc. I found that I cannot navigate the "Dos" style menus without plugging in a keyboard and I have to be careful about which menu I choose.
I bet if I rewired my teensy to keyboard arrows and at least one enter key I could navigate most of the menus with just the control pad. Has anyone done this or does it break more things than it's worth?

User avatar
Ganreizu
Posts: 552
Joined: Thu May 05, 2016 8:20 am
Has thanked: 168 times
Been thanked: 97 times

Re: Teensy key wasd configuration - why?

Post by Ganreizu » Wed Jul 27, 2016 6:23 pm

It shouldn't break anything. Go right ahead.

User avatar
Fleder
Posts: 849
Joined: Thu May 05, 2016 9:04 am
Location: Germany
Has thanked: 183 times
Been thanked: 258 times

Re: Teensy key wasd configuration - why?

Post by Fleder » Thu Jul 28, 2016 1:09 am

There is nothing to break as it is only a matter of programming the teensy.
If you are not satisfied, just use the original programing again.
You can choose the keys you want.

But if you really want to have a complete keyboard, how about something like this: Measy RC11
Only plug it in if you have to type a lot of stuff.

I use it at my Media Center (Kodi) and it works like a charm. Plus you've got a nice Wii Mote style Mouse, too.
It is also available from the EU warehouse for just a bit more.

It is also available on Amazon with Prime here: https://www.amazon.de/-1-Funktion-Handh ... measy+rc11
Or on DX here: http://eud.dx.com/product/measy-rc11-2- ... -844144871

User avatar
skrapps914
Posts: 184
Joined: Sat May 28, 2016 8:14 pm
Has thanked: 63 times
Been thanked: 33 times

Re: Teensy key wasd configuration - why?

Post by skrapps914 » Thu Jul 28, 2016 1:30 am

Fleder wrote:There is nothing to break as it is only a matter of programming the teensy.
If you are not satisfied, just use the original programing again.
You can choose the keys you want.
this has me intrigued. what is the original programming?
and how do you use it?

i agree with op, i think arrow keys would work better

somehow i managed to code my teensy, making the d-pad hat switches, so i can navigate dos, but now mame wont recognize the hat switches

its all screwy lol

User avatar
Fleder
Posts: 849
Joined: Thu May 05, 2016 9:04 am
Location: Germany
Has thanked: 183 times
Been thanked: 258 times

Re: Teensy key wasd configuration - why?

Post by Fleder » Thu Jul 28, 2016 1:37 am

skrapps914 wrote:this has me intrigued. what is the original programming?
and how do you use it?
The one you used first?
Either the sketch from wermy or any other sketch you used to program your teensy.
And you use it the same way you did before.

User avatar
skrapps914
Posts: 184
Joined: Sat May 28, 2016 8:14 pm
Has thanked: 63 times
Been thanked: 33 times

Re: Teensy key wasd configuration - why?

Post by skrapps914 » Thu Jul 28, 2016 1:40 am

The one you used first?
Either the sketch from wermy or any other sketch you used to program your teensy.
And you use it the same way you did before.
the sketch from wermy used wasd i believe, and if i used things like the scraper, whenever i would input one of those letters, it would also move the cursor. it was hard to use.

i'd like to replace the wsad with arrow keys in the sketch, but dont know how to

User avatar
Fleder
Posts: 849
Joined: Thu May 05, 2016 9:04 am
Location: Germany
Has thanked: 183 times
Been thanked: 258 times

Re: Teensy key wasd configuration - why?

Post by Fleder » Thu Jul 28, 2016 2:03 am

skrapps914 wrote:the sketch from wermy used wasd i believe, and if i used things like the scraper, whenever i would input one of those letters, it would also move the cursor. it was hard to use.

i'd like to replace the wsad with arrow keys in the sketch, but dont know how to
Just replace KEY_W KEY_A KEY_S KEY_D
with KEY_UP KEY_LEFT KEY_DOWN KEY_RIGHT
in the sketch and you should be good to go.

Edit: Wermy did use a different method,
i can't test it right now but you should just replace the respective part of the sketch with this:

Code: Select all

void setupKeys() {
  keys[0] = key('UP', 0);
  keys[1] = key('DOWN', 1);
  keys[2] = key('LEFT', 2);
  keys[3] = key('RIGHT', 3);
  keys[4] = key('p', 4);
  keys[5] = key('l', 5);
  keys[6] = key('o', 6);
  keys[7] = key('k', 7);
  keys[8] = key('x', 8);
  keys[9] = key('z', 9);
  keys[10] = key('q',10);
  keys[11] = key('e',11);
}
Again, i can't test it, you have to try it yourself.

If this does not work, try this one:

Code: Select all

void setupKeys() {
  keys[0] = key('KEY_UP', 0);
  keys[1] = key('KEY_DOWN', 1);
  keys[2] = key('KEY_LEFT', 2);
  keys[3] = key('KEY_RIGHT', 3);
  keys[4] = key('p', 4);
  keys[5] = key('l', 5);
  keys[6] = key('o', 6);
  keys[7] = key('k', 7);
  keys[8] = key('x', 8);
  keys[9] = key('z', 9);
  keys[10] = key('q',10);
  keys[11] = key('e',11);
}

User avatar
skrapps914
Posts: 184
Joined: Sat May 28, 2016 8:14 pm
Has thanked: 63 times
Been thanked: 33 times

Re: Teensy key wasd configuration - why?

Post by skrapps914 » Thu Jul 28, 2016 2:40 am

Fleder wrote:
skrapps914 wrote:the sketch from wermy used wasd i believe, and if i used things like the scraper, whenever i would input one of those letters, it would also move the cursor. it was hard to use.

i'd like to replace the wsad with arrow keys in the sketch, but dont know how to
Just replace KEY_W KEY_A KEY_S KEY_D
with KEY_UP KEY_LEFT KEY_DOWN KEY_RIGHT
in the sketch and you should be good to go.

Edit: Wermy did use a different method,
i can't test it right now but you should just replace the respective part of the sketch with this:

Code: Select all

void setupKeys() {
  keys[0] = key('UP', 0);
  keys[1] = key('DOWN', 1);
  keys[2] = key('LEFT', 2);
  keys[3] = key('RIGHT', 3);
  keys[4] = key('p', 4);
  keys[5] = key('l', 5);
  keys[6] = key('o', 6);
  keys[7] = key('k', 7);
  keys[8] = key('x', 8);
  keys[9] = key('z', 9);
  keys[10] = key('q',10);
  keys[11] = key('e',11);
}
Again, i can't test it, you have to try it yourself.

If this does not work, try this one:

Code: Select all

void setupKeys() {
  keys[0] = key('KEY_UP', 0);
  keys[1] = key('KEY_DOWN', 1);
  keys[2] = key('KEY_LEFT', 2);
  keys[3] = key('KEY_RIGHT', 3);
  keys[4] = key('p', 4);
  keys[5] = key('l', 5);
  keys[6] = key('o', 6);
  keys[7] = key('k', 7);
  keys[8] = key('x', 8);
  keys[9] = key('z', 9);
  keys[10] = key('q',10);
  keys[11] = key('e',11);
}
Thanks a ton!! Going to try it first thing in the morning, when i wake up

User avatar
skrapps914
Posts: 184
Joined: Sat May 28, 2016 8:14 pm
Has thanked: 63 times
Been thanked: 33 times

Re: Teensy key wasd configuration - why?

Post by skrapps914 » Thu Jul 28, 2016 9:16 am

@fleder

none of them would work, an i get an error message, and in emulation station its recognizing just the last letter of each key name.. so UP. became key P, DOWN became key N and so on.

Arduino: 1.6.8 (Windows 10), TD: 1.28, Board: "Teensy LC, Keyboard + Mouse + Joystick, 48 MHz, US English"

warning: character constant too long for its type [enabled by default]

keys[0] = key('KEY_UP', 0);

^

warning: character constant too long for its type [enabled by default]

keys[1] = key('KEY_DOWN', 1);

^

warning: character constant too long for its type [enabled by default]

keys[2] = key('KEY_LEFT', 2);

^

warning: character constant too long for its type [enabled by default]

keys[3] = key('KEY_RIGHT', 3);

^

gbzudlr2:1: error: 'dovoid' does not name a type
dovoid setupKeys() {

^

gbzudlr2:1: error: 'dovoid' does not name a type
dovoid setupKeys() {

^

'dovoid' does not name a type

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

User avatar
Fleder
Posts: 849
Joined: Thu May 05, 2016 9:04 am
Location: Germany
Has thanked: 183 times
Been thanked: 258 times

Re: Teensy key wasd configuration - why?

Post by Fleder » Thu Jul 28, 2016 11:56 pm

skrapps914 wrote:@fleder

none of them would work, an i get an error message, and in emulation station its recognizing just the last letter of each key name.. so UP. became key P, DOWN became key N and so on.
The first one did not work, either?

Hmmm, it seems that arrow keys are a problem because of the serial interface,
as you can not "type" an arrow key. At least that is what other users reported.

You can try to use either KEY_UP_ARROW, KEY_DOWN_ARROW and so on
or their corresponding HEX or Decimal values. But i don't know if this will work.
You will have to try, as is often the case.

Code: Select all

Key				Hex		Decimal
KEY_UP_ARROW		0xDA		218
KEY_DOWN_ARROW	0xD9		217
KEY_LEFT_ARROW	0xD8		216
KEY_RIGHT_ARROW	0xD7		215

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest