1

Topic: Battery Voltage Level Indicator using multiple Linear Level Indicators

To show the battery voltage of your remote application might be one of the necessary things you like
to do with RemoteXY. You can use the level indicators to do this.

This tutorial shows you how to build a battery voltage level indicator with red, yellow and green areas for the
good, almost good and critical range of the battery voltage. To do this, we will use three Linear Level Indicators
put on top of each other. What does this mean?

If you right click one of the elements on your RemoteXY editor screen, you might have recognized the last
for items "....."

https://i.imgur.com/PuFNekr.png

Each element placed in the editor is put on its own "level". You may think about these levels like glass frames stacked on each other.
Viewing from top you can see all the elements, but you can also move the elements over each other, sometimes hiding one element
below the other. Here is one example: a text element placed on top of a panel element. The text background is switched off, so that
the text background becomes the panel color and shape ( using "lowered" option ).

https://i.imgur.com/Il77G5Q.png

Or you can place a button element below a LED element. Still the button function is available, even the
button is behind the LED. This way you can have a nice push-on/off button with indicator LED.

https://i.imgur.com/X2PhPZA.png

Coming back to the battery level indicator. We are using three Linear Level Indicators.
We change the size and the color as shown here.

https://i.imgur.com/YPE4u5G.png

We can add a panel element and move the for elements over each other. Please note the order. The panel is in the back. Use the
right-click-context menu and select "To back" if this is not the case. On top of the panel, the green Level Indicator will be placed.
The the context menu again to change the order. Once again, all elements are active, even you would move the Level Indicator
behind the panel, making it invisible.

https://i.imgur.com/LZmHdDA.png

This was the hardest part already. Add a slider element and a text element and your done with the screen setup.

https://i.imgur.com/IlT5xIU.png?1

This might look a little bit weird, but in the end it's perfect:

https://i.imgur.com/apS5ZhJ.jpg?2

The Arduino code is here:

void setup() 
{
  RemoteXY_Init (); 
  // TODO you setup code
  RemoteXY.level_grn = 0 ;
  RemoteXY.level_yel = 0 ;
  RemoteXY.level_red = 0 ;
  
}

#define LEVEL_YEL 20
#define LEVEL_GRN 68
void loop() 
{ 
int value ;
  RemoteXY_Handler ();

  value = RemoteXY.slider ;
  sprintf(RemoteXY.text, "%5d", value);
  if ( value < LEVEL_YEL ) {
      RemoteXY.level_red = map(value,0, LEVEL_YEL,0, 100) ;
      RemoteXY.level_yel = 0 ;
      RemoteXY.level_grn = 0 ;
  }
  if ((value >= LEVEL_YEL) && (value<LEVEL_GRN)) {
      RemoteXY.level_red = 100 ;
      RemoteXY.level_yel = map(value,0, LEVEL_GRN,0, 100) ;    
      RemoteXY.level_grn = 0 ;      
  }
  if ( value >= LEVEL_GRN ) {
      RemoteXY.level_red = 100 ;
      RemoteXY.level_yel = 100 ;
      RemoteXY.level_grn = map(value,0, 100,0, 100) ;    
  }
}