Unfortunatly i'm back with some bad news :S
first of all, ill post my code on each side then the connections...
Arduino Side (tx)
/*
Copyright (C) 2011 James Coliz, Jr. <maniacbug@ymail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
version 2 as published by the Free Software Foundation.
*/
#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>
// nRF24L01(+) radio attached using Getting Started board
RF24 radio(49,53);
// Network uses that radio
RF24Network network(radio);
// Address of our node
const uint16_t this_node = 1;
// Address of the other node
const uint16_t other_node = 0;
// How often to send 'hello world to the other unit
const unsigned long interval = 2000; //ms
// When did we last send?
unsigned long last_sent;
// How many have we sent already
unsigned long packets_sent;
// Structure of our payload
struct payload_t
{
unsigned long ms;
unsigned long counter;
};
void setup(void)
{
Serial.begin(57600);
Serial.println("RF24Network/examples/helloworld_tx/");
SPI.begin();
radio.begin();
network.begin(/*channel*/ 90, /*node address*/ this_node);
}
void loop(void)
{
// Pump the network regularly
network.update();
// If it's time to send a message, send it!
unsigned long now = millis();
if ( now - last_sent >= interval )
{
last_sent = now;
Serial.print("Sending...");
payload_t payload = { millis(), packets_sent++ };
RF24NetworkHeader header(/*to node*/ other_node);
bool ok = network.write(header,&payload,sizeof(payload));
if (ok)
Serial.println("ok.");
else
Serial.println("failed.");
}
}
Connections:
nrf24l01+ Arduino Mega 2560
1-GND GND
2-VCC 5v
3-CE 53 or 49
4-CSN 49 or 53
5-SCK 52
6-MOSI 51
7-MISO 48
ATMega328p on breadboard (RX)
//RX
#include <RF24Network.h>
#include <RF24.h>
#include <SPI.h>
// nRF24L01(+) radio attached using Getting Started board
RF24 radio(49,53);
// Network uses that radio
RF24Network network(radio);
// Address of our node
const uint16_t this_node = 0;
// Address of the other node
const uint16_t other_node = 1;
// How often to send 'hello world to the other unit
const unsigned long interval = 2000; //ms
// When did we last send?
unsigned long last_sent;
// How many have we sent already
unsigned long packets_sent;
// Structure of our payload
struct payload_t
{
unsigned long ms;
unsigned long counter;
};
void setup(void)
{
Serial.begin(57600);
Serial.println("RF24Network/examples/helloworld_tx/");
SPI.begin();
radio.begin();
network.begin(/*channel*/ 90, /*node address*/ this_node);
}
void loop(void)
{
// Pump the network regularly
network.update();
// Is there anything ready for us?
while ( network.available() )
{
// If so, grab it and print it out
RF24NetworkHeader header;
payload_t payload;
network.read(header,&payload,sizeof(payload));
Serial.print("Received packet #");
Serial.print(payload.counter);
Serial.print(" at ");
Serial.println(payload.ms);
}
}
Connections:
nrf24l01+ ATMega328p
1-GND GND
2-VCC 5v
3-CE 14
4-CSN 15
5-SCK 19
6-MOSI 17
7-MISO 18
Results:
On Arduino (tx)
with CE on 53 and CSN on 49
RF24Network/examples/helloworld_tx/
Sending...failed.
Sending...failed.
Sending...failed.
only with CSN on 49
Sending...RF24Network/examples/helloworld_tx/
Sending...failed.
Sending...failed.
Sending...failed.
Without CE or CSN
RF24Network/examples/helloworld_tx/
Sending...ok.
Sending...ok.
Something must be wrong and im too blind/newb to see. Maybe the pins on ATMega328p (breadboard)? maybe arduino? maybe both?
I tried to be as explicit as possible and btw, the code was from RF24Network for Wireless Sensor Networking | maniacbug
Thanks in advance