I decided, after finishing my MAKERbuino, that my first few projects would be physical alterations of the console and this is the result of my first attempt, a basic implementation of a joystick module I had laying around that can be utilised by any single-player game that already uses directional movement with slight modification to the game’s code.
The joystick simply plugs onto the I2C pins at the top of the MAKERbuino using jumper cables and any game that isn’t already using the I2C pins can have its code slightly modified to use analog pins A4 and A5 as physical input instead of the directional buttons.
I used the ‘Pong’ example sketch from the Gamebuino library as the basis of my test code which I’ve uploaded to pastebin for reference and the wiring for the joystick to I2C pins is as following:
VCC/+5v to VCC/+5v
GND to GND
X axis to SDA
Y axis to SCL
My joystick comes with a button press feature but I have not worked out a simple way of wiring it to the MAKERbuino as of yet.
Thanks for this experimentation. I’ll try too and will add the possibility to use this configuration of joystick in my game(s)
I hope you’ll post alot other experimentations
(I already know now that i can use A5 and A5 as analog entries)
Looking forward to seeing what you come up with, I’m already keeping an eye on your parachute game which I imagine this can work well with
As far as I can tell, both the I2C connectors are linked together on the board so both of them are identical and must use the I2C bus for multiple devices linked together, I’m not sure how to utilise the I2C bus yet so the analog pins can only be used directly for input with 1 module, I’m hoping @albertgajsak might be able to confirm this suspicion, I’ve got a lot to learn before I make some more advanced alterations.
Same to me but Albert have said they are working on the new tutorials for these parts now that the mane sending part is past but he have already to terminate the problem managment… Not easy to be patient … but if all like you are sharing their experiment we will be able to advance with the experience of others.
Are you willing to write a short tutorial on how to use the Joystick and implement it in a game from the game library?
If yes, I’d love to post that on the official MAKERbuino tutorials page.
Btw. check out this old video where we’re connecting various modules to the MAKERbuino.
The I2C is a bus for communication. Both sides require some sort of computing since it involves exchanging addresses, etc. Thus a simple joystick cannot work as an I2C device as is. It requires a dedicated microcontroller (like the Atmega 328P).
Nevertheless, a joystick can work on this port as the SDA and SCL pins can be used as regular I/O pins as well. In fact they have to use an ADC (analog to digital converter) pin to get an analog value. This is fortunately the case on these pins.