<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[RemoteXY community — Старт переключателя]]></title>
	<link rel="self" href="https://forum.remotexy.com/extern.php?action=feed&amp;tid=1028&amp;type=atom" />
	<updated>2022-05-08T06:24:31Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.remotexy.com/viewtopic.php?id=1028</id>
		<entry>
			<title type="html"><![CDATA[Re: Старт переключателя]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=4649#p4649" />
			<content type="html"><![CDATA[<p>Ваш вопрос не относится к RemoteXY. </p><p>Инвертируйте выходной сигнал, т.е. если кнопка нажата то на выход отправляйте 0, если не нажата то отправляйте 1: <br /></p><div class="codebox"><pre><code>if (RemoteXY.button_1 == 0) digitalWrite(14, 1);
else digitalWrite(14, 0);</code></pre></div><p>Уберите из функции setup() установку выхода в 0, вы тем самым включаете реле. Установите выход в 1 выключив реле. Еще лучше установить в 1 до объявления его выходом, иначе кратковременное включение возможно между этими командами.</p>]]></content>
			<author>
				<name><![CDATA[remotexy]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2</uri>
			</author>
			<updated>2022-05-08T06:24:31Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=4649#p4649</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Старт переключателя]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=4647#p4647" />
			<content type="html"><![CDATA[<p>Здравствуйте<br />Помогите решить мою проблему<br />Имеется 2-х канальное модуль реле, управление производится подачей LOW на сигнальную клемму реле.<br />Создал 1 кнопку и 1 выключатель в RemoteXY, с помощь FLProg создал скейч :</p><p>#define&nbsp; REMOTEXY_MODE__ESP8266WIFI_LIB_CLOUD<br />#include &lt;ESP8266WiFi.h&gt;<br />#include &lt;RemoteXY.h&gt;<br />extern &quot;C&quot; <br />{<br />&nbsp; &nbsp; #include &quot;user_interface.h&quot;<br />}<br />#define REMOTEXY_WIFI_SSID &quot;TP-Link&quot;<br />#define REMOTEXY_WIFI_PASSWORD &quot;123456780&quot;<br />#define REMOTEXY_CLOUD_SERVER &quot;cloud.remotexy.com&quot;<br />#define REMOTEXY_CLOUD_PORT 6376<br />#define REMOTEXY_CLOUD_TOKEN &quot;922de051a7a4eb74238699e7576f7a94&quot;<br />#pragma pack(push, 1)<br />uint8_t RemoteXY_CONF[] = {255, 2, 0, 0, 0, 30, 0, 16, 31, 1, 2, 1, 9, 38, 32, 11, 2, 26, 31, 31, 79, 78, 0, 79, 70, 70, 0, 1, 0, 19, 63, 12, 12, 2, 31, 48, 0};<br />struct <br />{<br />&nbsp; &nbsp; unsigned char switch_1;<br />&nbsp; &nbsp; unsigned char button_1;<br />&nbsp; &nbsp; unsigned char connect_flag;<br />}<br /> RemoteXY;<br />#pragma pack(pop)<br />void setup()<br />{<br />&nbsp; &nbsp; pinMode(14, OUTPUT);<br />&nbsp; &nbsp; digitalWrite(14, 0);<br />&nbsp; &nbsp; pinMode(16, OUTPUT);<br />&nbsp; &nbsp; digitalWrite(16, 0);<br />&nbsp; &nbsp; RemoteXY_Init ();<br />}<br />void loop()<br />{<br />&nbsp; &nbsp; RemoteXY_Handler&nbsp; ();<br />&nbsp; &nbsp; //Плата:1<br />&nbsp; &nbsp; digitalWrite(14, (RemoteXY.button_1));<br />&nbsp; &nbsp; digitalWrite(16, (RemoteXY.switch_1));<br />}<br />bool _isTimer(unsigned long startTime, unsigned long period)<br />{<br />&nbsp; &nbsp; unsigned long currentTime;<br />&nbsp; &nbsp; currentTime = millis();<br />&nbsp; &nbsp; if (currentTime&gt;= startTime) <br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; return (currentTime&gt;=(startTime + period));<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp;else <br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; return (currentTime &gt;=(4294967295-startTime+period));<br />&nbsp; &nbsp; }<br />}</p><p>загрузил скейч на ESP8266<br />Получил результат, что при включении питания на ESP8266 срабатывают оба реле.<br />Прочитал статью <a target="_blank" href="https://remotexy.com/ru/help/whatiscode/">https://remotexy.com/ru/help/whatiscode/</a> и попробовал поставить начальное положение в функции setup,&nbsp; выключено :</p><p> pinMode(14, OUTPUT);<br />&nbsp; &nbsp; digitalWrite(14, 0);<br />&nbsp; &nbsp; pinMode(16, OUTPUT);<br />&nbsp; &nbsp; digitalWrite(16, 0);<br />&nbsp; &nbsp; RemoteXY_Init ();<br />&nbsp; &nbsp; RemoteXY.switch_1 = 1; </p><p>Это привело к тому что поменялся значок выключателя в телефоне при старте на &quot;ON&quot;, а также реле подключенное к выключателю, срабатывает на секунду и выключается.</p><br /><p>Как мне сделать так, что бы оба реле при загрузке ESP8266 не включались?<br />Находил уже такой вопрос, вы писали, что можно как то через булеву переменную. Буду признателен если поясните как.<br />Спасибо</p>]]></content>
			<author>
				<name><![CDATA[evgen8]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2122</uri>
			</author>
			<updated>2022-05-07T08:48:04Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=4647#p4647</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Старт переключателя]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=3027#p3027" />
			<content type="html"><![CDATA[<p>Спасибо. Помогло.</p>]]></content>
			<author>
				<name><![CDATA[Cneg]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=1394</uri>
			</author>
			<updated>2020-05-31T05:52:43Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=3027#p3027</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Старт переключателя]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=3025#p3025" />
			<content type="html"><![CDATA[<p>Вы можете задать начальное положение переключателя или любого элемента в функции setup()<br />Подробнее тут <a target="_blank" href="https://remotexy.com/ru/help/whatiscode/">https://remotexy.com/ru/help/whatiscode/</a></p>]]></content>
			<author>
				<name><![CDATA[remotexy]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=2</uri>
			</author>
			<updated>2020-05-31T05:43:51Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=3025#p3025</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Старт переключателя]]></title>
			<link rel="alternate" href="https://forum.remotexy.com/viewtopic.php?pid=3023#p3023" />
			<content type="html"><![CDATA[<p>Как заставить переключатель стартовать с позиции отличной от A (=0)? И чтобы в приложении это было видно. Спасибо</p>]]></content>
			<author>
				<name><![CDATA[Cneg]]></name>
				<uri>https://forum.remotexy.com/profile.php?id=1394</uri>
			</author>
			<updated>2020-05-30T16:33:09Z</updated>
			<id>https://forum.remotexy.com/viewtopic.php?pid=3023#p3023</id>
		</entry>
</feed>
