Coder Social home page Coder Social logo

davidpagels / n64-arduino-switch Goto Github PK

View Code? Open in Web Editor NEW
27.0 2.0 2.0 24 KB

Play Nintendo Switch using an original N64 controller via an Arduino Uno!

C 94.43% C++ 2.15% Shell 0.33% Makefile 3.09%
arduino-uno arduino-uno-r3 nintendo-switch nintendo-64 n64 n64-controller nintendo-switch-gamepad switch lufa

n64-arduino-switch's Introduction

N64 -> Arduino Uno -> Nintendo Switch

Description

By connecting an original N64 controller to an Arduino UNO R3 running this code, and plugging the USB from the Arduino into a Nintendo Switch, you can use your original N64 controller as a Switch controller! The button mappings were made using The Legend of Zelda: Ocarina of Time on Nintendo Switch Online and the buttons are mapped 1:1.

Inspiration

Due to:

  • the unavailability of Wireless Nintendo Switch N64 controllers
  • no restocks in sight
  • a growing library of nostaligic N64 games on Nintendo switch online

I wanted to try to somehow interface my original N64 controllers with my Nintendo Switch. From creating several macro programs in the past based on the Splatoon pixel art drawer by shinyquagsire23, I knew I could send button presses to the Switch. I just had to figure out how to get N64 controller data from the controller and to the Atmega16u2 on the UNO. Then I found the project by twinone, that allowed you to use an N64 controller with an emulator, but not a switch. So I Frankenstein Monster'd those projects together and made this!

Setup

To program the Atmega328P

  1. Plug in your Arduino to a PC and open 'N64Simplified.ino' in the Arduino IDE.
  2. Install the Arduino N64 Controller Interface Library
  3. Upload to your Arduino To program the Atmega16uP (dfu-programmer required on linux/osx, flip on windows)
  4. Plug in your Arduino to your PC if it's not already
  5. Short the Reset and Ground pins for the USB-Serial Processor
  6. In the root directory of this project, run ./flash.sh Joystick.hex. This will make it so you will no longer be able to program your Arduino's Atmega328P. If you want to restore that ability, you can run ./flash.sh uno.hex and you should be back in business.

Once both these steps are done, you should be able to wire your N64 controller with your data wire on pin 2, then plug your USB cable from the Arduino into a Switch and play some games!

Notes

While looking into converting the joystick x/y axis, I found an article talking about how joysticks rarely have the full range and how developers should only rely on about 1/2 of the full axis range. To fix this, when initially started, I added logic so the joystick will start at 2x sensitivity and auto-scale sensitivity per-side of each axis to allow even old joysticks to get full range.

Many thanks to the work of shinyquagsire, twinone, MickMad, Andrew Brown, Peter Den Hartog, Kai Luke, pothos, Dean Camera, Darran Hunt and many more!

n64-arduino-switch's People

Contributors

davidpagels avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

butchd kirk33

n64-arduino-switch's Issues

Not Compiling / Setup error / Button Mapping

Hello there.
Tried to follow your Guide.

Cant get it to Upload to my Arduino Uno R3 though.
"fatal error: LUFA/Drivers/USB/USB.h: No such file or directory"
"#include <LUFA/Drivers/USB/USB.h>"

1- Plugged in the Arduino to my PC
2-Opened the N64Simplified.ino (it asked me to create a sketch folder, which i did & afterwards i moved everything into there)
3- Tried to Upload but whilie its compiling i get the error message from above.

Ive tried Arduino IDE 1.8.13 and 2.0.4 as i thought maybe this could fix my problem but it did not.
Tried a different USB Port & Board just in case which didnt fix it (obviously?)
Using Windows 10.

Tried to download LUFA as well and inserted it but while compiling i still get the error.

Dont know what im doing wrong here. Or what need to be done. I am pretty new to this.
Ive managed to Setup a N64 to Arduino Leonardo input for my PC before and wanted to try your Switch Code-which i cant get to work.

Also how can i remap the buttons?

Any help would be appreciated.

LUFA Problem

I am trying to compile your project as discribed by you, but i get following error.
exit status 1
LUFA/Drivers/USB/USB.h: No such file or directory
how did you add LUFA to your project ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.