Fun Projects for your LEGO MINDSTORMS NXT!

Home     Projects     Help     Contacts

Baseball Game
Building: Advanced
Program: Intermediate

Building Instructions


Start by building the Ball Shooter (without the NXT and wire connection).
Click the picture for building instructions.

Building Instructions







You can use the NXT with either AA batteries or the NXT Rechargeable Battery Pack.









Baseball Game Programming
Download Program (help)

Use the Baseball program for the Baseball Game.  Find an empty area on the floor next to a wall or closed door and position the game about 2 feet (60 cm) from the wall so that the pitched balls will bounce against the wall and rebound in the direction of the batter and catcher, as shown below.

  You will need to experiment with the angle of placement to get some pitches to be strikes.  Note that the pitches will vary considerably due to the way the balls are released from the shooter (it will be sort of a wild pitcher).  Load 6 balls into the pitching machine, hold the touch sensor in your hand, and then start the program.   The program will automatically pitch balls every two seconds.

When you see a pitch that looks like it will be a strike, press the touch sensor to try to swing the bat at the right time.  If you swing and miss the pitch, or if you ignore the pitch and it is caught by the catcher, it is a "strike".  If you don't swing and the ball misses the catcher, then it is a "ball".  Your turn at bat is successful if you can get a hit or 4 balls before you get 3 strikes.  Feel free to make up your own rules as well!


  • Try making some modifications to the game to make it easier (or harder) to get a good hit.  They say in baseball that most people can hit both more consistently and farther with a lighter bat.  Try making the bat lighter.  Does it help?  Why?  Is the result and/or the reason similar to real baseball?

  • Try making some markers for the field (with LEGOs or whatever) to mark foul balls (hit too far to the left or right), and maybe some targets that either signal different kinds of hits (e.g. home run) or an out.

  • If you know how to program with variables, can you extend the program to add a ball and strike counter on the NXT screen?  Maybe pressing Left Arrow counts a ball, Right arrow counts a strike, and Enter resets the count.

  • As an advanced building challenge, can you use another sensor to detect when a ball is a strike (is caught by the catcher)?  Then can you extend the program to count balls and strikes automatically?


Home     Projects     Help     Contacts


Copyright 2007-2011 by Dave Parker.  All rights reserved. 
All project designs, images, and programs are protected by copyright.  Please see the usage policy.