Snake game is a very popular game. A snake is crawling in a compound wall, some food show up randomly in the wall. Use the arrow keys on your keyboard to direct the snake around the screen and eat the food. The more food the snake eats, the longer it will become. The snake’s movement should not be restricted by an obstacle or its own body. Otherwise, game over!
We can use pcDuino ADC function to sense direction by Joystick Sensor Module.There are two Sensor Module images as below, they are two potentiometers and one button.
(click to download snake source code )
1. Copy this folder to pcduino
2. Open the command window and enter the folder, execute make all, if no permission, running as an dministrator, if appears can’t find curses.h , need to install curses library.
Enter the following command to install curses library: sudo apt-get install libncurses5-dev.
3. The Makefile ARDUINO_PATH variable is the Arduino installation directory. Can be modified according to the real situation