{"id":23725955,"url":"https://github.com/harryslabdotnet/nes-controller-interface","last_synced_at":"2026-05-07T01:03:23.023Z","repository":{"id":269877612,"uuid":"908716303","full_name":"HarrysLabDotNet/nes-controller-interface","owner":"HarrysLabDotNet","description":"A simple interface for the NES controller, allowing for the 8 buttons of the NES controller to be read by a microcontroller. Available at https://harryslab.net/nes-controller-breakout-board.","archived":false,"fork":false,"pushed_at":"2024-12-28T21:39:06.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-13T20:04:02.282Z","etag":null,"topics":["arduino","arduino-library","controller","nes","nintendo","platformio","platformio-arduino","platformio-library"],"latest_commit_sha":null,"homepage":"https://harryslab.net/nes-controller-breakout-board","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HarrysLabDotNet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-26T19:16:14.000Z","updated_at":"2024-12-28T21:38:57.000Z","dependencies_parsed_at":"2025-05-23T16:47:09.560Z","dependency_job_id":"631dbf4d-9214-4943-a3fa-dd71f2fec520","html_url":"https://github.com/HarrysLabDotNet/nes-controller-interface","commit_stats":null,"previous_names":["harryslabdotnet/nes-controller-interface-platform-io","harryslabdotnet/nes-controller-interface"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/HarrysLabDotNet/nes-controller-interface","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarrysLabDotNet%2Fnes-controller-interface","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarrysLabDotNet%2Fnes-controller-interface/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarrysLabDotNet%2Fnes-controller-interface/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarrysLabDotNet%2Fnes-controller-interface/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HarrysLabDotNet","download_url":"https://codeload.github.com/HarrysLabDotNet/nes-controller-interface/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarrysLabDotNet%2Fnes-controller-interface/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274095074,"owners_count":25221431,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["arduino","arduino-library","controller","nes","nintendo","platformio","platformio-arduino","platformio-library"],"created_at":"2024-12-31T00:16:52.807Z","updated_at":"2026-05-07T01:03:21.433Z","avatar_url":"https://github.com/HarrysLabDotNet.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NES Controller Interface (Platform IO and Arduino Library)\n\nA simple interface for the NES controller, allowing for the 8 buttons of the NES\ncontroller to be read by a microcontroller.\n\n## Hardware\n\nThe breakout board that allows for the NES Controller to be connected to a\nmicrocontroller is available online at\n[harryslab.net/nes-controller-breakout-board](https://harryslab.net/nes-controller-breakout-board).\n\n# Installation (Platform IO)\n\nTo install the library, add the following to the `platformio.ini` file.\n\n```ini\nlib_deps =\n    harryslabdotnet/NESControllerInterface\n```\n\nThe library can also be found by searching for `NESControllerInterface` in the\nPlatformIO Library Manager.\n\n# Installation (Arduino)\n\n- Download the repository as a ZIP file.\n- Open the Arduino IDE.\n- Go to `Sketch \u003e Include Library \u003e Add .ZIP Library...`.\n- Select the ZIP file of the library.\n- The library will now be installed and available under\n  `Sketch \u003e Include Library \u003e NESControllerInterface`.\n\n## Usage\n\nCreating the interface is simple. The constructor for the\n`NESControllerInterface` takes 3 pins as parameters. The first is the data pin,\nthe second is the load pin, and the third is the clock pin.\n\n```cpp\n#include \u003cNESControllerInterface.h\u003e\n\n// Constructor for the NESControllerInterface class.\n// The first parameter is the data pin, the second is the load pin, and the\n// third is the clock pin. The GPIO pins 8, 9 and 10 have been selected for this\n// example, however, any gpio pins will work.\nNESControllerInterface nes(8, 9, 10);\n```\n\nThen to read the buttons, a call to the `read()` function will read the button\nvalues as a byte.\n\n```cpp\n// Read the data from the controller as a byte.\nuint8_t data = nes.read();\nSerial.print(\"NES Data: \");\nSerial.println(data, BIN);\n```\n\nTo simplify reading the buttons, the values can be read as a NESInput struct.\nThis has additional functions to check the state of each button.\n\n```cpp\n// Get the input from the controller, as a struct.\n// This allows for the buttons to be accessed by name, rather than by bit\n// manipulation.\nNESInput input = nes.getNESInput();\n\n// Now each button can be read as a boolean, as follows,\nif (input.buttonA) {\n    // A button is pressed.\n} else {\n    // A button is not pressed.\n}\n// Additional functionality for this struct can be found in\n// NESControllerInterface.h\n\n// Print the input to the serial monitor, using implicit conversion to a\n// string.\nSerial.println(input);\n\n// Print the states of the buttons to the serial monitor, using the\n// statesAsString() method.\nSerial.println(input.statesAsString());\n\n// Print a comma-separated list of the buttons that are currently pressed.\nSerial.print(\"List of pressed buttons: \");\nSerial.println(input.buttonsPressedAsString());\n\n// Print weather or not any buttons are pressed.\nSerial.print(\"Are any buttons pressed? : \");\nSerial.println((input.anyButtonPressed()) ? \"Yes\" : \"No\");\n\n// Print out the states of the buttons individually.\nSerial.print(\"Is the A button pressed? : \");\nSerial.println((input.buttonA) ? \"Yes\" : \"No\");\n\nSerial.print(\"Is the B button pressed? : \");\nSerial.println((input.buttonB) ? \"Yes\" : \"No\");\n\nSerial.print(\"Is the Select button pressed? : \");\nSerial.println((input.buttonSelect) ? \"Yes\" : \"No\");\n\nSerial.print(\"Is the Start button pressed? : \");\nSerial.println((input.buttonStart) ? \"Yes\" : \"No\");\n\nSerial.print(\"Is the Up button pressed? : \");\nSerial.println((input.buttonUp) ? \"Yes\" : \"No\");\n\nSerial.print(\"Is the Down button pressed? : \");\nSerial.println((input.buttonDown) ? \"Yes\" : \"No\");\n\nSerial.print(\"Is the Left button pressed? : \");\nSerial.println((input.buttonLeft) ? \"Yes\" : \"No\");\n\nSerial.print(\"Is the Right button pressed? : \");\nSerial.println((input.buttonRight) ? \"Yes\" : \"No\");\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharryslabdotnet%2Fnes-controller-interface","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharryslabdotnet%2Fnes-controller-interface","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharryslabdotnet%2Fnes-controller-interface/lists"}