<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[RemoteXY community — connect_flag doesn't re-establish itself]]></title>
	<link rel="self" href="https://forum.remotexy.com/extern.php?action=feed&amp;tid=557&amp;type=atom" />
	<updated>2018-08-12T10:23:05Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.remotexy.com/viewtopic.php?id=557</id>
		<entry>
			<title type="html"><![CDATA[connect_flag doesn't re-establish itself]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=1751#p1751" />
			<content type="html"><![CDATA[<p>In my sketch I am monitoring the connect_flag and drive a physical LED either green or red if connected (depending on a zone control in my RemoteXY app), and blue if not connected.&nbsp; That all woks OK, the LED turns blue if I put the iPad app into the background. Serial comms to the Bluetooth module stops, as expected, and the &quot;paired&quot; led on the BT module stays solid.</p><p>However, when I bring the RemoteXY app to the foreground again, serial comms restarts, indicating that it is communicating with the iPad app again, but the connect_flag remains 0, meaning I have to Stop the project and restart it manually.&nbsp; You can see from the code excerpt that I have put some debugging outputs for my oscilloscope, and can clearly see scope1 toggling on and off, but not scope2</p><p>Has anyone else seen this behaviour, and more importantly know a way round it ?</p><div class="codebox"><pre><code>void loop() {
  digitalWrite(scope1, HIGH); 
  RemoteXY_Handler ();
  digitalWrite(scope1, LOW); 

if (RemoteXY.connect_flag == 0) {
  // not connected
  LED_Blue();
//   delay(5);
  }
else {
  // connected
  digitalWrite(scope2, HIGH); 
  switch (RemoteXY.ZONE) {
    // ZONE = 0, so Zone 1
    case 0:
     LED_Green();
     RemoteXY.led_1_g = 150;
     RemoteXY.led_1_r = 0;
     digitalWrite(IR2_Gate, LOW);
     digitalWrite(IR1_Gate, HIGH);
     break;

    case 1:
     // ZONE = 1, so Zone 2
     LED_Red();
     RemoteXY.led_1_r = 150;
     RemoteXY.led_1_g = 0;
     digitalWrite(IR1_Gate, LOW);
     digitalWrite(IR2_Gate, HIGH);
     break;
  }
  digitalWrite(scope2, LOW); 
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Daba]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=630</uri>
			</author>
			<updated>2018-08-12T10:23:05Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=1751#p1751</id>
		</entry>
</feed>
