Hi,
First I would like to thank Maniacbug for making the RF24 library, awesome work! Without it I wouldn't have considered using the nRF24l01 and with the price of the Xbee radios this project would never get off the ground.
Im working on a project where Im using 12 LDR sensors to wirelessly send midi data through arduino mega ->nRF24l01->teensy 2.0->ableton live. Im really excited by the possibilities and Im hoping this thread can help others to build a similar setup(wireless midi performance controller anyone?).
The first hurdle was to find the correct SPI pins on both the mega and the teensy2.0. Here is how I have it connected and working with the pingpair example sketch:
arduino mega:
Vcc - 3.3V
CE - 8
CSN - 9
SCK - 52
MOSI - 51
MISO - 50
IRQ - NC
teensy 2.0:
Vcc - 3.3V from LM317 voltage regulator
CE - 8
CSN - 9
SCK - 1
MOSI - 2
MISO - 3
IRQ - NC
rolepin 7 connected to gnd.
So far so good, Im on the air! I then tried the led remote example and with some tweaking of the pin numbers got that working.
Im still pretty new to writing code and Im really struggling with sending the data array over the RF link.
I have a working code for reading the LDR's on the mega:
#define inputs 8
#define e 1 // this is the delta needed in
// currentPot[i] to send a message
int currentPot[8] = {0,0,0,0,0,0,0,0};
int pot[8] = {0,0,0,0,0,0,0,0};
int channel[8] = {1,2,3,4,5,6,7,8};
void loop()
{
for(int i=0; i<inputs; i++) {
currentPot[i] = analogRead(i) / 8;
if(abs(currentPot[i]-pot[i]) > e) {
sendMidi(channel[i], currentPot[i]);
pot[i] = currentPot[i];
}
}
}
I've already tried several times at integrating this code with the led remote example but Im really struggling with the send and receive part. Basically I would like the mega to send the package when it has scanned all the LDR's and the teensy to recognize a change and send out a midi cc message.
Any help would be highly appreciated.