Lego Electric Guitar

guitar_pic

Enchanting is a great free open source program that allows you to program Lego Mindstorms NXT robots in Scratch. Many kids are familiar with Scatch, and for us we found that we were able to start programming our robots almost right away.

The Enchanting application can be downloaded from: https://launchpad.net/enchanting .

The first time that you run Enchanting it will need to reload the NXT firmware with LeJOS ( a Java based Lego NXT firmware). There is a warning message about possible problems with reloading the firmware. We loaded and unloaded the firmware many times without any issues.

We were short some Lego pieces so we made a simple guitar. For step-by-step building directions to make a more complex guitar see:  http://www.nxtprograms.com/guitar/index.html.

To configure the ultrasonic sensor click the “Sensing” button, then select the “configure sensors” button. Next drag the ultrasonic sensor block to the port you are using,

enchanting_sensors_fig

For our guitar project we used an octave (8 notes) and each note was 3 cm. on the guitar’s neck. Our code had 8 “if” blocks where we defined the distance from the ultrasonic sensor and the note to play in that range. When you click on the note in the “play note” block a little keyboard pops up to show you the key.

guitarcode

if_statement

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s