这个主程序是将要发送的数据直接写进程序中,然后通过nRF24L01进行无线传输,现在需要改成通过串口输入一个数据之后在进行无线传输,该怎么改?求教各位大神!我是新手~~
#include "stm32f4xx.h"
#include "usart.h"
#include "NRF24L01/NRF24L01.h"
#include "stm32f4xx_usart.h"
#define Open_TX 1 //发送
//#define Open_RX 0 //接收
extern unsigned char RX_BUF[];
extern unsigned char TX_BUF[];
void Delay (uint32_t nCount)
{
for(; nCount != 0; nCount--);
}
int main(void)
{
USART_Configuration();
nRF24L01_Initial();
printf("
USART1测试成功!NRF2401初始化成功!
");
while(1)
{
#ifdef Open_TX
TX_BUF[0]= oxaa;
NRF24L01_Send();
printf("
Send data:0x%x
",TX_BUF[0]);
Delay(0xffffff);
#else
NRF24L01_Receive();
#endif
}
}
此帖出自
小平头技术问答
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
#include "stm32f4xx.h"
#include "usart.h"
#include "NRF24L01/NRF24L01.h"
#include "stm32f4xx_usart.h"
#define Open_TX 1 //发送
//#define Open_RX 0 //接收
extern unsigned char RX_BUF[];
extern unsigned char TX_BUF[];
extern unsigned char X1_BUF[];
void Delay (uint32_t nCount)
{
for(; nCount != 0; nCount--);
}
int i=0;
void USART1_RX(void)
{
for(i=0;i<8;i++)
{
X1_BUF = USART_ReceiveData(USART1);
}
}
int main(void)
{
USART_Configuration();
USART1_RX();
nRF24L01_Initial();
printf(" USART1测试成功!NRF2401初始化成功! ");
while(1)
{
#ifdef Open_TX
TX_BUF[0]=X1_BUF;
NRF24L01_Send();
printf(" Send data:0x%x ",TX_BUF[0]);
Delay(0xffffff);
#else
NRF24L01_Receive();
#endif
}
}
错误是.OutputProject.axf: Error: L6218E: Undefined symbol X1_BUF (referred from main.o).
一周热门 更多>