Fun Projects for your LEGO MINDSTORMS NXT!

Home     Projects     Help     Contacts

Machine Gun
Building: Expert
Program: Intermediate

Building Instructions



















Use a medium-length wire to connect the motor to port A on the NXT.


Use the shortest wire for this step.


Connect the touch sensor's wire to port 1 on the NXT.


This step builds the ammunition clip and loading pin.  Please see the Loading and Firing Instructions to see how to use them.  The pile of 3-hole beams are the bullets.  The ammunition clip will hold up to 10 bullets, although the magazine on the gun will hold up to 15 bullets.

The ammunition clip and loading pin can be stored on the gun as shown below.  The gun will not fire with the clip in place as shown.  See the Loading and Firing Instructions to learn how to load and fire the gun.

Machine Gun Programming

Use the program Machine Gun for the Machine Gun.  This program handles the firing by spinning the motor as long as the trigger button (touch sensor) is held down.  The program also uses the orange button on the NXT brick as a "safety" mode button, so that you can toggle the gun in and out of safety mode, to keep it from going off by accident while you are loading or carrying it.


Loading and Firing the Machine Gun

The machine gun must be carefully loaded to get the bullets into the proper position and to prevent them from spilling out.  See the Loading and Firing Instructions.


  • The Machine Gun program uses the touch sensor to trigger the firing of the gun.  There are several other ways you could imagine triggering the firing. For example, take a look at some of the other projects on this web site that use sensors...  Does that give you any ideas?

  • The Machine Gun program makes the machine gun "fully automatic", which means that it keeps firing bullets as long as the trigger is held down.  Can you modify the program to make the gun "semi-automatic" (one bullet fired for each press of the button), or add a semi-automatic mode? 

  • The machine gun is designed to be rapid-fire, but it is not very accurate.  As an advanced building challenge, you could try modifying the design to make the contact between the bullets and the spinning arm more consistent, or add something to force the bullets to shoot straighter.  Perhaps hitting the bullets sideways (on the flat side) would help?  You could also experiment with different kinds of spinning arms or even different kinds of bullets.

Get nxtprograms.com on CD!
Click here for info

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.