【2024 DigiKey 创意大赛】二月柳絮大作战项目-04驱动ESP32-S3-LCD-Ev-Board液晶屏
本帖最后由 Maker_kun 于 2024-10-30 22:26 编辑<p>需要安装lvgl、ESP32_Display_Panel,具体可参考:</p>
<p><a href="https://bbs.eeworld.com.cn/thread-1293808-1-1.html">【2024 DigiKey 创意大赛】二月柳絮大作战项目-02获取ESP32-S3-LCD-Ev-Board触摸参数 - DigiKey得捷技术专区 - 电子工程世界-论坛 (eeworld.com.cn)</a></p>
<p>打开案例库出现错误:</p>
<p> </p>
<p>根据提示需要打开官方教程:</p>
<p> </p>
<p>打开官方案例库可以发现相应指导说明:</p>
<p> </p>
<p>如何使用:</p>
<p> </p>
<p>选择配置开发板:</p>
<p> </p>
<p> </p>
<p> </p>
<p>根据开发板类型选择和驱动参数:</p>
<p> </p>
<p>提示需要安装LVGL版本不超过8.3.9</p>
<p> </p>
<p>需要手动配置相关库文件:</p>
<p> </p>
<p> </p>
<p>配置完成即可打开案例库进行编程:</p>
<p> </p>
<p> </p>
<p>添加代码:</p>
<p> </p>
<p>代码如下:</p>
<pre>
<code> lv_obj_t* chart;
chart = lv_chart_create(lv_scr_act()); // 创建Chart对象
lv_obj_set_size(chart, 300, 300);// 设置大小
lv_obj_center(chart);//居中显示
lv_chart_set_type(chart, LV_CHART_TYPE_LINE); /*Show lines and points too*/
/*Add two data series*/
lv_chart_series_t* ser1 = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y); // 创建第1条chart series,设置红色
lv_chart_series_t* ser2 = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_GREEN), LV_CHART_AXIS_SECONDARY_Y); // 创建第1条chart series,设置绿色
/*Set the next points on 'ser1'*/
lv_chart_set_next_value(chart, ser1, 10);
lv_chart_set_next_value(chart, ser1, 10);
lv_chart_set_next_value(chart, ser1, 10);
lv_chart_set_next_value(chart, ser1, 10);
lv_chart_set_next_value(chart, ser1, 10);
lv_chart_set_next_value(chart, ser1, 10);
lv_chart_set_next_value(chart, ser1, 10);
lv_chart_set_next_value(chart, ser1, 30);
lv_chart_set_next_value(chart, ser1, 70);
lv_chart_set_next_value(chart, ser1, 90);
/*Directly set points on 'ser2'*/
ser2->y_points = 90;
ser2->y_points = 70;
ser2->y_points = 65;
ser2->y_points = 65;
ser2->y_points = 65;
ser2->y_points = 65;
ser2->y_points = 65;
ser2->y_points = 65;
ser2->y_points = 65;
ser2->y_points = 65;
lv_chart_set_axis_tick(chart, LV_CHART_AXIS_PRIMARY_Y, 5, 2,3 ,2, true, 40); // y轴tick显示,显示3个刻度值
lv_chart_refresh(chart); /*Required after direct set*/</code></pre>
<p> </p>
<p>项目文件:</p>
<p> </p>
<p>仿真界面:</p>
<p> </p>
<p>实物照片:</p>
<p> </p>
<p> </p>
<p>项目代码:</p>
<div></div>
<p> </p>
页:
[1]