|
这个库是自己结合了过多库函数而来
#include "delay.h"
#include "sys.h"
#include "oled.h"
#include "adc.h"
#include <math.h>
#include "stm32f10x.h"
#include "FSR.h"
#include "usart.h"
#include "stm32f10x_adc.h"
int main(void)
{
u16 AD0;
u16 AD1;
u16 AD2;
u16 AD3;
delay_init(); //延时函数初始化
NVIC_Configuration(); //设置NVIC中断分组2:2位抢占优先级,2位响应优先级 LED_Init(); //LED端口初始化
// delay_ms(8000);
OLED_Init(); //初始化OLED
OLED_Clear();
uart_init(9600); //串口初始化为9600
adc_config();
adc_start();
while (1)
{
AD0=get_ChannelVale(ADC_Channel_0); //pa0
AD1=get_ChannelVale(ADC_Channel_1); //PA1
AD2=get_ChannelVale(ADC_Channel_2); //pa2
// AD3=get_ChannelVale(ADC_Channel_3); //pa3
OLED_ShowString(5,0,"Pressure:",16);
OLED_ShowNum(75,0,AD0,4,16);
OLED_ShowNum(75,2,AD1,4,16);
OLED_ShowNum(75,4,AD2,4,16);
// OLED_ShowNum(75,6,AD3,4,16);
printf("AD1 = %d\r\n",AD1);
delay_ms(50) ;
}
}
|
-
-
OLED.7z
193.51 KB, 下载次数: 53, 下载积分: 黑币 -5
评分
-
查看全部评分
|