|
自己制作的大四軸,程序分享出來
單片機(jī)源程序如下:
- #include "global.h"
- u16 TimeCount=0;
- int main(void)
- {
- delay_init();
- NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); //設(shè)置NVIC中斷分組2:2位搶占優(yōu)先級(jí),2位響應(yīng)優(yōu)先級(jí)
- uart_init(115200);
- OLED_Init(); //=====OLED初始化
- LED_Beep_Init(); //LED和蜂鳴器初始化
- AdcInit(); //ADC初始化
- MYDMA_Config(); //DMA配置,之后ADC一直在采集,并將結(jié)果放在AD_Value[]數(shù)組中,用的時(shí)候直接讀取即可
- NRF24L01_Init(); //初始化NRF24L01
- while(NRF24L01_Check()) //檢查NRF24L01是否在位.
- {
- printf("NRF24L01 error\r\n");
- }
- printf("NRF24L01 OK\r\n");
- EXTIX_Init(); //按鍵中斷初始化
- TIM4_Int_Init(999,7199); //100ms定時(shí)中斷,定時(shí)發(fā)送數(shù)據(jù)
- EXTI_PB1_Init();
- oled_show();
-
- while(1)
- {
- // printf("%d ",AD_Value[0]);
- // printf("%d ",AD_Value[1]);
- // printf("%d ",AD_Value[2]);
- // printf("%d\r\n",AD_Value[3]);
- // printf("%d ",packetData[4]);
- // printf("%d ",packetData[5]);
- // printf("%d ",packetData[6]);
- // printf("%d ",packetData[7]);
- // printf("%d ",packetData[8]);
- // printf("%d ",packetData[9]);
- // printf("%d ",packetData[10]);
- // printf("%x ",packetData[11]);
- // led1_on;
- // led2_on;
- // led3_on;
- // BEEP=0;
- delay_ms(200);
- oled_show();
- // BEEP=1;
- // led1_off;
- // led2_off;
- // led3_off;
- // delay_ms(1000);
- }
- }
復(fù)制代碼
所有資料51hei提供下載:
LittleBirdRemoteV1.0.7z
(208.5 KB, 下載次數(shù): 32)
2019-2-17 03:48 上傳
點(diǎn)擊文件名下載附件
|
評(píng)分
-
查看全部評(píng)分
|