Skip to content

611code/HAL_NRF24L01

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HAL_NRF24L01

引脚定义:

image-20250712143106333

使用教程

cubemx配置:

启动SPI,且要求速率<8M

image-20250712143034308

设置3个GPIO,一个输入,两个输出。并设置为这三个名字NRF_IRQ、NRF_CE、NRF_CS。不设置的话记得修改.h文件宏定义。

image-20250712143159614

main.c 内容如下:

发送端

while(NRF24L01_Check())
{
    printf("Wait lianjie");
}

NRF24L01_TX_Mode();
uint8_t Send_Out[33]="send NRF24L01";

while (1)
{
    if(NRF24L01_TxPacket(Send_Out)==TX_OK)
    {
      printf("NRF24L01send ok :%s\r\n",Send_Out);
    }
    else
    {
      printf("NRF24L01send error\r\n");
    }
    HAL_Delay(1000);
 }

接收端

while(NRF24L01_Check())
{
    printf("Wait lianjie");
}

NRF24L01_RX_Mode();
uint8_t Receive[33];

while (1)
{
if(NRF24L01_RxPacket(Receive)==0)
{
  Receive[32]=0;  
  printf("NRF24L01receive ok:%s\r\n",Receive);
}
HAL_Delay(500);

现象

image-20250712143837580

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages