最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

What is proper code for NRf24lo1 data transmission between arduino and raspberry pi 4 - Stack Overflow

programmeradmin1浏览0评论

I have been trying to sent a hi message from my arduino uno to my raspberry pi4 .NO matter what i do there will be some kind of error i will face each time , i tried different coding approaches .In some code the hi message will be sent but it wont be received by the raspberry pi. Please provide the resources or then code .

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

RF24 radio(7, 8);

const byte rxAddr[6] = "00001";

void setup()
{
  Serial.begin(9600);
  radio.begin();
  if(!radio.begin()){
    Serial.println("hardware error");
    
  }
  radio.setRetries(15, 15);
  radio.setChannel(10);
  radio.openWritingPipe(rxAddr);
  radio.stopListening();
}

void loop()
{
  const char text[] = "Hello World";
  bool x =radio.write(&text, sizeof(text));
  if(x){
    Serial.println("yes");
  }
  else{
    Serial.println("no");
  }

  delay(1000);
  Serial.println("Sent."); // TO check whether the data is sent.

}

this is my transmitter code and the output it is showing is hardware problem

发布评论

评论列表(0)

  1. 暂无评论