Watch on Youtube:
The code shows how to use LCD, buttons, sound and LEDs in Javascript (easy way). It features:
- drawing numbers and boxes on LCD
- reading and blitting PBM files (can be created using Gimp program)
- reading buttons state
- playing beep sounds
- playing wav file
- animating LED lights under buttons
QUICK WAY
- Grab the latest copy with all compiled dependencies here.
- Extract the archive somewhere in /home directory.
PRO WAY
- You need to have ev3dev firmware installed on sd card: http://www.ev3dev.org/. I highly recommend to setup the Internet connection on your EV3 brick. Otherwise, you will need to install some dependencies manually. We will download some Debian packages, so make sure that package lists are up to date:
sudo apt-get update
- Install GCC and Make (required by ioctl module):
sudo apt-get install build-essential
- For version ev3dev-jessie-2014-12-01 and older install NodeJS-legacy (required by ioctl module):
sudo apt-get install nodejs-legacy
- Copy game to sd card. Make sure that the user have right privileges to write in game folder. You can clone this game directly from Github. To install Git on EV3:
sudo apt-get install git
To clone the repository:
git clone https://github.com/donwojtallo/ev3dev-snake-js.git
- Go to game folder:
cd <path-to-game-folder>
- Install dependencies:
npm install
You Have 2 options:
-
Run in a new virtual terminal:
sudo openvt -s -w -- sudo --user <user> -- nodejs snake.js
To run the game without sound add -no-sound parameter.
or
-
You can run the game directly using Brickman's File Browser. This feature was implemented in version 0.4.0. If you have an older version, upgrade this way:
sudo apt-get upgrade brickman
Grant execute permissions on shell scripts:
chmod u+x run-game.sh run-game-without-sound.sh
Now you can run it by selecting
run-game.sh
orrun-game-without-sound.sh
from Brickmans File Browser.
Got trouble with running this game? Ask for help here.
Enjoy!