pxt-calliope/libs/calliope-midi/midi.ts
Matthias L. Jugel 28aa7d451f add midi example and i2c test
(cherry picked from commit 436e376)
2017-04-04 10:14:02 +02:00

24 lines
724 B
TypeScript

serial.redirect(
SerialPin.P0,
SerialPin.P1,
31250
);
basic.forever(() => {
for (let note = 0; note <= 90 - 1; note++) {
// Note on channel 1 (0x90), some note value (note),
// middle velocity (0x45):
serial.writeString(String.fromCharCode(144));
serial.writeString(String.fromCharCode(note));
serial.writeString(String.fromCharCode(69));
basic.pause(100);
// Note on channel 1 (0x90), some note value (note),
// silent velocity (0x00):
serial.writeString(String.fromCharCode(144));
serial.writeString(String.fromCharCode(note));
serial.writeString("\0");
basic.pause(100);
basic.pause(1000);
}
});