《NRF24l01一对多修改频道的方法.docx》由会员分享,可在线阅读,更多相关《NRF24l01一对多修改频道的方法.docx(2页珍藏版)》请在三一办公上搜索。
1、NRF24l01一对多修改频道的方法if(KEY=0)/按下KEY1NRF_CE=0;/拉低CE引脚NRF24L01_Write_Reg(WRITE_REG+RF_CH,10);/修改为从机1的频道NRF_CE=1;/拉高CE引脚NRF24L01_TxPacket(rece_buf);/发送数据else if(KEY2=0)/按下KEY2NRF_CE=0;/拉低CE引脚NRF24L01_Write_Reg(WRITE_REG+RF_CH,30);/修改为从机2的频道NRF_CE=1;/拉高CE引脚NRF24L01_TxPacket(rece_buf);/发送数据else if(KEY2=0)/
2、按下KEY3NRF_CE=0;/拉低CE引脚NRF24L01_Write_Reg(WRITE_REG+RF_CH,50);/修改为从机3的频道NRF_CE=1;/拉高CE引脚NRF24L01_TxPacket(rece_buf);/发送数据else if(KEY2=0)/按下KEY4NRF_CE=0;/拉低CE引脚NRF24L01_Write_Reg(WRITE_REG+RF_CH,70);/修改为从机4的频道NRF_CE=1;/拉高CE引脚NRF24L01_TxPacket(rece_buf);/发送数据else if(KEY2=0)/按下KEY5NRF_CE=0;/拉低CE引脚NRF24L01_Write_Reg(WRITE_REG+RF_CH,90);/修改为从机5的频道NRF_CE=1;/拉高CE引脚NRF24L01_TxPacket(rece_buf);/发送数据