OK, so I haven’t posted in a while because I have been working on some bigger projects, but yesterday, I took a two hour break and made a 2 player tic tac toe game. I did this with an Arduino and a 2.8″ touchshield from Adafruit.com. It’s pretty basic tic tac toe, and has score tracking, game logic (you can’t go twice in a row, and telling you if you win), and the ability to consume a chunk of time playing tic tac toe with my son. Below is the code, feel free to hack modify etc. If you play against a smart person (or yourself), you will have lots of Mosfet eye games! 🙂
Download the code here. (Arduino 22 .pde file)
Pingback: Tic Tac Touch « adafruit industries blog
Pingback: Tic Tac Touch | ArduinoProjects.INFO
Hey great looking demo! I’ve been trying to get it working, but the standard Adafruit_TFTLCD library and TouchScreen libraries don’t have certain methods that your sketch calls. Namely the drawString() method. I’ve tried Seeedstudios’ TFT library with no luck and found an older Adafruit TFTLCD library out there on the net that did have the drawString() method. Adafruit now breaks out those drawing functions in their Adafruit_GFX library, but still no drawString() method. I took the old drawString() I found, added a textbackground argument to it to work with the new drawChar() method and patched it into the new Adafruit_GFX library. I had to change around quite a few other things but it compiles and runs now.
I could provide this here if you are interested…
Hi Brett! Yeah, I need to update some old code. I used Adafruit libraries and they have changed (a lot) since I posted the code. If your willing to post what you have, that would be great! Love your site by the way!
Thanks Jeremy, it’s a work in progress 😉 You have a very nice site here as well!
Here is the code, complete with all libraries for the 2.8″ TFT Touchscreen Shield from Adafruit, with your Tic Tac Touch updated for Arduino IDE v1.0.1. I only updated the Adafruit_GFX library to contain the drawString() method, and also your sketch to work with the newer libraries.
When I get more time I’ll think of making a proper suggesting to the Adafruit team to update their currently posted GFX library. drawString() is pretty useful 😉
It’s probably a good idea to release sketches with the libraries we are currently using 😉 I know I’m going to keep that in mind going forward. I don’t even think Adafruit’s libraries are version controlled within the file itself which is unfortunate, which makes it important to grab a snapshot of the files used.
Thanks Brett, now to find time to update the rest of my sketches… 0_0
Or do some circuit bending! 😉
Oooh, circuit bending 🙂 Fun.
I’ve been working on the JOS one as well… I’m well past the point of it working though.. and customizing now. However I didn’t save a base copy 🙁 So I’ll have to do it over… or undo a lot of stuff. It’s essentially the same problem, but I found out how the new BG color in the drawChar() method is supposed to work… if you specify the same color background as the foreground, it essentially skips drawing the background (i.e., it leaves it clear – whatever is there stays there).
So in my updated Sketch above, the BG is black, but should be set to the same as the foreground color technically. You just don’t notice it because it’s all a black background in Tic Tac Touch.
I wouldn’t worry too much about ALL of your sketches… others will figure it out (like me). Hopefully they share (like me). 😉