Pages: [1]   Go Down
Author Topic: Arduino nano with nRF24L0... Can anyone hepls?  (Read 720 times)
0 Members and 1 Guest are viewing this topic.
Finland
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Let us duino
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey,

I have two arduiono nano boards and two nRF24L0 RF-links. I have tried many cases but I haven't got it works... Does anyone gives me SIMPLE code how to send STRING over RF...?? Thank you for your help.
Logged

Mika

0
Offline Offline
Shannon Member
****
Karma: 215
Posts: 12455
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How have you wired them up?  What code are you using now?
Logged

[ I won't respond to messages, use the forum please ]

Finland
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Let us duino
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hei

This is Nrf24 examle and this is working... but now I want to send string...
Code:
#include <SPI.h>
#include <Mirf.h>
#include <nRF24L01.h>
#include <MirfHardwareSpiDriver.h>

void setup(){
  Serial.begin(9600);
  /*
   * Setup pins / SPI.
   */
   
  /* To change CE / CSN Pins:
   *
   * Mirf.csnPin = 9;
   * Mirf.cePin = 7;
   */
  /*
  Mirf.cePin = 7;
  Mirf.csnPin = 8;
  */
  Mirf.spi = &MirfHardwareSpi;
  Mirf.init();
 
  /*
   * Configure reciving address.
   */
   
  Mirf.setRADDR((byte *)"clie1");
 
  /*
   * Set the payload length to sizeof(unsigned long) the
   * return type of millis().
   *
   * NB: payload on client and server must be the same.
   */
   
  Mirf.payload = sizeof(unsigned long);
 
  /*
   * Write channel and payload config then power up reciver.
   */
   
  /*
   * To change channel:
   *
   * Mirf.channel = 10;
   *
   * NB: Make sure channel is legal in your area.
   */
   
  Mirf.config();
 
  Serial.println("Beginning ... ");
}

void loop(){
  unsigned long time = millis();
 
  Mirf.setTADDR((byte *)"serv1");
 
  Mirf.send((byte *)&time);
 
  while(Mirf.isSending()){
  }
  Serial.println("Finished sending");
  delay(10);
  while(!Mirf.dataReady()){
    //Serial.println("Waiting");
    if ( ( millis() - time ) > 1000 ) {
      Serial.println("Timeout on response from server!");
      return;
    }
  }

  Mirf.getData((byte *) &time);
 
  Serial.print("Ping: ");
  Serial.println((millis() - time));
 
  delay(1000);
}
 
Logged

Mika

Finland
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Let us duino
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I soved this question... =)
Logged

Mika

Pages: [1]   Go Up
Jump to: