10.05.2013

Update: Snake for other platforms

I changed a little bit the code to obtain a web version of the game!
The links are added in download zone !
Since I love open source all the codes are released in the zip file.
The HTML and Javascript codes are not commented because all the work
is done by Processing which has a javascript mode which allows to convert
the code from Processing language to Javascript! Have fun!

Happy sketching!

10.04.2013

Snake for others platforms

As you can see in the previous post it is possible to run a simplified snake version also on Arduino Esplora. But have you got Arduino Esplora?
If the answer is no you can play to this fantastic game also with your own personal computer (Mac, Linux or Windows doesn't matter). How?
By installing the Processing app (you can download  it here), but what is such an application and why have I to install it?
Because it is an open source language which allows to develop your own graphical applications without particular skills. It's very easy, trust me.
A friend of mine discovered Processing and now he is programming his own applications both for his computer and for his Android Phone and now he put his app also on the Google Play Store (oh yes you can make many money if you have a good idea).
Ok, have you downloaded Processing? Well, there is a version of Snake also for you and you can find it in the download page of this website (link) for all the computer OS (i.e. Linux Mac and Windows) and there will be also a little easter egg (I will reveal it on the next post when all will be ready).
The code is coming soon because I have to add the comments to make it readable also to other people because, also if it is a porting of the Arduino game some parts of the code have had to be rewritten.
If there are any problem feel free to comment!

9.30.2013

Snake for Arduino Esplora

This is a sketch for Arduino Esplora with TFT screen.It is a porting of the famous game Snake completely rewritten for this platform. The snake is drown on the screen and its motion is obtained adding another block in front of it and deleting the last one so it seems that the snake is moving. To choose the snake motion direction you have to press the buttons of Arduino Esplora. There is a green beacon on the screen which is the target of the game. You have to eat the beacon with the snake and for each eaten beacon you earn 9 points. You can choose also the speed of the snake through the slider. The code is highly commented so it would be easy to know what it is doing.

Click the button to show the code.


The snake positions are saved into array positions and positions are updated according to the selected speed (by the slider). There are 4 types of motion, one for each direction, and so there are four cases in moveTheSnake function. If a beacon is eaten the last block of the snake is not deleted and snakeLenght is increased, otherwise when the position is updated the last block is deleted printing it black. Also the score is updated printing it black and reprinting the new one in white. All this is done because in such a way the refreshing procedure will be faster than updating all the screen (remember we have a 16 Mhz micro). The beacon is placed on the screen by a random way. The random sequence is initialized with the temperature sensor. If there are more sketch problems feel free to comment.


Happy sketching.

Introduction

Hi guys,
this blog is about electronic and how it can be used to Make your own DIY project. You will wonder how easy it is. It will be focused on Arduino which is a powerful tool to develop your own applications. I love it and you will love it too. It is an open source and open hardware instrument and there is a lot of documentation on the web, so it will be very easy to obtain what you want with a little searches.
I will try to post some of my projects to guide you on how some things can be realized. So there will be a lot o sketches (written in C) highly commented to explain how the code works and what it is doing with such an operation. If there are misunderstanding feel free to comment for more explanations on what the code is doing, I will try to help you.
Moreover there will be also others programs, not only Arduino ones. As a matter of fact I have fun also developing some applications for Android or PC so also these codes will be posted. Many of them will be done with Processing and I will post also these codes. They are part of the DIY project that I am following and I want to share with you.

Happy sketching.