Robotic Musical Instruments with NXC
Overview of Bricx Command Center IDE:
Basic Bricx / NXC Commands:
Motor (Output) Commands:
OnFwdSync(“ports”, “pwr”, “turnpct”);
RotateMotor(“ports”, “pwr”, “angle”);
Task and Sub Commands:
Structure of NXC Commands:
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.