<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[RemoteXY community — Battery Voltage Level Indicator using multiple Linear Level Indicators]]></title>
		<link>https://forum.remotexy.com/viewtopic.php?id=1093</link>
		<atom:link href="https://forum.remotexy.com/extern.php?action=feed&amp;tid=1093&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Battery Voltage Level Indicator using multiple Linear Level Indicators.]]></description>
		<lastBuildDate>Fri, 10 Jul 2020 15:21:16 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Battery Voltage Level Indicator using multiple Linear Level Indicators]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=3181#p3181</link>
			<description><![CDATA[<p>To show the battery voltage of your remote application might be one of the necessary things you like <br />to do with RemoteXY. You can use the level indicators to do this.</p><p>This tutorial shows you how to build a battery voltage level indicator with red, yellow and green areas for the<br />good, almost good and critical range of the battery voltage. To do this, we will use three Linear Level Indicators<br />put on top of each other. What does this mean?</p><p>If you right click one of the elements on your RemoteXY editor screen, you might have recognized the last<br />for items &quot;.....&quot; </p><p><span class="postimg"><img src="https://i.imgur.com/PuFNekr.png" alt="https://i.imgur.com/PuFNekr.png" /></span></p><p>Each element placed in the editor is put on its own &quot;level&quot;. You may think about these levels like glass frames stacked on each other. <br />Viewing from top you can see all the elements, but you can also move the elements over each other, sometimes hiding one element <br />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 <br />the text background becomes the panel color and shape ( using &quot;lowered&quot; option ).</p><p><span class="postimg"><img src="https://i.imgur.com/Il77G5Q.png" alt="https://i.imgur.com/Il77G5Q.png" /></span></p><p>Or you can place a button element below a LED element. Still the button function is available, even the<br />button is behind the LED. This way you can have a nice push-on/off button with indicator LED.</p><p><span class="postimg"><img src="https://i.imgur.com/X2PhPZA.png" alt="https://i.imgur.com/X2PhPZA.png" /></span></p><p>Coming back to the battery level indicator. We are using three Linear Level Indicators. <br />We change the size and the color as shown here.</p><p><span class="postimg"><img src="https://i.imgur.com/YPE4u5G.png" alt="https://i.imgur.com/YPE4u5G.png" /></span></p><p>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<br />right-click-context menu and select &quot;To back&quot; if this is not the case. On top of the panel, the green Level Indicator will be placed.<br />The the context menu again to change the order. Once again, all elements are active, even you would move the Level Indicator <br />behind the panel, making it invisible.</p><p><span class="postimg"><img src="https://i.imgur.com/LZmHdDA.png" alt="https://i.imgur.com/LZmHdDA.png" /></span></p><p>This was the hardest part already. Add a slider element and a text element and your done with the screen setup.</p><p><span class="postimg"><img src="https://i.imgur.com/IlT5xIU.png?1" alt="https://i.imgur.com/IlT5xIU.png?1" /></span></p><p>This might look a little bit weird, but in the end it&#039;s perfect:</p><p><span class="postimg"><img src="https://i.imgur.com/apS5ZhJ.jpg?2" alt="https://i.imgur.com/apS5ZhJ.jpg?2" /></span></p><p>The Arduino code is here:<br /></p><div class="codebox"><pre><code>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, &quot;%5d&quot;, value);
  if ( value &lt; LEVEL_YEL ) {
      RemoteXY.level_red = map(value,0, LEVEL_YEL,0, 100) ;
      RemoteXY.level_yel = 0 ;
      RemoteXY.level_grn = 0 ;
  }
  if ((value &gt;= LEVEL_YEL) &amp;&amp; (value&lt;LEVEL_GRN)) {
      RemoteXY.level_red = 100 ;
      RemoteXY.level_yel = map(value,0, LEVEL_GRN,0, 100) ;    
      RemoteXY.level_grn = 0 ;      
  }
  if ( value &gt;= LEVEL_GRN ) {
      RemoteXY.level_red = 100 ;
      RemoteXY.level_yel = 100 ;
      RemoteXY.level_grn = map(value,0, 100,0, 100) ;    
  }
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Seventh Dwarf)]]></author>
			<pubDate>Fri, 10 Jul 2020 15:21:16 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=3181#p3181</guid>
		</item>
	</channel>
</rss>
