I want to find...

Search

Shares

Table of Content

86HMI::Bar

[Visualization widgets]

Object Functions

Bar object.

Bar-1

Bar Properties.

Bar-2

Identifier:

  • ID: Unique number that identifies the object.
  • Name: User-definable name for the object. It can be used with 86HMI API.

Content:

ShowValue: Displayed value position, with options as Disable, Top, Bottom, Left, Right, and Following.
Value: Initial value of the object.
MaxValue: Maximum value can be positive or negative but must not be less than the minimum value.
MinValue: Minimum value can be positive or negative but must not be bigger than the maximum value.
PrefixText: Prefix text in front of the value.
SuffixText: Suffix text after the value.

Geometry:

  • X: Object X coordinate.
  • Y: Object Y coordinate.
  • Width: Object width.
  • Height: Object height.

Options:

  • Type: Bar type, Horizontal or Vertical.
  • DecimalPoint: Set the number of decimal points for the value. For example, if DecimalPoint is 3, the value will be displayed to the 3rd decimal place.
  • TextColor: Text color can be chosen through the color palette or by directly inputting the color code.
  • TextFont: Choose from 6 default font styles. For font configuration instructions, please refer to Theme Management.
  • ObjColor: Choose from 4 themed colors. For font configuration instructions, please refer to Theme Management.
  • Order: Object order. It can adjust the object order by up/down, which can be viewed on the Object List.

API Functions

setBarValue()

Description

Set Bar value.

Syntax

void setBarValue(lv_obj_t* id, double value);
void setBarValue(char* name, double value);

Parameters

  • [in] id
    Object ID.
  • [in] name
    Object Name.
  • [in] value
    Set Bar value.

Return

None.

Example

#include "myhmi.h"

void setup() {
  Hmi.begin();
  // ...
  Hmi.setBarValue(p1bar1, 100);
}

void loop() {
  // ...
}

getBarValue()

Description

Get Bar value.

Syntax

double getBarValue(lv_obj_t* id);
double getBarValue(char* name);

Parameters

  • [in] id
    Object ID.
  • [in] name
    Object Name.

Return

Bar value.

Example

#include "myhmi.h"

void setup() {
  Serial.begin(115200);
  while (!Serial);
  Hmi.begin();
  // ...
  Hmi.setBarValue(p1bar1, 100);
  Serial.print("p1bar1 value: ");
  Serial.println(Hmi.getBarValue(p1bar1));
}

void loop() {
  // ...
}

Please see the 86HMI Editor User Manual for more instructions on 86HMI widgets and API usage.

Scroll to Top