Skip to content
This repository has been archived by the owner on Aug 25, 2023. It is now read-only.

ESP32 usage #79

Open
highway11 opened this issue Jul 4, 2022 · 2 comments
Open

ESP32 usage #79

highway11 opened this issue Jul 4, 2022 · 2 comments

Comments

@highway11
Copy link

highway11 commented Jul 4, 2022

Has anyone successfully used hairless-midi with an ESP32 on Windows 10?
I'm not having luck with either the old ardumidi library or the new ArduinoMidi library.

In the older ardumidi.h library it throws a compile error:
ardumidi.cpp:60:30: error: 'BYTE' was not declared in this scope
I was able to fix this by removing the last 'BYTE' parameter from the Serial.print call.
However I just get Error: got unexpected data byte 0x30. over and over in Hairless Midi
image

If I use the newer Arduino Midi library I'm getting absolutely no serial output at all, I feel like I may be missing something here:

#include <MIDI.h>

// Create and bind the MIDI interface to the default hardware Serial port
//MIDI_CREATE_DEFAULT_INSTANCE();
MIDI_CREATE_INSTANCE(HardwareSerial, Serial, MIDI);



void setup() {
  MIDI.begin(MIDI_CHANNEL_OMNI);  // Listen to all incoming messages
  Serial.begin(115200);
}

void loop() {
  
    MIDI.sendNoteOn(1, 127, 1);
    //MIDI.read();
    delay(1000);

}
@highway11
Copy link
Author

highway11 commented Jul 5, 2022

I have made progress with the old ardumidi library.
To fix compile errors in ardumidi.cpp replace the Serial.print() with Serial.write() and remove the BYTE parameter

void midi_command(byte command, byte channel, byte param1, byte param2)
{
	Serial.write(command | (channel & 0x0F));
	Serial.write(param1 & 0x7F);
	Serial.write(param2 & 0x7F);
}

void midi_command_short(byte command, byte channel, byte param1)
{
	Serial.write(command | (channel & 0x0F));
	Serial.write(param1 & 0x7F);
}

void midi_print(char* msg, int len)
{
	Serial.write(0xFF);
	Serial.write(0x00);
	Serial.write(0x00);
	Serial.write(len );
	Serial.write(msg);
}

@highway11
Copy link
Author

I was going to make a pull request to fix this, but I realized its already fixed in the github repository. I must have used ardumidi that came bundled with the download from https://projectgus.github.io/hairless-midiserial/

Maybe its a good idea to update the downloadable zip files with the fixed ardumidi library

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant