-1

I have an ATtiny85 microcontroller wireless transmitter to an Arduino Nano receiver using the wireless module NRF24L01.

These are the sketches and wiring for both and the result is nothing in the serial monitor of the receiver (Nano board).

I'm using the Arduino Uno as an ISP programmer to upload the sketch to the ATtiny85 MCU.

I have updated the code and now the Nano (receiver) keeps disconnecting and connecting again and again... with the message "failed to connect!" in the serial monitor and there is no output for the sizeof(text).

Code:

Receiver Nano:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(9,10); 

const byte address[6] = "00001"; 

void setup() {
  radio.begin();
  radio.openReadingPipe(0, address);  
  radio.startListening();
  Serial.begin(9600);
  Serial.println("Started!");
}

void loop() {

  if (radio.available()) {
    char text[32] = "";
    radio.read(&text, sizeof(text));
    Serial.println(sizeof(text));
    Serial.println(text);
  } else {
    Serial.println("Failed To Connect!!");
  }
}

ATtiny85 transmitter code:

//Include Libraries
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

//create an RF24 object
RF24 radio(3, 4);  // CE, CSN

//address through which two modules communicate.
const byte address[6] = "00001";

void setup() {
  radio.begin();
  
  //set the address
  radio.openWritingPipe(address);
  
  // Set module as transmitter
  radio.stopListening();
}

void loop() {
  // Send message to receiver
  const char text[] = "Hello World";
  radio.write(&text, sizeof(text));
  
  delay(1000);
}

Wiring:

**Attiny85 ====>> nrf24l01**

D3/PB3   =====> CE

D4/PB4   =====> CNS

D2/PB2   =====> SCK

D1/PB1   =====> MOSI

D0/PB0   =====> MISO

VCC      =====> 3V BATTERY 

GND      =====> 3V BATTERY GND



**Arduino nano ===> nrf24l01** 

D9      =====>   CE

D10     =====>   CNS

D11     =====>   MOSI

D12     =====>   MISO

D13     =====>   SCK

VCC     =====>   3V3

GND     =====>   GND
4
  • 1
    do basic debugging ... serial.print a message, like "start", inside setup() ... does it show on serial monitor?
    – jsotola
    Mar 31 at 22:37
  • 1
    in loop() print the value of sizeof(text)
    – jsotola
    Mar 31 at 22:39
  • 1
    connecting again with the message (faild to connect!) in the serial monitor ... your post says that nothing is printed in the serial monitor
    – jsotola
    Mar 31 at 23:49
  • 1
    this site is not a forum ... please do not add info in comments
    – jsotola
    Mar 31 at 23:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.