Robotic Musical Instruments with NXC
The website for NXC and Bricx Command
Center:
http://bricxcc.sourceforge.net/
More Online Resources:
http://www.legoeducation.us/store/
http://www.ortop.org/NXT_Tutorial/
Overview of Bricx Command Center IDE:

Basic Bricx / NXC Commands:
Motor (Output) Commands:
OnFwd("ports", "pwr"); OnRev("ports", "pwr"); Off("ports"); OnFwdSync(“ports”, “pwr”, “turnpct”); RotateMotor(“ports”, “pwr”, “angle”); |
Flow Commands:
Wait(4000);
(milliseconds) until (“condition”); repeat (“value”) { “body” } |
Task and Sub Commands:
Sub methodName() { “body” } task main() { “body” } |
Structure of NXC Commands:

Process
and Tutorial: Building Your Musical Instrument Links to Other Music and Robotic Instruments:
1. Build your instrument: Work with the given instruments and your robotics kit. Try to have your robot play at least three pitches or three different non-pitched percussion instruments. 2. Getting Started with programming:
3. Basic Motor commands
Sample Program to Play Pitch: ![]() Another Sample Program using Motor Rotations: ![]() 4. Compile and Download!
5. How to create a "sub" to simplify programming. To play longer sequences of notes - group patterns together into subroutines ("subs"). Then you can call the subs in the "task main ()" method and reuse them in your programming. Here is a sample program to play a pitch 3 times using a "sub" ![]() 6. Using the Brick to play pitches. The brick can also play pitches. Here is a link to the pages in the NXC programming tutorial outlining how to play pitches with the brick. Playing pitches with NXT Brick using NXC. |