5 years ago
For you advanced users just skip to the end where I will provide pictures, steps and maybe a video if I can
Why?
You may ask, why add buttons to the META? So here are my reasons:
Convinced? Let's go!
Theory
The Gamebuino, like any Arduino has pins.
Here's a nice diagram.
This diagram corresponds to the back of the Gamebuino.
Adding buttons is as simple as connecting one end of the wire to ground and the other end to one of the pins 3-12 (To be safe don't use 13 as it isn't usually used for buttons due to complexities)
Compatibility?
Basically any button, 2 pin ones are better as they are less confusing:
I'm not affiliated with these sellers
Despite this 4 pin buttons will work:
Just to clarify here is a diagram of a button - you must use the 2 pins that are next to each other - just ignore the others:
So you will be soldering A and C
OR B and D
Otherwise the button will be permanently "pressed"
Wires
They're wires! Buy em, recycle em, but if you buy them buy ones with male connectors:
We will snip off one end to attach the button and leave the other end to stick into the Gamebuinos pins - easy to put in, and stay in, but also easy to remove without damaging anything.
If you don't have any, normal wires will work, we will just solder connectors on the other side:
Now don't try soldering a paperclip or something to it its a BAD idea! Just buy the wires or connectors- they are unbelievably cheap and you will have spares for other projects.
Soldering?
This is a quick and easy project requiring hardly any soldering so it is good for beginners - it is simple so don't expect to come out as a SOLDERING MASTER!! For people who have soldered it's really easy so don't worry about that.
Not much soldering is needed so I wouldn't really buy a soldering iron just for this project - try doing it at school (yes I'm at school - but I do own a soldering iron), university labs, or steal/borrow/steal one off a friend.
LETS DO IT!
Actually no I need to wait for parts to come so like you will have to wait a few days. lol. I will do a major update when I have finished the tutorial so make sure you follow it!
Adding Support to Games
OK so while we wit for parts to come let's see what code we need to implement buttons - I will go over bare minimum and a few extra bits.
To begin I will try to establish something, some tests show pins 1,2 and 13 are weird or something (unless its just me correct me) so when coding : read this as we don't need a mess of pins for EVERY game!! EITHER tell the player what pins the buttons are on OR use pins 3 and 12. So when coding projects use pins 3 and 12!!
3 and 12! You hear me?
3 and 12!
OK now that's been established a basic script for an L and R button on pin 3 and 12. This will work on any button so when testing use this script (don't believe me? This is the setup I used when testing the script:
Yes that button is made out of tinfoil and paper. It is).
#include <Gamebuino-Meta.h> //my variable names are all over the place sorry bool lpressed;//these will return TRUE if the button is pressed bool rpressed; int lPin = 3;//button pins 3 and 12! int rPin = 12; int lFrame = 0;//completely optional but can be used to check the release of a button gb.button style int rFrame = 0;//called this as it checks for a button press in the previous frame void setup() { gb.begin();//lets go! pinMode(lPin, INPUT_PULLUP); pinMode(rPin, INPUT_PULLUP); } void loop() { while (!gb.update());// gb.display.clear(); if(digitalRead(rPin) == LOW){ rpressed = 1;//yes in actual fact the button will return LOW upon a press! } else{ rpressed = 0; } if(digitalRead(lPin) == LOW){ lpressed = 1;//de ja vu? } else{ lpressed = 0; } if (rpressed) { if(rFrame == 0){//if L was not pressed in previous frame - same as gb.button.pressed bassically gb.sound.playTick(); //put gb.button.pressed action here } //put gb.button.repeat(0) code here for example: gb.display.println("12 and 3!"); rFrame = 1;//this is essential for the press } if (lpressed) { if(lFrame == 0){//if L was not pressed in previous frame - same as gb.button.pressed bassically gb.sound.playTick(); //put gb.button.pressed action here } //put gb.button.repeat(0) code here for example: gb.display.println("3 and 12!"); lFrame = 1;//this is essential for the press } if(!rpressed){ if(rFrame == 1){ rFrame = 0; //this is the same as gb.button.release } } if(!lpressed){ if(lFrame == 1){ lFrame = 0; //this is the same as gb.button.release } } }
Its quite rewarding when this works so stay tuned for PART 3 - the part where we actually do stuff!
Sorry for advertising but Keybuino supports extra buttons now so check it out for applications of extra buttons!
https://gamebuino.com/creations/control-pc-with-gamebuino-meta-keybuino
NEW 5 years ago
cool start, I am looking forward to the rest! One of my next games could profit from an L and R button anyway...
NEW 5 years ago
Others will need to use combinations of buttons since there are not enough :P
NEW 5 years ago
Jeez, I have been 'on the fence' about buying a nice soldering iron for myself again for years now.
Maybe now is the time finally?
Oasis
5 years ago
They are very cheap, and I learnt how to solder in around 15 minutes. You can repair things and make cool things with META or other arduinos - its also very satisfying. Maybe try it out somehow first or talk to someone you know if they found it useful first but I think it is a very cool tool that really allows consumers to be producers.
NEW 5 years ago
They are very cheap, and I learnt how to solder in around 15 minutes. You can repair things and make cool things with META or other arduinos - its also very satisfying. Maybe try it out somehow first or talk to someone you know if they found it useful first but I think it is a very cool tool that really allows consumers to be producers.
NEW 5 years ago
I will wait for the result of Oasis/Owais tutorial. If there is a commonly available button format and I know his final setup I can make a 3d model that should be compatible with it, so everyone can print it with a 3d printer. If there are many who want to have that, maybe Aurélien could add pre-printed versions to his shop. But first step-by-step with this tutorial ;)
NEW 5 years ago
TBH im thinking blu-tac... I will find a better solution later - most likely to do with velcro