<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[RemoteXY community — More input cause bluetooth disconnected.]]></title>
		<link>https://forum.remotexy.com/viewtopic.php?id=217</link>
		<atom:link href="https://forum.remotexy.com/extern.php?action=feed&amp;tid=217&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in More input cause bluetooth disconnected..]]></description>
		<lastBuildDate>Thu, 03 Aug 2017 06:46:31 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: More input cause bluetooth disconnected.]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=854#p854</link>
			<description><![CDATA[<p>Oh, thank you, man.</p>]]></description>
			<author><![CDATA[null@example.com (mac)]]></author>
			<pubDate>Thu, 03 Aug 2017 06:46:31 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=854#p854</guid>
		</item>
		<item>
			<title><![CDATA[Re: More input cause bluetooth disconnected.]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=853#p853</link>
			<description><![CDATA[<p>Hello,</p><p>Here is a simple FSM I just wrote, I hope it can serve as an example to help you understand how to write your program.</p><p>This is for a modification of my computer display so that I can turn it on and off with RemoteXY. It simulates a press of 400ms on the &quot;on/off&quot; momentary pushbutton of the display, and then do nothing (but doesn&#039;t lock the microcontroller) during 4 seconds to avoid possible spam. </p><div class="codebox"><pre><code>uint8_t pwrBtnSimState = 0;

void pwrBtnSimTry()
{
    if ( pwrBtnSimState == 0 )
    {
        pwrBtnSimState = 1;
    }
}

void pwrBtnSimFSM()
{
    static uint32_t timer = 0;

    switch ( pwrBtnSimState )
    {
        case 1 :
        {
            digitalWrite( powerButtonPin, HIGH );
            timer = millis();
            pwrBtnSimState = 2;
            break;
        }
        case 2 :
        {
            if ( millis() - timer &gt;= 400UL )
            {
                digitalWrite( powerButtonPin, LOW );
                timer = millis();
                pwrBtnSimState = 3;
            }
            break;
        }
        case 3 :
        {
            if ( millis() - timer &gt;= 4000UL )
            {
                pwrBtnSimState = 0;
            }
            break;
        }
    }
}


void loop()
{
    // Try to start the simulation of the display&#039;s power button when the corresponding RemoteXY button is pressed
    uint8_t rxyPwrBtn = RemoteXY.pwrBtn;
    static uint8_t rxyPwrBtn_prev = rxyPwrBtn;

    if ( rxyPwrBtn_prev != rxyPwrBtn )
    {
        rxyPwrBtn_prev = rxyPwrBtn;

        if ( rxyPwrBtn == 1 )
        {
            pwrBtnSimTry();
        }
    }

    // Always run the FSM
    pwrBtnSimFSM();

    ...
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (Guillaume)]]></author>
			<pubDate>Wed, 02 Aug 2017 18:31:52 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=853#p853</guid>
		</item>
		<item>
			<title><![CDATA[Re: More input cause bluetooth disconnected.]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=830#p830</link>
			<description><![CDATA[<p>Hi Guillaume, thank you for your reply. </p><p>I&#039;ve read that example and tried to use &#039;millis&#039; for a while. This lead me to new trouble. Can I ask about coding here.?</p>]]></description>
			<author><![CDATA[null@example.com (mac)]]></author>
			<pubDate>Fri, 28 Jul 2017 03:33:26 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=830#p830</guid>
		</item>
		<item>
			<title><![CDATA[Re: More input cause bluetooth disconnected.]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=829#p829</link>
			<description><![CDATA[<p>Of course you should not use delay. It locks your code during that time. It&#039;s bad practice, especially when you have a wireless UI which must be responsive.</p><p>You have to use the method shown in the arduino&#039;s &quot;blink without delay&quot; example.</p><p>This will require that you use another coding style, the program flow will be harder to visualize, so I recommend that you also look at how to make a finite state machine.</p>]]></description>
			<author><![CDATA[null@example.com (Guillaume)]]></author>
			<pubDate>Fri, 28 Jul 2017 01:04:32 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=829#p829</guid>
		</item>
		<item>
			<title><![CDATA[Re: More input cause bluetooth disconnected.]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=827#p827</link>
			<description><![CDATA[<p>Sure, and i have more info that may help clarify the problem. I found that if i remove&nbsp; delay commands, the system work fine. So, problem may be on the code side, not the App. or hardware. I think new question should be; how can i make program wait for amount of time without using delay command. </p><p>void loop() <br />{ </p><p>&nbsp; RemoteXY_Handler ();<br />&nbsp; <br />&nbsp; &nbsp; for ( int i=0; i&lt;RemoteXY.total; i++){</p><p>&nbsp; if (RemoteXY.start_button==0){<br />&nbsp; }<br />&nbsp; &nbsp;else {</p><p>&nbsp; digitalWrite(relay, HIGH);<br />&nbsp; delay(RemoteXY.wait_1);</p><p>&nbsp; if (RemoteXY.start_button==1){<br />&nbsp; digitalWrite(relay, LOW);<br />&nbsp; &nbsp; delay(RemoteXY.wait_2); </p><p>&nbsp; &nbsp; }<br />}<br />}</p><p>}</p>]]></description>
			<author><![CDATA[null@example.com (mac)]]></author>
			<pubDate>Wed, 26 Jul 2017 08:35:57 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=827#p827</guid>
		</item>
		<item>
			<title><![CDATA[Re: More input cause bluetooth disconnected.]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=824#p824</link>
			<description><![CDATA[<p>Hello. Can you share a sketch that does not work?</p>]]></description>
			<author><![CDATA[null@example.com (remotexy)]]></author>
			<pubDate>Wed, 26 Jul 2017 05:25:11 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=824#p824</guid>
		</item>
		<item>
			<title><![CDATA[More input cause bluetooth disconnected.]]></title>
			<link>https://forum.remotexy.com/viewtopic.php?pid=814#p814</link>
			<description><![CDATA[<p>I have a few successful projects with RemoteXY, really like it. But for new project with 4 input, bluetooth connection was terminated within about 20 second.&nbsp; This in not a free version time limit, use RemoteXY paid version. And, this is not a hardware problem, since this set of hardware work well in other RemoteXY projects. I notice that if use one input, such as 1 text edit field, system run with no problem. But, if when place more input in a loop, bluetooth get disconnected within about 20 second. I&#039;ve tried another approach, read input first, then store data in EEPROM in void setup state, then read from EEPROM into a loop , but, no luck, bluetooth still get disconnected. Have you ever got this problem? How do you deal with it? Any ideas from all you guys are more than appreciated. Thank you.</p><p>BTW, i&#039;ve tried different 5v power sources for HC-05, excepted 3.3 v.</p>]]></description>
			<author><![CDATA[null@example.com (mac)]]></author>
			<pubDate>Mon, 24 Jul 2017 05:20:53 +0000</pubDate>
			<guid>https://forum.remotexy.com/viewtopic.php?pid=814#p814</guid>
		</item>
	</channel>
</rss>
