標(biāo)題: 大四軸+遙控STM32源碼 LittleBirdRemoteV1.0 [打印本頁(yè)]

作者: tanyize    時(shí)間: 2019-2-16 22:35
標(biāo)題: 大四軸+遙控STM32源碼 LittleBirdRemoteV1.0
自己制作的大四軸,程序分享出來(lái)

單片機(jī)源程序如下:
  1. #include "global.h"


  2. u16 TimeCount=0;

  3. int main(void)
  4. {
  5.         delay_init();
  6.         NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); //設(shè)置NVIC中斷分組2:2位搶占優(yōu)先級(jí),2位響應(yīng)優(yōu)先級(jí)
  7.         uart_init(115200);
  8.         OLED_Init();                                        //=====OLED初始化
  9.         LED_Beep_Init();                                                //LED和蜂鳴器初始化
  10.         AdcInit();                                                                  //ADC初始化  
  11.         MYDMA_Config();                                                        //DMA配置,之后ADC一直在采集,并將結(jié)果放在AD_Value[]數(shù)組中,用的時(shí)候直接讀取即可
  12.         NRF24L01_Init();                                    //初始化NRF24L01
  13.         while(NRF24L01_Check())        //檢查NRF24L01是否在位.       
  14.         {
  15.                 printf("NRF24L01 error\r\n");
  16.         }
  17.         printf("NRF24L01 OK\r\n");
  18.         EXTIX_Init();                                                                //按鍵中斷初始化
  19.         TIM4_Int_Init(999,7199);                //100ms定時(shí)中斷,定時(shí)發(fā)送數(shù)據(jù)
  20.         EXTI_PB1_Init();
  21.         oled_show();
  22.        
  23.         while(1)
  24.         {
  25. //                printf("%d   ",AD_Value[0]);
  26. //                printf("%d   ",AD_Value[1]);
  27. //                printf("%d   ",AD_Value[2]);
  28. //                printf("%d\r\n",AD_Value[3]);
  29. //                printf("%d   ",packetData[4]);
  30. //                printf("%d   ",packetData[5]);
  31. //                printf("%d   ",packetData[6]);
  32. //                printf("%d   ",packetData[7]);
  33. //                printf("%d   ",packetData[8]);
  34. //                printf("%d   ",packetData[9]);
  35. //                printf("%d   ",packetData[10]);
  36. //                printf("%x   ",packetData[11]);
  37. //                led1_on;
  38. //                led2_on;
  39. //                led3_on;
  40. //                BEEP=0;
  41.                 delay_ms(200);
  42.                 oled_show();
  43. //                BEEP=1;
  44. //                led1_off;
  45. //                led2_off;
  46. //                led3_off;
  47. //                delay_ms(1000);
  48.         }
  49. }
復(fù)制代碼

所有資料51hei提供下載:
LittleBirdRemoteV1.0.7z (208.5 KB, 下載次數(shù): 32)







歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1