Hello,
I would like to send LFO values via midi control changes wirelessly to several receivers using NRF24 network and teensy 4 (I am beginner ). I try to test it sending data to one receiver with the following code for transmitter. Midi works fine if I donít send data to the network, but it becomes very slow if I send data to the network by activating the last line of code :
Code:
network.write(nHeaderA, &value, sizeof(value));
Can you help me please ?
Thank you!





Code:
#include <SPI.h>
#include <RF24.h>
#include <RF24Network.h>

#define pinCE     9         
#define pinCSN    10         
#define pinLEDA    5        

RF24 radio(pinCE, pinCSN);    
RF24Network network(radio);   
    
uint16_t thisTransmitterAdress = 00;
uint16_t receiverAdress = 01;

void setup() {
  pinMode(pinLEDA, OUTPUT);  
  
  usbMIDI.setHandleControlChange(myControlChange);
  
  SPI.begin();
  radio.begin();                           
  radio.setPALevel(RF24_PA_MIN);        
  radio.setDataRate(RF24_2MBPS);        
  network.begin(64, thisTransmitterAdress);   
  delay(500);              
}

void loop() {
  usbMIDI.read();
  network.update();                                                    
}

void myControlChange(byte channel, byte control, byte value) {
  analogWrite(pinLEDA, value); // monitor activity

  RF24NetworkHeader nHeaderA(receiverAdress);
  network.write(nHeaderA, &value, sizeof(value)); // very slow if activated
}