TimerONE and NRF24L01p.h doesnt work

Hi all,

I am a newbie for programming.

My program have a TimerONE and NRF24L01p.h library. This library is ok. There is no problem but IF i will use RF, my program cant go loop and cant complete setup section… And totaly FAILS…

But i need both on my program. Because i measure testing time for my products and logging.

Otherwise ; i dont setup my RF, TimerONE starting to work. Or i dont setup TimerONE, RF starting work.

What can i do ?

Thank you for responses.

These are sample codes.

// Setup section start
Timer1.initialize(1000); // 1 mikro saniye hassasiyet
Timer1.attachInterrupt(callback); // callback() çıkışı al

Serial.begin(19200); // Open serial port with 9600bps
RF.channel(90);
RF.RXaddress(“Hasbi”);
RF.init();
// Setup section end

// Startup configration
#include <SPI.h>
#include <nRF24L01p.h>
nRF24L01p RF(7,8);
#include “TimerOne.h”

What RF24 library are you using? I don't recognize "nrf24L01p.h

Why do you need to use the Timer library?

This Simple nRF24L01+ Tutorial may help.

Also, please always post a complete program. And please post your code between [code] [/code] tags so your code looks like thisand is easy to copy to a text editor.

...R

Robin2:
What RF24 library are you using? I don’t recognize "nrf24L01p.h

Why do you need to use the Timer library?

This Simple nRF24L01+ Tutorial may help.

Also, please always post a complete program. And please post your code between tags so

your code looks like this

and is easy to copy to a text editor.

…R

Thanks for response…

My codes here ; cant enter loop and arduino nano fail…

#include <SPI.h> // SPI kütüphanesi
#include <nRF24L01p.h>  // RF kütüphanesi
nRF24L01p alici(7,8);  // RF tanımlama
#include "TimerOne.h"  // TimerOne kütüphanesi

uint16_t microseconds = 0, milliseconds = 0, test = 1;
uint8_t seconds = 0, minutes = 0, hours = 0;

String ekran = "";

void callback()
{
 if(test == 1){
   milliseconds += 1;
   if (milliseconds == 1000)
   {
     milliseconds = 0;
     seconds++;
   }
   if (seconds == 60)
   {
     seconds = 0;
     minutes++;
   }
   if (minutes == 60)
   {
     minutes = 0;
     hours++;
   }
 }
}

void reset()
{
  microseconds = 0, milliseconds = 0;
  seconds = 0, minutes = 0, hours = 0;
  
}

void setup()
{
  delay(250);
  Timer1.initialize(1000);         // 1 mikro saniye hassasiyet
  Timer1.attachInterrupt(callback);  // callback() çıkışı al
  delay(250);
  Serial.begin(19200);  // Open serial port with 9600bps
  Serial.println("00:00:000");
  delay(250);
  alici.channel(90);
  alici.RXaddress("Hasbi");
  alici.init();
}
  
void loop()
{
  // Gelmiş verileri resetle başlangıç
  char char_readed = 0; 
  alinan="";
  Serial.println(alinan);
  // Gelmiş verileri resetle bitiş
  
  // Gelen verileri derleme başlangıç (RS232 ve RF sinyalleri)
  char_readed = Serial.read();  // Read serial port character
  if(alici.available()>0){
    alici.read();
    alici.rxPL(alinan);
    Serial.println(alinan);
    if(alinan!=""){
      // Boş gelmediği sürece devam edecek
    }
  }

Fixed ! Thank you.

I have forget to add codes below;

SPI.begin();
SPI.setBitOrder(MSBFIRST);

Don't forget it yours :slight_smile:

SPI clock = 4 MHz, bit order = MSBFIRST, and SPI Mode 0 are the defaults, you don't need to set them after SPI.begin().