Esp8266
#362
Replies: 2 comments
-
Please post the exact code you're trying and the exact error message, as well as the versions of the Arduino ESP8266 core and all libraries you may be using. Use triple backtics with a language specifier to post the code: ```cpp
// your code here
``` Most examples are compiled for the ESP8266 in the continuous integration tests, so they should work just fine. You can tell that an example is tested for the ESP8266 if it's in the “Boards” section on the example page. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hola Peter, este es el codigo estoy usando para esp8266 Ejemplo de AppleMIDI: preguntas
# 197
ciapamusche abrió este número on 8 May · 4 comentarios
Comentarios
@ciapamusche
ciapamusche comentó on 8 May •
Hola, estoy tratando de conseguir un trabajo de ejemplo de AppleMIDI.
tengo un error
Arduino:1.8.12 (Windows 10), Scheda:"DOIT ESP32 DEVKIT V1, 80MHz, 921600, None"
In file included from C:\Users\Damiano\Documents\Arduino\libraries\Control-Surface-master\examples\3. MIDI Interfaces\AppleMIDI\AppleMIDI.ino:99:0:
C:\Users\Damiano\Documents\Arduino\libraries\Control-Surface-master\src/MIDI_Interfaces/Wrappers/FortySevenEffects.hpp:9:18: fatal error: MIDI.h: No such file or directory
compilation terminated.
exit status 1
¿Algún consejo?
Tengo otras preguntas
1) ¿Es posible utilizar AppleMIDI en ESP8266? Es una comunicación wifi, así que creo que es posible.
un tema fuera de tema pero no quiero abrir nuevos problemas inútiles: tengo un pedal Roland EV-5. ¿Cómo puedo conectarme? Muchas gracias por la ayuda
@ciapamusche ciapamusche agregó el pregunta etiqueta on 8 May
@tttapa
Propietario
tttapa comentó on 8 May
C: \ Users \ Damiano \ Documents \ Arduino \ libraries \ Control-Surface-master \ src / MIDI_Interfaces / Wrappers / FortySevenEffects.hpp: 9: 18: error fatal: MIDI.h: No existe tal archivo o directorio
La biblioteca AppleMIDI depende de la biblioteca MIDI FortySevenEffects . Tienes que instalar eso primero.
¿Es posible usar AppleMIDI en ESP8266? Es una comunicación wifi, así que creo que es posible.
Esa es una pregunta para los desarrolladores de AppleMIDI, nunca lo he probado en un ESP8266, pero parece funcionar bien en un ESP32, y aunque no hay ejemplos específicos para el ESP8266, su página de GitHub afirma que es compatible.
un tema fuera de tema pero no quiero abrir nuevos problemas inútiles: tengo un pedal Roland EV-5. ¿Cómo puedo conectarme?
Una búsqueda rápida en Google muestra este esquema:
EV-5
Si es correcto, puede conectar el blindaje a tierra, el anillo a Vcc (3.3V) y la punta a la entrada analógica.
Un ESP8266 no tiene un ADC de 3.3V. Algunas placas tienen un divisor de voltaje a bordo para tener en cuenta eso, pero no es ideal para medir potenciómetros.
Si su placa no tiene un divisor de voltaje, conectar el pedal directamente al pin ADC del ESP8266 lo destruirá.
@ciapamusche
Autor
ciapamusche comentó el 8 de mayo
Perdón por la imprecisión, tengo un NodeMCU que tiene divisor de voltaje interno y puede manejar hasta 3.3v
Probaré el AppleMIDI en él
@ciapamusche
Autor
ciapamusche comentó el 16 de mayo
Actualizar. La biblioteca no funcionó con ESP8266. en contacto con el desarrollador adaptó una rama para solucionar el problema.
lathoub / Arduino-AppleMIDI-Library # 85
Entonces, si desea usar NodeMCU o ESP8266, debe descargar la rama feat / 2.1.0
@ciapamusche
Autor
ciapamusche comentó el 16 de mayo •
Pegando código de trabajo para placas ESP8266. Modificado las bibliotecas Wifi.
/**
* This example demonstrates how to use the AppleMIDI library to use Control
* Surface over the network.
*
* This example requires the
* [AppleMIDI](https://github.com/lathoub/Arduino-AppleMIDI-Library) and
* [MIDI](https://github.com/FortySevenEffects/arduino_midi_library) libraries.
*
* @boards ESP8266
*
* Connections
* -----------
*
* The on-board LED will be used, as well as the push button on GPIO0. These
* should be present on most ESP8266 boards, if this is not the case for your
* board, connect an LED (+ series resistor) and a push button to the relevant
* pins (in the "MIDI Elements" section below). For more details, see the
* @ref NoteButton.ino and @ref 1.Note-LED.ino examples.
*
* WiFi Credentials
* ----------------
*
* Open the tab `WiFi-Credentials.example.h`, enter your WiFi credentials, and
* rename the file to `WiFi-Credentials.h`.
*
* Behavior
* --------
*
* Upload the code to the ESP8266, and open the Serial monitor. You should see
* output like this
*
* ~~~
* Connecting to Your WiFi Network ...
* Connected!
* IP address: 192.168.1.35
* mDNS responder started (ESP8266.local)
* ~~~
*
* Next, connect to the device using your DAW or other MIDI software. If the
* software supports mDNS (Apple Bonjour), you can use `ESP32.local`,
* otherwise, you'll have to use the IP address.
*
* When the connection is successful, you'll see the following message in the
* Serial monitor:
*
* ~~~
* Connected to session Your Session Name
* ~~~
*
* When the button is pushed, a MIDI note on message for note C4 (middle C) is
* sent.
* When the ESP32 receives a MIDI note message for that note, it turn on/off the
* LED accordingly.
*
* RTP MIDI Bridge (Linux)
* -----------------------
*
* If you're on Linux, you can use the rtpmidi-bridge application in the example
* folder. You'll need to install Node.js and NPM.
*
* First, install the necessary dependencies and build tools:
*
* ~~~sh
* sudo apt install build-essential libasound2-dev libavahi-compat-libdnssd-dev
* ~~~
*
* Then install the dependencies using NPM:
*
* ~~~sh
* npm install
* ~~~
* You might get a compilation error for the `avahi_pub` module. This is not an
* issue, it's an optional dependency of the `rtpmidi` module.
*
* Finally, run the application:
*
* ~~~sh
* node rtpmidi-bridge.js
* ~~~
*
* The application will initiate a RTP MIDI connection with the ESP32, create
* virtual MIDI ports, and bridge the MIDI traffic between the RTP MIDI
* connection and the virtual MIDI ports.
* You can then connect your DAW or other MIDI application to the virtual MIDI
* ports.
*
* When the ESP32 is connected, you should see the following in the serial
* monitor and the rtpmidi-bridge output respectively:
*
* ~~~
* Connected to session Node RTPMidi
* ~~~
*
* ~~~
* 2020-05-06T15:50:42.956Z info: Invitation accepted by ESP32
* 2020-05-06T15:50:42.962Z info: Data channel to ESP32 established
* ~~~
*
* Mapping
* -------
*
* Connect the virtual MIDI ports or the AppleMIDI connection to a device or
* application that can send and receive MIDI notes.
*
* Written by PieterP, 2020-05-06
* https://github.com/tttapa/Control-Surface
*/
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <WiFiUdp.h>
#include <AppleMIDI.h>
USING_NAMESPACE_APPLEMIDI
#include <Control_Surface.h>
#include <MIDI_Interfaces/Wrappers/FortySevenEffects.hpp>
#include <ESP8266mDNS.h>
//#include <WiFi.h>
#include <WiFiUdp.h>
#include "WiFi-Credentials.h" // See instructions above
// ----------------------------- MIDI Interface ----------------------------- //
// First create the AppleMIDI instance
APPLEMIDI_CREATE_INSTANCE(WiFiUDP, MIDI, "ESP8266", 5004);
// │ │ │ └──── Local port number
// │ │ └──────────── Name
// │ └─────────────────── MIDI instance name
// └─────────────────────────── Network socket class
// Then wrap it in a Control Surface-compatible MIDI interface
FortySevenEffectsMIDI_Interface<decltype(MIDI) &> AppleMIDI_interface = MIDI;
// ------------------------------ MIDI Elements ----------------------------- //
// Add some MIDI elements for testing
using namespace MIDI_Notes;
NoteButton button = {
0, note(C, 4), // GPIO0 has a push button connected on most boards
};
NoteValueLED led = {
LED_BUILTIN, note(C, 4),
};
// --------------------------- AppleMIDI callbacks -------------------------- //
void onAppleMidiConnected(const ssrc_t &ssrc, const char *name) {
Serial << F("Connected to session ") << name << endl;
}
void onAppleMidiDisconnected(const ssrc_t &ssrc) {
Serial << F("Disconnected") << endl;
}
void onAppleMidiError(const ssrc_t &ssrc, int32_t err) {
Serial << F("Exception ") << err << F(" from ssrc 0x") << hex << ssrc << dec
<< endl;
}
// ---------------------------------- Setup --------------------------------- //
void setup() {
Serial.begin(115200);
// Connect to the WiFi network
Serial << endl << F("Connecting to ") << ssid << ' ';
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
Serial.print("."), delay(250);
Serial << endl
<< F("Connected!") << endl
<< F("IP address: ") << WiFi.localIP() << endl;
// Set up mDNS responder:
if (!MDNS.begin(AppleMIDI.getName()))
FATAL_ERROR(F("Error setting up MDNS responder!"), 0x0032);
Serial << F("mDNS responder started (") << AppleMIDI.getName() << ".local)"
<< endl;
MDNS.addService("apple-midi", "udp", AppleMIDI.getPort());
// Set up some AppleMIDI callback handles
AppleMIDI.setHandleConnected(onAppleMidiConnected);
AppleMIDI.setHandleDisconnected(onAppleMidiDisconnected);
AppleMIDI.setHandleError(onAppleMidiError);
// Initialize Control Surface (also calls MIDI.begin())
Control_Surface.begin();
}
// ---------------------------------- Loop ---------------------------------- //
void loop() {
// Update all MIDI elements and handle incoming MIDI
Control_Surface.loop();
}
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hola Peter, he estado tratando de compilar para esp8266 pero no es posible, use tu ejemplo para esp32 y le nombre las librerias de esp8266 pero no compila, no se a que se deba el error.
Muchas gracias
Beta Was this translation helpful? Give feedback.
All reactions