Description
I need to draw dynamic square waveform using LVGL chart
What MCU/Processor/Board and compiler are you using?
Beagle Bone Black
What LVGL version are you using?
8.3
What do you want to achieve?
Square waveform using LVGL chart, something like this,
What have you tried so far?
I used LVGL chart for drawing square waveform, but i am missing something, i am only getting triangular wave not square wave. Need help on this please.
Code to reproduce
void Chart::drawchart(void)
{
chart = lv_chart_create(lv_scr_act());
lv_obj_set_size(chart, 200, 150);
lv_obj_align(chart, LV_ALIGN_CENTER, 0, -10);
lv_chart_set_type(chart, LV_CHART_TYPE_LINE);
lv_chart_set_axis_tick(chart, LV_CHART_AXIS_PRIMARY_Y, 10, 5, 6, 5, true, 40);
lv_chart_set_axis_tick(chart, LV_CHART_AXIS_PRIMARY_X, 10, 5, 10, 1, true, 30);
lv_obj_refresh_ext_draw_size(chart);
cursor = lv_chart_add_cursor(chart, lv_palette_main(LV_PALETTE_BLUE), LV_DIR_LEFT | LV_DIR_BOTTOM);
ser = lv_chart_add_series(chart, lv_palette_main(LV_PALETTE_RED), LV_CHART_AXIS_PRIMARY_Y);
lv_chart_set_next_value(chart, ser, 0);
lv_chart_set_next_value(chart, ser, 80);
lv_chart_set_next_value(chart, ser, 0);
lv_chart_set_next_value(chart, ser, 80);
lv_chart_set_next_value(chart, ser, 0);
lv_chart_set_next_value(chart, ser, 80);
lv_chart_set_next_value(chart, ser, 0);
lv_chart_set_next_value(chart, ser, 80);
lv_chart_set_next_value(chart, ser, 0);
lv_chart_set_next_value(chart, ser, 80);
lv_chart_set_zoom_x(chart, 500);
}