Page 57 of 61

Re: WII U RASPBERRY PI 3 FINISHED

Posted: Tue Jul 09, 2019 10:05 am
by VeteranGamer
banjokazooie wrote:
Sun Oct 09, 2016 11:14 am

Teensy Update:

For better analog input in N64 games change any instances of 1.8 like in here " rX = (rX - 512) * 1.8 + 512; " to 1.5.
The analog range is going to be shorter hence joystick is not so sensitive. Retropie is still able to register analog on setup screen but unfortunately you will loose analog movement in psx games. Crash bandicoot is not running anymore :(
Added ESC key for home button to teensy code.

Teensy Update 2:

Home button action modified to switch between Joystick and Keyboard. Now usable in Amiga emulator. Joystick buttons reassigned to match actual wiring.

Code: Select all

const int  MODE = 15;    // the pin that the pushbutton is attached to
const int LED = 11;

int buttonPushCounter = 0;   // counter for the number of button presses
int buttonState = 0;         // current state of the button
int lastButtonState = 0;

void setup() {


  pinMode(0, INPUT_PULLUP);       // 01 Left Shoulder
  pinMode(1, INPUT_PULLUP);       // 02 Lelf Trigger
  pinMode(2, INPUT_PULLUP);       // 03 Right
  pinMode(3, INPUT_PULLUP);       // 04 Left
  pinMode(4, INPUT_PULLUP);       // 05 Up
  pinMode(5, INPUT_PULLUP);       // 06 Down
  pinMode(6, INPUT_PULLUP);       // 07 B
  pinMode(7, INPUT_PULLUP);       // 08 A
  pinMode(8, INPUT_PULLUP);       // 09 Right Trigger
  pinMode(LED, OUTPUT);           // LED
  pinMode(12, INPUT_PULLUP);      // 13 Start
  pinMode(13, INPUT_PULLUP);      // 14 Select
  pinMode(14, INPUT_PULLUP);      // 15 Y
  pinMode(MODE, INPUT_PULLUP);    // HOME Button
  pinMode(18, INPUT_PULLUP);      // 19 Left Joystick Button
  pinMode(19, INPUT_PULLUP);      // 20 Right Joystick Button
  pinMode(22, INPUT_PULLUP);      // 23 Right Shoulder
  pinMode(23, INPUT_PULLUP);      // 24 X

//  Serial.begin(9600);

 }

void loop_joystick() {

if (digitalRead(0) == LOW) 
  {
        Joystick.button(1, 1);
  }
  else
  {
    Joystick.button(1, 0);
    }

if (digitalRead(1) == LOW)
  {
      Joystick.button(2, 1);
  }
  else
  {
      Joystick.button(2, 0);
  }

if (digitalRead(2) == LOW)
  {
  Joystick.button(3, 1);
  }
  else
  {
  Joystick.button(3, 0);
  }

if (digitalRead(3) == LOW)
  {
  Joystick.button(4, 1);
  }
  else
  {
  Joystick.button(4, 0);
  }

if (digitalRead(4) == LOW)
  {
  Joystick.button(5, 1);
  }
  else
  {
  Joystick.button(5, 0);
  }

if (digitalRead(5) == LOW)
  {
  Joystick.button(6, 1);
  }
  else
  {
  Joystick.button(6, 0);
  }

if (digitalRead(6) == LOW)
  {
  Joystick.button(7, 1);
  }
  else
  {
  Joystick.button(7, 0);
  }

if (digitalRead(7) == LOW)
  {
  Joystick.button(8, 1);
  }
  else
  {
  Joystick.button(8, 0);
  }

if (digitalRead(8) == LOW)
  {
  Joystick.button(9, 1);
  }
  else
  {
  Joystick.button(9, 0);
  }

if (digitalRead(12) == LOW)
  {
  Joystick.button(13, 1);
  }
  else
  {
  Joystick.button(13, 0);
  }

if (digitalRead(13) == LOW)
  {
  Joystick.button(14, 1);
  }
  else
  {
  Joystick.button(14, 0);
  }
  
if (digitalRead(14) == LOW)
  {
  Joystick.button(15, 1);
  }
  else
  {
  Joystick.button(15, 0);
  }
  

if (digitalRead(18) == LOW)
  {
  Joystick.button(19, 1);
  }
  else
  {
  Joystick.button(19, 0);
  }

if (digitalRead(19) == LOW)
  {
  Joystick.button(20, 1);
  }
  else
  {
  Joystick.button(20, 0);
  }

if (digitalRead(22) == LOW)
  {
  Joystick.button(23, 1);
  }
  else
  {
  Joystick.button(23, 0);
  }

if (digitalRead(23) == LOW)
  {
  Joystick.button(24, 1);
  }
  else
  {
  Joystick.button(24, 0);
}

  int rX = analogRead(4);
    rX = (rX - 512) * 1.5 + 512;
  if (rX > 1023)
    rX=1023;  
  if (rX < 0)
    rX = 0;
  
  int rY = analogRead(5);
    rY = (rY - 512) * 1.5 + 512;
  if (rY > 1023)
    rY=1023;   
  if (rY < 0)
    rY = 0;
    rY=abs(1023-rY);

  int rL = analogRead(0);
    rL = (rL - 512) * 1.5 + 512;
  if (rL > 1023)
    rL=1023;  
  if (rL < 0)
    rL = 0;
  
  int rR = analogRead(1);
    rR = (rR - 512) * 1.5 + 512;
  if (rR > 1023)
    rR=1023;   
  if (rR < 0)
    rR = 0;
    //rR=abs(1023-rR);
 
  Joystick.X(rX);
  Joystick.Y(rY);
  Joystick.sliderLeft(rL);
  Joystick.sliderRight(rR);
}

  
void loop_keyboard() {

    if (digitalRead(4) == LOW)
  {
    Keyboard.press(KEY_UP);
  }
  else
  {
    Keyboard.release(KEY_UP);
   }
   
  if (digitalRead(5) == LOW)
  {
    Keyboard.press(KEY_DOWN);
  }
  else
  {
    Keyboard.release(KEY_DOWN);
  }
   
  if (digitalRead(3) == LOW)
  {
    Keyboard.press(KEY_LEFT);
  }
  else
  {
    Keyboard.release(KEY_LEFT);
  }
  
  if (digitalRead(2) == LOW)
  {
    Keyboard.press(KEY_RIGHT);
  }
  else
  {
    Keyboard.release(KEY_RIGHT);
  }

  //buttons
  if (digitalRead(0) == LOW)
  {
    Keyboard.press(KEY_ENTER);
  }
  else
  {
    Keyboard.release(KEY_ENTER);
  }
  if (digitalRead(1) == LOW)
  {
    Keyboard.press(KEY_ESC);
  }
  else
  {
    Keyboard.release(KEY_ESC);
  }

if (digitalRead(22) == LOW)
  {
    Keyboard.press(KEY_LEFT_CTRL);
  }
  else
  {
    Keyboard.release(KEY_LEFT_CTRL);
  }

  if (digitalRead(8) == LOW)
  {
    Keyboard.press(KEY_LEFT_ALT);
  }
  else
  {
    Keyboard.release(KEY_LEFT_ALT);
  }

if (digitalRead(7) == LOW)
  {
    Keyboard.press(KEY_A);
  }
  else
  {
    Keyboard.release(KEY_A);
  }
  if (digitalRead(6) == LOW)
  {
    Keyboard.press(KEY_B);
  }
  else
  {
    Keyboard.release(KEY_B);
  }
  if (digitalRead(14) == LOW)
  {
    Keyboard.press(KEY_Y);
  }
  else
  {
    Keyboard.release(KEY_Y);
  }
  if (digitalRead(23) == LOW)
  {
    Keyboard.press(KEY_X);
  }
  else
  {
    Keyboard.release(KEY_X);
  }

  if (digitalRead(12) == LOW)
  {
    Keyboard.press(KEY_F12);
  }
  else
  {
    Keyboard.release(KEY_F12);
  }
   if (digitalRead(13) == LOW)
  {
    Keyboard.press(KEYPAD_5);
  }
  else
  {
    Keyboard.release(KEYPAD_5);
  }

}


void loop() {

  buttonState = digitalRead(MODE);
  if (buttonState != lastButtonState) {
  if (buttonState == HIGH) {
    buttonPushCounter++;
//    Serial.println("on");
//      Serial.print("number of button pushes:  ");
//      Serial.println(buttonPushCounter);
} 
    else {
//  Serial.println("off");
    }
  }
  lastButtonState = buttonState;
  
 if (buttonPushCounter % 2 == 0) {
    digitalWrite(LED, HIGH);
  } else {
   digitalWrite(LED, LOW);
  }
  

    if (digitalRead(LED) == LOW)
  {
     loop_joystick();
  }
  else
  {
    
     loop_keyboard();
  }
  }
banjokazooie wrote:
Sat Nov 17, 2018 2:26 pm
ESC key was used in wii u with windows to get out from any fullscreen app. For retropie build home button switches between joystick and keyboard in troublesome emulators. The setting for teensy looks about right.

I may have missed it.....
but what are the actual keyboard buttons on the Wii U gamepad, when the home button is press....

what does what on the Wii U gamepad (which button press = which keyboard press)

is there a list?
(as a NOOB like me will most probably get things wrong if trying to decipher it pout of the script)

Thanks






.

Re: WII U RASPBERRY PI 3 FINISHED

Posted: Wed Jul 10, 2019 2:35 am
by Gwen59
Hello everyone and thank you very much for your forum and help! (I'm french, so I'm sorry if my english is not good)

I'm a beginner having just created a Gameboy with RaspPi 0W and I'm bad at coding.
In this project to create a WiiU controller with Recalbox, I've a problem...

I wanted to import in the Tensy 2.0 code to set it, but I have an error message:
'Joystick' was not declared in this scope

I do not understand my error in setting the tensy.

Thanks for your help !
Have a good day,

Re: WII U RASPBERRY PI 3 FINISHED

Posted: Fri Jul 12, 2019 3:46 am
by Gwen59
Hello everyone,

I found the solution to the problem I was having.

The problem 'Joysticks' was present because I had not changed the settings in tools: Teensy 2.0 then USB: Joystick + keyboard.

Then I had a new problem that was: 'compile error'. This problem was because I had as recommended the tutorials inserted the file teensy.exe in the installation folder. But the last installation of Teensyduino does not need teensy.exe because it is already integrated.

I continue the installation.
Thank you all and good luck!

Re: WII U RASPBERRY PI 3 FINISHED

Posted: Sat Jul 13, 2019 9:05 am
by Gwen59
Hello, it's me again!

I have a problem again that I can not solve.

It is about food.
I go through a powerBoost 1000C that automatically manages the battery charge, but I can not operate the screen.

Here is my diagram and the battery that I use (LiPo 3,7V 5000mAh)

Image

The 6.5-inch screen control panel lights up and the LED is green, but I have no picture while when I plug my Pi to another HDMI source, it works.

Thank you for your help !

Re: WII U RASPBERRY PI 3 FINISHED

Posted: Sat Jul 13, 2019 11:20 am
by VeteranGamer
Gwen59 wrote:
Sat Jul 13, 2019 9:05 am
Hello, it's me again!

I have a problem again that I can not solve.

It is about food.
I go through a powerBoost 1000C that automatically manages the battery charge, but I can not operate the screen.




Thank you for your help !


here is your solution....

viewtopic.php?f=38&t=6421




.

Re: WII U RASPBERRY PI 3 FINISHED

Posted: Mon Jul 15, 2019 2:58 am
by Gwen59
Thank you so much !
I'm looking right now!

Re: WII U RASPBERRY PI 3 FINISHED

Posted: Sun Jul 21, 2019 10:16 am
by Northguy
Hi all,

Thanks for all the contributions in this thread. Really valuable. I am researching a build myself and already got a ton of useful information.

Currently looking into a good screen and would like to get your opinion on the following board and screen.
SpoilerShow
€ 34,46 6%OFF | HDMI + Audio LCD driver board + 6.5 inch LCD panel AT065TN14 800 * 480 USB 5V DYI kits for Raspberry Pi 3B 2
https://s.click.aliexpress.com/e/bIRbtI0g

This seems the proper panel and the driver board looks slick. It also features an on board audio driver, which might make installation of the separate usb DAC unnecessary? My thoughts: route the speaker cables directly to the pot and skip the DAC.

Re: WII U RASPBERRY PI 3 FINISHED

Posted: Mon Jul 22, 2019 12:44 am
by rcb123
Can anyone link the .ai file for the pcb clad board used to mount everything?

Re: WII U RASPBERRY PI 3 FINISHED

Posted: Mon Jul 22, 2019 2:03 am
by VeteranGamer
Northguy wrote:
Sun Jul 21, 2019 10:16 am


https://s.click.aliexpress.com/e/bIRbtI0g

This seems the proper panel and the driver board looks slick. It also features an on board audio driver, which might make installation of the separate usb DAC unnecessary? My thoughts: route the speaker cables directly to the pot and skip the DAC.

its looks like a very decent screen for this build...
the price is also good...



having the audio option is also good....

not sure how the audio would sound from the on-board speaker outs....

personally
I'd miss out the on-board speaker outs (unless the on-board speaker outs sound great)....
and connect/wire up directly from the on-board headphone socket (which i think/feel is coming straight from the HDMI)

on-board headphone socket
Volume wheel
Headphone socket (for your build)
Amp
Speakers



its a decent screen (I'd buy one)






shameless plug :oops: .....






.

Re: WII U RASPBERRY PI 3 FINISHED

Posted: Mon Jul 22, 2019 4:37 am
by Northguy
Thanks for the reply @VeteranGamer. Not at all offended by your shameless plug :D . It is good for getting ideas :lol:

Do you think that the speaker out is different from the headphone out? Well, there is no other way than ordering one and trying out.

Shameless plug of my previous build :lol:

Image
Image
photo upload