Hi Gralin,
Good news… It works
right off the box… no changes to the code…
all i had to do is set Both my Spider and Panda to the same address by simply having this in the Panda:
public class Program
{
private static NRF24L01Plus _module;
public static OutputPort led = new OutputPort((Cpu.Pin)FEZ_Pin.Digital.LED, false);
public static void Main()
{
const Cpu.Pin chipSelectPin = (Cpu.Pin)FEZ_Pin.Digital.Di3;
const Cpu.Pin interruptPin = (Cpu.Pin)FEZ_Pin.Interrupt.UEXT10;
const Cpu.Pin chipEnablePin = (Cpu.Pin)FEZ_Pin.Digital.Di2;
const SPI.SPI_module spi = SPI.SPI_module.SPI1;
var address = Encoding.UTF8.GetBytes("PANDA");
_module = new NRF24L01Plus();
_module.Initialize(spi, chipSelectPin, chipEnablePin, interruptPin);
_module.Configure(address, 10);
_module.OnDataReceived += OnReceive;
_module.OnTransmitFailed += () => Debug.Print("Send failed");
_module.OnTransmitSuccess += () => Debug.Print("Send ok");
_module.Enable();
int regValue = _module.Execute(Commands.R_REGISTER, Registers.RF_SETUP, new byte[1])[1];
regValue |= 1 << Bits.RF_DR_LOW;
_module.Execute(Commands.W_REGISTER, Registers.RF_SETUP, new[] { (byte)regValue });
// example of reading your own address
var myAddress = _module.GetAddress(AddressSlot.Zero, 5);
Debug.Print("I am " + new string(Encoding.UTF8.GetChars(myAddress)));
Debug.Print("Waiting for data...");
_module.SendTo(Encoding.UTF8.GetBytes("HYDRA"), Encoding.UTF8.GetBytes("HELLO Hydra"));
PowerState.Sleep(SleepLevel.DeepSleep, HardwareEvent.GeneralPurpose);//put the device to sleep...
Thread.Sleep(Timeout.Infinite);
}
private static void OnReceive(byte[] data)
{
try
{
Debug.Print("<- " + new string(Encoding.UTF8.GetChars(data)));
}
catch (Exception)
{
}
led.Write(!led.Read());
}
}
and the Spider Code:
public partial class Program
{
void ProgramStarted()
{
nordic.Configure(Encoding.UTF8.GetBytes("PANDA"), 10);
nordic.DataReceived += new NRF24L01Plus.OnDataRecievedHandler(NordicDataReceived);
nordic.TransmitFailed += () =>
{
Mainboard.SetDebugLED(false);
Debug.Print("Send failed");
};
nordic.TransmitSuccess += () =>
{
Mainboard.SetDebugLED(true);
Debug.Print("Send ok");
Thread.Sleep(1000);
Mainboard.SetDebugLED(false);
};
nordic.Enable();
button.ButtonPressed += ButtonButtonPressed;
int regValue = nordic.Api.Execute(Commands.R_REGISTER, Registers.RF_SETUP, new byte[1])[1];
regValue |= 1 << Bits.RF_DR_LOW;
nordic.Api.Execute(Commands.W_REGISTER, Registers.RF_SETUP, new[] {(byte) regValue });
// example of reading your own address
var myAddress = nordic.Api.GetAddress(AddressSlot.Zero, 5);
Debug.Print("I am " + new string(Encoding.UTF8.GetChars(myAddress)));
Debug.Print("Program Started");
}
void NordicDataReceived(byte[] data)
{
try
{
Mainboard.SetDebugLED(true);
Thread.Sleep(2000);
Mainboard.SetDebugLED(false);
////Panda sends a string like this: "Hello Spider |true" where true/false represents the state of the LED on the Panda
string result = new string(Encoding.UTF8.GetChars(data));
Debug.Print("<- " + result);
}
catch (Exception)
{
}
}
void ButtonButtonPressed(Button sender, Button.ButtonState state)
{
try
{
nordic.SendTo(Encoding.UTF8.GetBytes("HYDRA"), Encoding.UTF8.GetBytes("Hi Hydra!"));
}
catch (Exception)
{
}
}
}
and finally the Hydra Code:
public partial class Program
{
void ProgramStarted()
{
nordic.Configure(Encoding.UTF8.GetBytes("HYDRA"), 10);
nordic.DataReceived += new NRF24L01Plus.OnDataRecievedHandler(NordicDataReceived);
nordic.TransmitFailed += () =>
{
Mainboard.SetDebugLED(false);
Debug.Print("Send failed");
};
nordic.TransmitSuccess += () =>
{
Mainboard.SetDebugLED(true);
Debug.Print("Send ok");
Thread.Sleep(1000);
Mainboard.SetDebugLED(false);
};
nordic.Enable();
button.ButtonPressed += new GTM.GHIElectronics.Button.ButtonEventHandler(button_ButtonPressed);
int regValue = nordic.Api.Execute(Commands.R_REGISTER, Registers.RF_SETUP, new byte[1])[1];
regValue |= 1 << Bits.RF_DR_LOW;
nordic.Api.Execute(Commands.W_REGISTER, Registers.RF_SETUP, new[] { (byte)regValue });
// example of reading your own address
var myAddress = nordic.Api.GetAddress(AddressSlot.Zero, 5);
Debug.Print("I am " + new string(Encoding.UTF8.GetChars(myAddress)));
Debug.Print("Program Started");
}
void button_ButtonPressed(GTM.GHIElectronics.Button sender, GTM.GHIElectronics.Button.ButtonState state)
{
try
{
nordic.SendTo(Encoding.UTF8.GetBytes("PANDA"), Encoding.UTF8.GetBytes("Hi PANDA!"));
}
catch (Exception)
{
}
}
void NordicDataReceived(byte[] data)
{
try
{
Mainboard.SetDebugLED(true);
Thread.Sleep(2000);
Mainboard.SetDebugLED(false);
string result = new string(Encoding.UTF8.GetChars(data));
Debug.Print("<- " + result);
}
catch (Exception)
{
}
}
}
when i press the button the hydra both Panda and spider receive the string…
and when i press the button on the spider the hydra receives the string…
Coollllll 
anything else to try please let me know… this is fun…
Jay…