View on GitHub

pxt-hardware-MIDI

send and receive midi messages using pins on the microbit.

MIDI in/out

This extension lets you send and receive the following standard midi messages:

Wiring output

Connect to a 5pin midi connector like this: wiring output

Wiring input

the same wiring works for input in most situations, but if you want to follow the MIDI spec the input should have galvanic isolation by using an optocuopler like this: wiring output

Basic usage


//Set the midi in and midi out pins
midiInOut.setMidiInPin(SerialPin.P0)
midiInOut.setMidiOutPin(SerialPin.P1)

//Send notes (note number, velocity, duration, midi channel)
midiInOut.sendNote(45,127,100,1)

// Act on incoming MIDI messages
midiInOut.onReceiveNoteOn(function (channel, noteNumber, velocity) {
    basic.showNumber(noteNumber)
})

Supported targets

License

MIT

Use as Extension

This repository can be added as an extension in MakeCode.

Edit this project Build status badge

To edit this repository in MakeCode.

##

Open this page at https://captaincredible.github.io/pxt-hardware-midi/

Metadata (used for search, rendering)