Loading...
Pages: [1]   Go Down
Author Topic: Arduino Uno Gamepad (Input to Game)  (Read 155 times)
0 Members and 1 Guest are viewing this topic.
Austria
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I've wanted to realize a Gamepad with a Arduino Uno Rev. 3
I have bought some Buttons and connected it to my Arduino.

With this short code i can put the signal from 0 to 1.

void setup(){
   Serial.begin(9600);
   pinMode(2,INPUT);
}

void loop(){
   int buttonstatus;
   buttonstatus = digitalRead(2);
   Serial.println(buttonstatus,DEC);
}

Now my Question is, how to use this signal for a game. So that i can press the Button and the game realise that i press it. It should work the same like a keyboard.

Please help me smiley
Thank you very much,
Mario
Logged

Queens, New York
Offline Offline
Edison Member
*
Karma: 28
Posts: 1563
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
It should work the same like a keyboard.
Question, is this going to be a controller for a computer, or an actual gaming console?

Look at the keyboard example provided in the playground and maybe gamepads and joysticks.
NOTE: Only works with Arduino Leonardo!
http://playground.arduino.cc//Main/InterfacingWithHardware#joygame

« Last Edit: February 11, 2013, 08:25:38 am by HazardsMind » Logged

UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino

Arduino Tutorials, coming soon.

"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown

Austria
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It will be controlled by a computer.
So what i need is a Arduino Leonardo and set the Inputs as keyboard signals?

Thanks smiley
Mario
Logged

Queens, New York
Offline Offline
Edison Member
*
Karma: 28
Posts: 1563
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
It will be controlled by a computer.
So wait, are you building a controller to control a computer or use the computer as a controller to control a console?
It is two different things then. If you control a computer, then you would use the keyboard library with a Leonardo. BUT, if you want to trick a console to think the arduino is a controller, it is much different.
« Last Edit: February 11, 2013, 08:48:45 am by HazardsMind » Logged

UNO, MEGA, NANO, 4x4 keypad, micro servos, RF transceivers, bluetooth, ultrasonic sensor, 20x4 I2C LCD, 3.2 TFT touch screen, L298N Dual motor driver, Voice Recognition 15W, Gameduino

Arduino Tutorials, coming soon.

"If your doing nothing, it does not mean your lazy, it just means your open for anything that suits you" - Unknown

Pages: [1]   Go Up
Print
 
Jump to: