[GUIDE] Wiring Diagrams: all-in-one board, graceful shutdowns, audio-only board

Various user-contributed guides for hardware-related things
Post Reply
User avatar
hueblo
Posts: 175
Joined: Mon Jun 06, 2016 2:59 pm
Has thanked: 78 times
Been thanked: 81 times

Re: [GUIDE] Wiring Diagrams: all-in-one board, graceful shutdowns, audio-only board

Post by hueblo » Mon Aug 29, 2016 10:32 am

a3k4 wrote:I haven't delved into the code yet, maybe @Helder or @hueblo can help?
You give me too much credit @a3k4. I can edit code if I have a good understanding of it but I'm not using teensy. Maybe @popcorn or even weremy himself can help out with that code?

User avatar
Helder
Trailblazer
Trailblazer
Posts: 2985
Joined: Thu May 05, 2016 8:33 am
Location: Rogers, AR
Has thanked: 1459 times
Been thanked: 3114 times

Re: [GUIDE] Wiring Diagrams: all-in-one board, graceful shutdowns, audio-only board

Post by Helder » Mon Aug 29, 2016 6:45 pm

What Teensy are you using? one of the teensies the NON LC version uses Atmega32u4 while the LC version @Wermy used is a different MCU and should work with his code.

If it's the Atmega32u4 version then you can use the code I have in my programming thread in the Other Hardware subforum.
Chat with me and other members On Discord

Don't contact me about obtaining my board files (as you will not get them). If my Boards or PCB Kits are sold out, they will be restocked as soon as I can get them and there is demand for them. You can join the mailing list on my Website to be notified when they are available.


Helder's Game Tech Website

We will not support any cloned work so don't come to us with technical issues to resolve, go talk to the cloner for help.

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: [GUIDE] Wiring Diagrams: all-in-one board, graceful shutdowns, audio-only board

Post by wermy » Mon Aug 29, 2016 7:50 pm

a3k4 wrote:
warrell wrote:Im using Helders audio board and have followed the Standard wiring diagram (v2.5) to wire the teensy. This is of course different to Wermys set up so the Arduino Project he wrote won't work. I have amended it but its not working for me ill post the code below can anyone take a look and advise please.

Code: Select all

#include <Bounce.h>

#define NUM_KEYS 12

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', 14);
  keys[1] = key('s', 15);
  keys[2] = key('a', 16);
  keys[3] = key('d', 17);
  keys[4] = key('p', 18);
  keys[5] = key('l', 19);
  keys[6] = key('o', 20);
  keys[7] = key('k', 21);
  keys[8] = key('x', 22);
  keys[9] = key('z', 23);
  keys[10] = key('q',24);
  keys[10] = key('e',25);
}

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

void loop() {
  for (int i = 0; i < NUM_KEYS; i++) {
    keys[i].bounce->update();
    if (keys[i].bounce->fallingEdge()) {
      Keyboard.press(keys[i].keycode);
    } else if (keys[i].bounce->risingEdge()) {
      Keyboard.release(keys[i].keycode);
    }
  }
}
I haven't delved into the code yet, maybe @Helder or @hueblo can help?
@warrell What were you trying to modify the code to do and what problems are you having with it? And which Teensy are you using? I haven't tested the code but off the bat I do see on line 32 you're assigning keys[10] for the second time (should be keys[11] there).
ImageImageImageImage

warrell
Posts: 7
Joined: Wed Aug 24, 2016 3:43 am
Been thanked: 5 times

Re: [GUIDE] Wiring Diagrams: all-in-one board, graceful shutdowns, audio-only board

Post by warrell » Tue Aug 30, 2016 2:38 am

@warrell What were you trying to modify the code to do and what problems are you having with it? And which Teensy are you using? I haven't tested the code but off the bat I do see on line 32 you're assigning keys[10] for the second time (should be keys[11] there).
@wermy My intention was not to modify the codes function. Only to have it work with Helder's Audio board & teensy wiring diagram (v2.5) on the first page of this topic. I noticed the numbered through holes used in the diagram are different from in your video so assumed (maybe wrongly?) that the code would need to reflect this? The only changes I have made are to some of the key numbers.

When connected to my Rpi2 running RetroPie no inputs are recognised i.e. nothing happens

@Helder Im using the Teensy-LC I have attached a picture as I have it currently for your reference.

Any help is much appreciated, thanks for your patience

Image

User avatar
Helder
Trailblazer
Trailblazer
Posts: 2985
Joined: Thu May 05, 2016 8:33 am
Location: Rogers, AR
Has thanked: 1459 times
Been thanked: 3114 times

Re: [GUIDE] Wiring Diagrams: all-in-one board, graceful shutdowns, audio-only board

Post by Helder » Tue Aug 30, 2016 2:56 am

If you used Wermy's code like he used in the video then that wiring you have now is incorrect. Follow the video guide and it should work .
Chat with me and other members On Discord

Don't contact me about obtaining my board files (as you will not get them). If my Boards or PCB Kits are sold out, they will be restocked as soon as I can get them and there is demand for them. You can join the mailing list on my Website to be notified when they are available.


Helder's Game Tech Website

We will not support any cloned work so don't come to us with technical issues to resolve, go talk to the cloner for help.

warrell
Posts: 7
Joined: Wed Aug 24, 2016 3:43 am
Been thanked: 5 times

Re: [GUIDE] Wiring Diagrams: all-in-one board, graceful shutdowns, audio-only board

Post by warrell » Tue Aug 30, 2016 3:37 am

Thanks @Helder I think that's what I will do. Is it worth editing the wiring diagrams in this thread to reflect wermy's as I followed those.

User avatar
Tamasco
Posts: 67
Joined: Tue Jun 21, 2016 2:37 pm
Location: Spain
Has thanked: 34 times
Been thanked: 10 times

Re: [GUIDE] Wiring Diagrams: all-in-one board, graceful shutdowns, audio-only board

Post by Tamasco » Tue Aug 30, 2016 3:44 am

warrell wrote: Image
Why are you using those pins in the Teensy? The last time I took the code from wermys, he was using the first ones. This iis what I´m using, and it works.

Code: Select all


#include <Bounce.h>

#define NUM_KEYS 12

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);
}

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

void loop() {
  for (int i = 0; i < NUM_KEYS; i++) {
    keys[i].bounce->update();
    if (keys[i].bounce->fallingEdge()) {
      Keyboard.press(keys[i].keycode);
    } else if (keys[i].bounce->risingEdge()) {
      Keyboard.release(keys[i].keycode);
    }
  }
}
Image

warrell
Posts: 7
Joined: Wed Aug 24, 2016 3:43 am
Been thanked: 5 times

Re: [GUIDE] Wiring Diagrams: all-in-one board, graceful shutdowns, audio-only board

Post by warrell » Tue Aug 30, 2016 5:38 am

Because if you follow the wiring diagram on this thread those are the pins used.

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: [GUIDE] Wiring Diagrams: all-in-one board, graceful shutdowns, audio-only board

Post by wermy » Tue Aug 30, 2016 8:22 am

warrell wrote:Because if you follow the wiring diagram on this thread those are the pins used.
Do you mean this one? http://i.imgur.com/gQGaU4j.png

If so then that one seems to be for a Teensy 3.1.

You can use any pins, really. There is a pinout diagram here you can reference: https://www.pjrc.com/teensy/teensyLC.html#pinout

Probably easier just to re-wire it to use the expected inputs though, honestly. :)
ImageImageImageImage

DarrylUK
Posts: 62
Joined: Thu Jul 21, 2016 2:09 pm
Has thanked: 14 times
Been thanked: 20 times

Re: [GUIDE] Wiring Diagrams: all-in-one board, graceful shutdowns, audio-only board

Post by DarrylUK » Wed Aug 31, 2016 1:21 pm

I have a micro SD breakout board from another project, I was thinking of using it on in a GBZ. The pin out is different to this diagram though. I can't seem to see how it cross refers. Image here, can anyone help?

https://goo.gl/photos/tELgP8huXnoZbrdS6

Thanks

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest