Introduction: Truck Lane - a 16x2 LCD Arduino Game

Code: http://bit.ly/lcdtrucks
I was fooling around with the createChar() function to create cars.
How Sinclair ZX Spectrum :) Cars are small, so it's better to view them in full screen mode.
I'm using an Electronic Brick display (long story), but any Hitachi HD44780 compatible would do.

Comments

author
litliao made it!(author)2014-01-22

hi, there. It's such an interesting game. Would you mind if I add it to my tutorial as an example?

author
thedod made it!(author)2014-01-23

Hi.

If what you're doing is not commercial, all you need to do is give me credit by linking here and to the license. If it's commercial - I'd like to know more ;)

Anyway, note that "Truck Lane" is not a full instructable (e.g. there are no schematics). Perhaps Ariadne and/or Marble Disorder are more suitable for a tutorial.

Once your tutorial is ready, please send me a link.

All the best,

The Dod.

author
moeenf made it!(author)2016-02-22

It was so cool!

author
moeenf made it!(author)2016-02-22

It was so cool!

author
moeenf made it!(author)2016-02-22

It was so cool!

author
mike.blais2 made it!(author)2015-02-10

Great Arduino game. Oh I connected a 10k potentiometer to A1 and my 16x2 display is connected to my uno using IIC/I2C/TWI/SPI Serial Interface on pin 4 and 5. Works great. Beside resetting the unit, how to restart game.

you need to do these changes to use the serial interface

remove

#include <LiquidCrystal.h>

LiquidCrystal lcd(2, 3, 4, 5, 6, 7, 8);

add

#include <Wire.h>
#include <LiquidCrystal_I2C.h> //need to downed if you don't have it

LiquidCrystal_I2C lcd(0x27,16,2);

change

const int POTPIN = 1;

to

const int POTPIN = A1;

in void setup()

add

lcd.init(); // initialize the lcd
lcd.backlight(); //add this if you want backlight

in all I used 8 wires for this game. I not sure can I use a 0.5 watt 8 ohm speaker for a Piezo speaker so I left that out.

Works great

author
mike.blais2 made it!(author)2015-02-10

Great Arduino game.

author
bshapiro11 made it!(author)2015-01-20

What other pin setups can use. I have a joy stick sheild by sparkfun. https://www.sparkfun.com/tutorials/171 and it needs a lot of pins. I have 13 to 7 open and A2 to A5 open. I cant seem to make it run the program, I changed "LiquidCrystal lcd(12, 11, 5, 4, 3, 2);"to" LiquidCrystal lcd(12,11,10,9,8,7). any ideas??

author
Kante+Tech made it!(author)2014-08-14

The type of lcd display does not really matter does it?

author
csats made it!(author)2013-04-15

Can you provide the circuit diagram pleaase???

author
thedod made it!(author)2013-04-15

It's quite similar to the one at Ariadne: https://www.instructables.com/id/Ariadne-a-1st-person-maze-on-a-16x2-LCD/#step1
The only differences is that Ariadne also has a push button.
Ariadne also comes with a pde file (Truck Lane also had one, but I guess I've lost it :) ), and is much more fun to play.

author
captalex made it!(author)2011-06-10

nice work, how can i do a similar job on a pic18f4550 , using a 128 x64 lcd.

author
thedod made it!(author)2011-06-10

Thanks.
Re pic: I've never tried working on anything less user-friendly than an Arduino. I'm a coder, not a warrior :) but it shouldn't be hard.
As for 128x64 LCD: when you have real pixel-level graphics [IMHO] you don't need to resort to font glyphs.
Trying to imitate truck lane would be aiming too low when you can place the obstacles (trucks, trees, etc.) on a grid of 64 instead of 5. You can easiily do a ski game with trees (maybe a few moving skiers). Looks more impressive and is a lot more fun to play.

author
captalex made it!(author)2011-06-11

yes the ski game sounds cool, but whats crazy is how you made a scrolling game on an small lcd. anyway, i'm attempting snake at the moment but i dont know if the ski game your mentioned would be easier to implement on my system. i can move pixels and shapes on screen successfully . i just need the algorithm for moving objects and detecting collisions as you've done in your game.

author
hidinger made it!(author)2011-03-12

it's great

About This Instructable

16,733views

12favorites

License:

Bio: Sucks at soldering, compensates with coding. Twitter: @TheRealDod Twister/github/etc.: @TheDod Diaspora: thedod@diasp.de
More by thedod:Cheap solderless reset button for Raspberry PiMake Seedstudio's I2C LCD monitor work with an old ArduinoThermoscope - 16x2 LCD thermometer with S/M/H graphs
Add instructable to: