基于stm32f4的4脚oled显示6参数代码,自己做的,下载就可以用。
制作出来的实物图如下:
单片机源程序如下:
- #include "sys.h"
- #include "picture.h"
- #include "usmart.h"
- int main(void)
- {
- u16 a=0;
- uart_init(115200);
- delay_init(168);
- LED_Init();
- KEY_Init();
- I2C_Configuration();
- OLED_Init();
- usmart_dev.init(84);
- while(1)
- {
- a=0;
- OLED_ShowString(0,0,"P1:",12);
- OLED_ShowNum(20,0,a,4,12);
- a++;
- OLED_ShowString(70,0,"P2:",12);
- OLED_ShowNum(90,0,a,4,12);
- a++;
- OLED_ShowString(0,20,"P3:",12);
- OLED_ShowNum(20,20,a,4,12);
- a++;
- OLED_ShowString(70,20,"P4:",12);
- OLED_ShowNum(90,20,a,4,12);
- a++;
- OLED_ShowString(0,35,"P5:",12);
- OLED_ShowNum(20,35,a,4,12);
- a++;
- OLED_ShowString(70,35,"P6:",12);
- OLED_ShowNum(90,35,a,4,12);
- delay_ms(3000);
- OLED_Clear();
- }
- }
复制代码
所有资料51hei提供下载:
STM32F407 OLED_IIC.7z
(352.8 KB, 下载次数: 145)
|