Teensy problem

Having trouble with your GBZ build? Ask your questions here!
Post Reply
Silverboulton
Posts: 4
Joined: Sun Feb 04, 2018 4:48 pm

Teensy problem

Post by Silverboulton » Mon Feb 05, 2018 7:30 am

Ok first time using a teensy and the problem I'm having is really odd, all buttons work as keybored pushes ( up is w down is s and so on) it works in the retropie menu but freezes at boot up of any Rom, If I boot a Rom with a snes usb pad and replug in the teensy it will work as controller :?:

User avatar
wermy
Site Admin
Posts: 1346
Joined: Tue May 03, 2016 8:51 pm
Has thanked: 620 times
Been thanked: 1322 times
Contact:

Re: Teensy problem

Post by wermy » Mon Feb 05, 2018 10:33 am

Silverboulton wrote:
Mon Feb 05, 2018 7:30 am
Ok first time using a teensy and the problem I'm having is really odd, all buttons work as keybored pushes ( up is w down is s and so on) it works in the retropie menu but freezes at boot up of any Rom, If I boot a Rom with a snes usb pad and replug in the teensy it will work as controller :?:
When you say it freezes at boot, do you mean it locks up the whole system? Or does it just kick you back to emulationstation? I wonder if maybe you're getting double button presses or something that's aborting the rom loading. 🤔
ImageImageImageImage

Silverboulton
Posts: 4
Joined: Sun Feb 04, 2018 4:48 pm

Re: Teensy problem

Post by Silverboulton » Mon Feb 05, 2018 11:29 am

It's stays on black screen with white box (push a to open menu) If I push any button the key it's mapped to shows on the bottom left of screen (press up a W shows). If I use a usb controller it boots up fine so it's not the Rom or emulater???

Silverboulton
Posts: 4
Joined: Sun Feb 04, 2018 4:48 pm

Re: Teensy problem

Post by Silverboulton » Mon Feb 05, 2018 11:39 am

This is what is loaded on the teensy I added 2 more keys for R2 and L2 could that be the problem???



#include <Bounce.h>

#define NUM_KEYS 14

struct Key {
char keycode;
Bounce* bounce;
};

Key keys[NUM_KEYS];

Key key(char keycode, int pin) {
Key *ret = new Key;
ret->keycode = keycode;
ret->bounce = new Bounce(pin, 10);
pinMode(pin, INPUT_PULLUP);
return *ret;
}

void setupKeys() {
keys[0] = key('w, 0);
keys[1] = key('s', 1);
keys[2] = key('a', 2);
keys[3] = key('d', 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);
keys[12] = key('r',12);
keys[13] = key('t',13);
}

void setup() {
setupKeys();
Keyboard.begin();
// pinMode(0, INPUT_PULLUP);
}

void loop() {
for (int i = 0; i < NUM_KEYS; i++) {
keys.bounce->update();
if (keys.bounce->fallingEdge()) {
Keyboard.press(keys.keycode);
} else if (keys.bounce->risingEdge()) {
Keyboard.release(keys.keycode);
}
}
}
Last edited by Silverboulton on Mon Feb 05, 2018 4:38 pm, edited 1 time in total.

Silverboulton
Posts: 4
Joined: Sun Feb 04, 2018 4:48 pm

Re: Teensy problem

Post by Silverboulton » Mon Feb 05, 2018 4:36 pm

Sorted now loaded different code joystick buttons instead of keybored all working fine

twinturbo
Posts: 1
Joined: Sun Jan 07, 2018 9:52 am
Has thanked: 8 times

Re: Teensy problem

Post by twinturbo » Sun Feb 18, 2018 8:05 am

Silverboulton wrote:
Mon Feb 05, 2018 4:36 pm
Sorted now loaded different code joystick buttons instead of keybored all working fine
Could you elaborate more on what you did? I am having the same problem. Also I am very new to all of this.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest