找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 2172|回复: 1
收起左侧

stm32模拟IIC 驱动OLED12864

[复制链接]
ID:357697 发表于 2021-4-14 16:18 | 显示全部楼层 |阅读模式
单片机源程序如下:
  1. #include "stm32f10x.h"
  2. #include "LED.h"
  3. #include "systick.h"
  4. #include "iic_gpio.h"
  5. #include "iic_oled.h"
  6. #include <string.h>
  7. #include <stdio.h>
  8. extern const unsigned char BMP1[];
  9. unsigned  char cStr [10]; //ds18b20
  10. float num;
  11. int main(void)
  12. {
  13.         //unsigned char i;
  14.    num=15.28;
  15.         OLED_Init();
  16.         LED_GPIO_Config();
  17.         LED1(0);
  18.         OLED_Fill(0x00);//全屏灭
  19.    while(1)
  20.          {
  21. //         OLED_Fill(0xFF);//全屏点亮
  22. //        Delay_ms(1000);                // 2s
  23. //        
  24.         //OLED_Fill(0x00);//全屏灭
  25. //        Delay_ms(1000);                // 2s
  26.                   sprintf ( (char*)cStr, "%0.3f",num);
  27. //                for(i=0;i<4;i++)
  28. //                {
  29. //                        OLED_ShowCN(22+i*16,0,i);                                                                        //测试显示中文
  30. //                }
  31. //                Delay_ms(1000);        // 2s
  32.                 OLED_ShowStr(0,3,cStr,1);                                //显示数字变量
  33. //                OLED_ShowStr(0,5,(unsigned char*)"Hello wildfire",2);                                //测试8*16字符
  34. //                Delay_ms(2000);                // 2*100=200s
  35. //                OLED_CLS();//清屏
  36. //                OLED_OFF();//测试OLED休眠
  37. //                Delay_ms(1000);                // 2s
  38. //                OLED_ON();//测试OLED休眠后唤醒
  39. //                OLED_DrawBMP(0,0,128,8,(unsigned char *)BMP1);//测试BMP位图显示
  40.                 Delay_ms(2000);                // 2s
  41.   }
  42. }
复制代码

模拟IIC OLED模板.7z (192.28 KB, 下载次数: 62)
回复

使用道具 举报

ID:882054 发表于 2023-9-16 21:51 | 显示全部楼层
程序有些小问题
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表