youneazy
Posts: 3
Joined: Thu Jan 31, 2019 10:36 am

How can I read a controllers input through I2C?

Wed Feb 13, 2019 11:59 am

So i'm working on a project. It's basically a quiz. 1 question and 4 possible answers.

There will be a max of 10 players. Everyone of them has a "controller" with 4 buttons. A yellow, green, red and a blue button. Let's say the first question appears. Player 1 presses the Button1.

I've already coded everything besides the input. I couldn't find out, how i can get the input from a controller. I've seen that it could be possible with I2C. I went on some forums and searched on there but the questions were 10 years old, so it was kinda outdated and wouldnt work.

Hopefully there's someone that can help me with this!

Andyroo
Posts: 2065
Joined: Sat Jun 16, 2018 12:49 am
Location: Lincs U.K.

Re: How can I read a controllers input through I2C?

Wed Feb 13, 2019 1:27 pm

What type of controller do you have?

If you have just basic buttons, I would start simple with a switch connected to the GPIO port and learn to handle that. A great book for this is FOC from https://www.raspberrypi.org/magpi/issue ... o-zero-v1/ and chapter 3 has a simple guide (though please buy the book to support the foundation).

This will not really scale up to 40 buttons so you need to look at how your 'controller' connects...

Something like this https://thepihut.com/collections/raspbe ... ts/io-plus would give you 32 inputs BUT the cabling would be a nightmare :lol: Its based on the MCP23017 I/O expander from Microchip Technology Inc so it may be worth looking at that?
Need Pi spray - these things are breeding in my house...

youneazy
Posts: 3
Joined: Thu Jan 31, 2019 10:36 am

Re: How can I read a controllers input through I2C?

Wed Feb 13, 2019 1:40 pm

Andyroo wrote:
Wed Feb 13, 2019 1:27 pm
What type of controller do you have?

If you have just basic buttons, I would start simple with a switch connected to the GPIO port and learn to handle that. A great book for this is FOC from https://www.raspberrypi.org/magpi/issue ... o-zero-v1/ and chapter 3 has a simple guide (though please buy the book to support the foundation).

This will not really scale up to 40 buttons so you need to look at how your 'controller' connects...

Something like this https://thepihut.com/collections/raspbe ... ts/io-plus would give you 32 inputs BUT the cabling would be a nightmare :lol: Its based on the MCP23017 I/O expander from Microchip Technology Inc so it may be worth looking at that?
It's just a simple controller with 4 Buttons. It was selfmade, so its not from a specific brand. And it is not getting recognized by the PC.

Heater
Posts: 11482
Joined: Tue Jul 17, 2012 3:02 pm

Re: How can I read a controllers input through I2C?

Mon Feb 18, 2019 11:14 am

How are we supposed to advise about connecting to 10 controllers that are home made and that we know nothing about?

Return to “Java”