Ai-M61-32S i2c点亮oled详细教程及踩坑记录
https://bbs.ai-thinker.com/forum.php?mod=viewthread&tid=43817
代码复制的这里,移植中景园代码部分失败。
完整工程已上传,大佬看看
现在都问题,字符串 不能正常显示
- uint8_t x = 1;
- uint8_t y = 1;
- unsigned char str[] = "hello";
- uint8_t size = 16;
- OLED_ShowString(x, y, str, size);
复制代码- //开启OLED显示
- void OLED_Display_On(void)
- {
- unsigned char data = 0x8D; // 要写入的数据
- oled_write(OLED_DATA, &data, 1);
- data =0X14; // 要写入的数据
- oled_write(OLED_CMD, &data, 1);
- data = 0XAF; // 要写入的数据
- oled_write(OLED_CMD, &data, 1);
- }
- //关闭OLED显示
- void OLED_Display_Off(void)
- {
- unsigned char data = 0x8D; // 要写入的数据
- oled_write(OLED_DATA, &data, 1);
- data =0X10; // 要写入的数据
- oled_write(OLED_CMD, &data, 1);
- data = 0XAE; // 要写入的数据
- oled_write(OLED_CMD, &data, 1);
- }
- //清行
- void OLED_Clearrow(uint8_t i)
- {
- unsigned char data = 0x8D; // 要写入的数据
- uint8_t n;
- data =0xb0+i; // 要写入的数据
- oled_write(OLED_CMD, &data, 1);
- data =0x00; // 要写入的数据
- oled_write(OLED_CMD, &data, 1);
- data =0x10; // 要写入的数据
- oled_write(OLED_CMD, &data, 1);
- for(n=0;n<128;n++)
- data =0; // 要写入的数据
- oled_write(OLED_DATA, &data, 1);
- }
复制代码
ceshi.zip
(8.17 KB, 下载次数: 1)
|