I want to find...

Search

Shares

Table of Content

86HMI::Number

[Primitives widgets]

Object Functions

Number object. Used to display numbers.

number-1

Number Properties.

number-2

Identifier:

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

Content:

  • Value: Number value at default.
  • PrefixText: Prefix text in front of the number.
  • SuffixText: Suffix text after the number.

Geometry:

  • X: Object X coordinate.
  • Y: Object Y coordinate.
  • Width: Object width. It cannot be adjusted by default.
  • Height: Object height. It cannot be adjusted by default.

Options:

  • 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.
  • TextAlign: Text alignment can be left, right, and center.
  • 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.
  • Order: Object order. It can adjust the object order by up/down, which can be viewed on the Object List.

API Functions

setNumberValue()

Description

Set Number Value.

Syntax

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

Parameters

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

Return

None.

Example

#include "myhmi.h"

void setup() {
  Hmi.begin();
  // put your setup code here, to run once:
  Hmi.setNumberValue(p1num1, 100);
}

void loop() {
  // ...
}

getNumberValue()

Description

Get Number Value.

Syntax

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

Parameters

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

Return

Number Value.

Example

#include "myhmi.h"

void setup() {
  Serial.begin(115200);
  while (!Serial);
  
  Hmi.begin();
  // put your setup code here, to run once:
  Serial.print("Number value: ");
  Serial.println(Hmi.getNumberValue(p1num1));
}

void loop() {
  // ...
}

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

Leave a Comment

Scroll to Top