This library allows you to translate MIDI Continuous Controller signals received at a user-defined channel into DMX commands. The library is compatible with Arduino boards and can be used to control DMX fixtures such as lights, fog machines, and more.
- Download the latest version of the library from the GitHub repository.
- Extract the ZIP file and copy the folder to your Arduino libraries directory.
- Restart the Arduino IDE.
- Include the library in your Arduino sketch by adding the following line at the beginning of your code:
#include <MidiDmxBridge.h>- Define the callback method
mididmxbridge::dmx::DmxOnChangeCallbackwith the signature(const uint8_t, const uint8_t), which receives the DMX updates:
static void onDmxChange(const uint8_t channel, const uint8_t value) {
}- Instantiate a
MidiDmxBridgeandmididmxbridge::ISerialReaderobject in you sketch:
static SerialReaderDefault reader;
static MidiDmxBridge MDXBridge(kMidiChannel, onDmxChange, reader);- Initialize the library by calling the
begin()function in thesetup()function of your sketch:
void setup() {
MDXBridge.begin();
}- In the
loop()function of your sketch, call thelisten()function to listen to incoming MIDI messages and translate them into DMX commands:
void loop() {
MDXBridge.listen();
}- Use the
setAttenuation()function to adjust the intensity of the dynamic and static scenes:
MDXBridge.setAttenuation(512);- Use the
switchToDynamicScene()function to switch to the dynamic scene:
MDXBridge.switchToDynamicScene();- Use the
switchToStaticScene()function to switch to the static scene:
MDXBridge.switchToStaticScene();Here's an example sketch that uses the library to control a DMX light fixture listening on MIDI channel 1 and using pins 3 and 4 for MIDI IO:
#include <MidiDmxBridge.h>
static void onDmxChange(const uint8_t channel, const uint8_t value) {}
static SerialReaderDefault reader(3, 4);
static MidiDmxBridge MDXBridge(1, onDmxChange, reader);
void setup() {
MIDI_DMX.begin();
MDXBridge.setStaticScene();
}
void loop() {
MDXBridge.setAttenuation(512);
MDXBridge.listen();
MDXBridge.switchToStaticScene();
delay(1000);
MDXBridge.switchToDynamicScene();
delay(1000);
}This library is released under the Apache V2.0 License. See LICENSE for more information.
Please let me know if you have any questions or feedback. I'm happy to help! 😊