100% found this document useful (1 vote)
357 views

Sega Genesis Controller Arduino Code

Arduino program that reads input from a Sega Genesis video game controller and lights up LEDS based on the input.

Uploaded by

Becky Patton
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
357 views

Sega Genesis Controller Arduino Code

Arduino program that reads input from a Sega Genesis video game controller and lights up LEDS based on the input.

Uploaded by

Becky Patton
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

/* Sega Genesis Controller Test Written in 2013 by Scott W. Vincent http://www.lungStruck.

com To the extent possible under law, the author has dedicated all copyright and r elated and neighboring rights to this software to the public domain worldwide. This software is distributed without any warranty. You should have received a copy of the CC0 Public Domain Dedication along with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>. The following webpages were helpful in writing this: http://pinouts.ru/Game/genesiscontroller_pinout.shtml http://arduino.cc/forum/index.php/topic,21263.0.html http://arduino.cc/forum/index.php/topic,49070.0.html */ //Constants const int UP_PIN = 7; const int DOWN_PIN = 3; const int LEFT_PIN = 4; const int RIGHT_PIN = 5; const int AB_PIN = 8; const int SELECT_PIN = 2; const int STARTC_PIN = 6; const int LED1_PIN = 9; const int LED2_PIN = 10; const int LED3_PIN = 11; const int LED4_PIN = 12; const int LED5_PIN = 13; void setup() { //Set Pin modes pinMode(UP_PIN, INPUT); pinMode(DOWN_PIN, INPUT); pinMode(LEFT_PIN, INPUT); pinMode(RIGHT_PIN, INPUT); pinMode(AB_PIN, INPUT); pinMode(SELECT_PIN, OUTPUT); pinMode(STARTC_PIN, INPUT); pinMode(LED1_PIN, OUTPUT); pinMode(LED2_PIN, OUTPUT); pinMode(LED3_PIN, OUTPUT); pinMode(LED4_PIN, OUTPUT); pinMode(LED5_PIN, OUTPUT); } void loop() { //SELECT=GND digitalWrite(SELECT_PIN, LOW); digitalWrite(LED2_PIN, !digitalRead(UP_PIN) || !digitalRead(DOWN_PIN)); digitalWrite(LED4_PIN, !digitalRead(AB_PIN) || !digitalRead(STARTC_PIN)); //A /Start

//SELECT=+5V digitalWrite(SELECT_PIN, HIGH); digitalWrite(LED1_PIN, !digitalRead(LEFT_PIN)); digitalWrite(LED3_PIN, !digitalRead(RIGHT_PIN)); digitalWrite(LED5_PIN, !digitalRead(AB_PIN) || !digitalRead(STARTC_PIN)); //B /C }

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy