
#define MIDI_ON 144
#define MIDI_OFF 128
#define MIDI_CHANNEL 0
char status = 0;
void setup()
{
Serial.begin( 31250 ); // set the MIDI baud rate
}
void loop()
{
status = MIDI_ON + MIDI_CHANNEL;
midiSend( status, 60, 64 ); // send a MIDI ``note on'' message
delay( 500 ); // delay 500 milliseconds
status = MIDI_OFF + MIDI_CHANNEL;
midiSend( status, 60, 0 ); // send a MIDI ``note off'' message
delay( 500 ); // delay 500 milliseconds
}
// Send a 3 byte MIDI message (without checking values)
void midiSend( char cmd, char data1, char data2 )
{
Serial.write( cmd );
Serial.write( data1 );
Serial.write( data2 );
}
|
| ©2003-2026 McGill University. All Rights Reserved. Maintained by Gary P. Scavone. |