欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

 找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 1617|回復(fù): 0
收起左側(cè)

臺(tái)產(chǎn)24L01+無線模塊資料與單片機(jī)源程序

[復(fù)制鏈接]
ID:387228 發(fā)表于 2018-8-17 13:06 | 顯示全部樓層 |閱讀模式
24L01無線模塊,要的可下
0.png
0.png
0.jpg

單片機(jī)源程序如下:
  1. /******************************************************************************/
  2. /*
  3. //  文件名:main.c                                                              
  4. //  說明:供客戶測(cè)試模塊通信使用程序                                                                  
  5. //  編寫人員:                                                                  
  6. //  編寫日期:                                                              
  7. //  程序維護(hù):
  8. //  維護(hù)記錄:
  9. //
  10. //                                                         
  11. */
  12. // 免責(zé)聲明:該程序僅用于學(xué)習(xí)與交流
  13. // (c) Anxinke Corporation. All rights reserved.                                                               
  14. /******************************************************************************/
  15. #include "typedef.h"
  16. #include "gpio.h"
  17. #include "uart.h"
  18. #include "nrf24l01p.h"
  19. #include "delay.h"

  20. uchar txData[32] = {0x00};
  21. uchar rxData[32] = {0x00};

  22. /******************************************************************************/
  23. // 函數(shù)名稱:main
  24. // 輸入?yún)?shù):
  25. // 輸出參數(shù):
  26. // 函數(shù)功能:
  27. /******************************************************************************/
  28. void main(void)
  29. {
  30.     unsigned char i=0;
  31.     uartInit();   
  32.     Delay100ms();
  33.     init_nrf24l01_io();
  34.     led1ON();
  35.     Delay100ms();
  36.     led1OFF();
  37.     Delay100ms();
  38.     led1ON();
  39.     Delay100ms();
  40.     led1OFF();
  41.    
  42.     Delay100ms();
  43.     uartSendString("System initialization is complete!\r\n");
  44.     receive_mode_init();
  45.    
  46.     while(1)
  47.     {
  48.         KEY1 = 1;
  49.         KEY2 = 1;
  50.         /*
  51.          * 判斷是否按下KEY
  52.         */
  53.         if (key1ON() || key2ON()) {
  54.             _delay_us(500);
  55.             txData[0] = 0;
  56.             if (key1ON()) {
  57.                 txData[0] = 0xAA; // 如果按下K1  則將數(shù)據(jù)置為0xAA  
  58.                 uartSendString("You press the left button\r\n");
  59.             } else if (key2ON()){
  60.                 txData[0] = 0x55; // 如果按下K2  則將數(shù)據(jù)置為0x55
  61.                 uartSendString("You press the Right button\r\n");
  62.             }
  63.             /*
  64.              * 根據(jù)不同的數(shù)據(jù)LED提示
  65.             */
  66.             if (send_data(txData) == 1) {
  67.                 uartSendString("Success of sending data\r\n");
  68.                 if (txData[0] == 0xAA) {
  69.                     led1ON();   
  70.                 } else if (txData[0] == 0x55) {
  71.                     led2ON();
  72.                 }
  73.                 Delay100ms();   
  74.                 led1OFF();
  75.                 led2OFF();
  76.             } else {
  77.                 uartSendString("Failed to send data\r\n");
  78.             }      
  79.             receive_mode_init();
  80.         }
  81.         rxData[0] = 0;
  82.         led1OFF();
  83.         led2OFF();
  84.         if (receive_data(rxData)) {
  85.             if (rxData[0] == 0xAA) {
  86.                 led1ON();
  87.                 uartSendString("Receiving the data, from the Left\r\n");
  88.             } else if (rxData[0] == 0x55) {
  89.                 led2ON();
  90.                 uartSendString("Receiving the data, from the Right\r\n");
  91.             }
  92.             Delay100ms();
  93.         }
  94.    
  95.     }
  96. }
復(fù)制代碼

所有資料51hei提供下載:
臺(tái)產(chǎn)24L01 資料.rar (2.98 MB, 下載次數(shù): 10)


回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表