This extension lets you send and receive the following standard midi messages:
- note on
- note off
- control change
Connect to a 5pin midi connector like this:
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:
//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)
})
- for PXT/microbit
MIT
This repository can be added as an extension in MakeCode.
- open https://makecode.microbit.org/
- click on New Project
- click on Extensions under the gearwheel menu
- search for https://github.com/captaincredible/pxt-hardware-midi and import
To edit this repository in MakeCode.
- open https://makecode.microbit.org/
- click on Import then click on Import URL
- paste https://github.com/captaincredible/pxt-hardware-midi and click import
Open this page at https://captaincredible.github.io/pxt-hardware-midi/
- for PXT/microbit