<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[forum.rcl-radio.ru &mdash; Работа с WIFI ESP8266(gyverPortal)]]></title>
		<link>http://forum.rcl-radio.ru/viewtopic.php?id=677</link>
		<atom:link href="http://forum.rcl-radio.ru/extern.php?action=feed&amp;tid=677&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «Работа с WIFI ESP8266(gyverPortal)».]]></description>
		<lastBuildDate>Wed, 16 Oct 2024 17:19:24 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Работа с WIFI ESP8266(gyverPortal)]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=10914#p10914</link>
			<description><![CDATA[<p>это если включен режим wifi_sta, а на режим wifi_ap есть такая команда</p>]]></description>
			<author><![CDATA[null@example.com (vladbuharkin20)]]></author>
			<pubDate>Wed, 16 Oct 2024 17:19:24 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=10914#p10914</guid>
		</item>
		<item>
			<title><![CDATA[Re: Работа с WIFI ESP8266(gyverPortal)]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=10912#p10912</link>
			<description><![CDATA[<div class="codebox"><pre><code>#include &lt;Wire.h&gt;                       // Подключение библиотеки Wire
#include &lt;Adafruit_GFX.h&gt;               // Подключение библиотеки Adafruit_GFX
#include &lt;Adafruit_SSD1306.h&gt;           // Подключение библиотеки Adafruit_SSD1306
#include &lt;microDS18B20.h&gt;
#include &lt;Servo.h&gt;
#include &lt;ESP8266WiFi.h&gt;
#include &lt;GyverPortal.h&gt;

#define AP_SSID &quot;iPhone&quot; //имя сети
#define AP_PASS &quot;12345678&quot; //пароль
GyverPortal ui;

MicroDS18B20&lt;0&gt; sensor;
Servo myservo;

int temp, pos,i_dig,i_sum,i_iz,n;
float v,i_su,i_di,i_i,f,tempera;
long V;
#define SCREEN_WIDTH 128 
#define SCREEN_HEIGHT 64 
#define OLED_RESET     13 
#define SCREEN_ADDRESS 0x3C
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &amp;Wire, OLED_RESET);
int nmin = 25;
int nmax = 60;

int analogInput = A0; 

float vout = 0.0;
float vin = 0.0;
float R1 = 98700;                // Resistor R1 100k 
float R2 = 9740;                 // Resistor R2 10k
int value = 0;





void setup() {
  Serial.begin(115200);
  display.begin(SSD1306_SWITCHCAPVCC, 0x3c); // Указываем адрес дисплея
  pinMode(analogInput, INPUT);

  WiFi.mode(WIFI_STA);
  WiFi.begin(AP_SSID, AP_PASS);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(&quot;.&quot;);
  }
  Serial.println(WiFi.localIP());
  Serial.println(WiFi.status());
}


void loop() {

}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Wed, 16 Oct 2024 14:37:15 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=10912#p10912</guid>
		</item>
		<item>
			<title><![CDATA[Re: Работа с WIFI ESP8266(gyverPortal)]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=10911#p10911</link>
			<description><![CDATA[<p>if(w==0){<br />выводим на экран - нет подключения<br />}</p><p>if(w==1){<br />выводим на экран -&nbsp; подключено<br />}</p>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Wed, 16 Oct 2024 13:40:09 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=10911#p10911</guid>
		</item>
		<item>
			<title><![CDATA[Re: Работа с WIFI ESP8266(gyverPortal)]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=10910#p10910</link>
			<description><![CDATA[<p>Создать переменные </p><p>unsigned long times;<br />bool w=0;<br />int n;</p><p>В основной цикл вставить</p><p>if(w==0 &amp;&amp; millis()-times&gt;10000){<br />&nbsp; times = millis();<br />while (WiFi.status() != WL_CONNECTED) {<br />&nbsp; &nbsp; delay(500);<br />&nbsp; &nbsp; Serial.print(&quot;.&quot;);<br />&nbsp; &nbsp;n++;<br />&nbsp; if(n&gt;3){break;w=0;}else{w=1;}<br />&nbsp; }}</p><p>каждые 10 секунд будет попытка подключения</p>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Wed, 16 Oct 2024 13:39:23 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=10910#p10910</guid>
		</item>
		<item>
			<title><![CDATA[Re: Работа с WIFI ESP8266(gyverPortal)]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=10909#p10909</link>
			<description><![CDATA[<p>А как сделать чтобы в самом скетче ESP делала&nbsp; попытки подключения, если не получилось то в консоль писалось connect(в дальнейшем я выведу статичное слово connect на дисплей), а если не удалось подключиться то на экране раз в секунду мигало &quot;no connect&quot;.</p>]]></description>
			<author><![CDATA[null@example.com (vladbuharkin20)]]></author>
			<pubDate>Wed, 16 Oct 2024 13:22:43 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=10909#p10909</guid>
		</item>
		<item>
			<title><![CDATA[Re: Работа с WIFI ESP8266(gyverPortal)]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=10908#p10908</link>
			<description><![CDATA[<p>Выход из цикла через три попытки подключения&nbsp; </p><p>while (WiFi.status() != WL_CONNECTED) {<br />&nbsp; &nbsp; delay(500);<br />&nbsp; &nbsp; Serial.print(&quot;.&quot;);<br />&nbsp; &nbsp;n++;<br />&nbsp; if(n&gt;3){break;}<br />&nbsp; }</p>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Wed, 16 Oct 2024 13:12:57 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=10908#p10908</guid>
		</item>
		<item>
			<title><![CDATA[Работа с WIFI ESP8266(gyverPortal)]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=10907#p10907</link>
			<description><![CDATA[<p>Добрый день делаю проект на ESP8266. Её использую для вывода информации на дисплей OLED 128x64 и отправки на сайт некоторых значений, для простой постройки WEB странички куда будет приходить информация использую библиотеку GyverPortal.h. Столкнулся со следующей проблемой, а именно в скетче я указал название и пароль от своей wifi сети, когда ESP находится в зоне действия вай фай сети-то всё ок(ESP без проблем к ней подключается и запускается основной скетч и функция void loop). Но когда домашняя сеть не добивает до ESP она бесконечно пытается подключиться к ней и блокирует основной цикл программы. Хотелось бы узнать, можно ли сделать так чтобы ESP сначала полностью запускалась и выполняла задали скетча, а затем уже пыталась подключиться к сети WIFI (а если подключиться не удается,то повторить попытку через определенный промежуток времени).<br /></p><div class="codebox"><pre><code>#include &lt;Wire.h&gt;                       // Подключение библиотеки Wire
#include &lt;Adafruit_GFX.h&gt;               // Подключение библиотеки Adafruit_GFX
#include &lt;Adafruit_SSD1306.h&gt;           // Подключение библиотеки Adafruit_SSD1306
#include &lt;microDS18B20.h&gt;
#include &lt;Servo.h&gt;
#include &lt;ESP8266WiFi.h&gt;
#include &lt;GyverPortal.h&gt;

#define AP_SSID &quot;iPhone&quot; //имя сети
#define AP_PASS &quot;12345678&quot; //пароль
GyverPortal ui;

MicroDS18B20&lt;0&gt; sensor;
Servo myservo;

int temp, pos,i_dig,i_sum,i_iz,n;
float v,i_su,i_di,i_i,f,tempera;
long V;
#define SCREEN_WIDTH 128 
#define SCREEN_HEIGHT 64 
#define OLED_RESET     13 
#define SCREEN_ADDRESS 0x3C
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &amp;Wire, OLED_RESET);
int nmin = 25;
int nmax = 60;

int analogInput = A0; 

float vout = 0.0;
float vin = 0.0;
float R1 = 98700;                // Resistor R1 100k 
float R2 = 9740;                 // Resistor R2 10k
int value = 0;

void build() {
  GP.BUILD_BEGIN(GP_DARK);
GP.ONLINE_CHECK();
GP.UPDATE(&quot;tempr,voltes,position&quot;);
  GP.TITLE(&quot;IZH Jupiter-4&quot;, &quot;t1&quot;);
  GP.HR();

GP_MAKE_BLOCK_TAB(
&quot;Блок настроек&quot;,
GP.LABEL(&quot;Настройки холостого хода&quot;);
GP_MAKE_BOX(GP.LABEL(&quot;Мин.температура&quot;);     GP.NUMBER(&quot;num&quot;, &quot;&quot;, nmin);    );
GP_MAKE_BOX(GP.LABEL(&quot;Макс.температура&quot;);    GP.NUMBER(&quot;num1&quot;,&quot;&quot;,nmax);     );
);
GP_MAKE_BLOCK_TAB(
&quot;Блок показателей&quot;,
GP.LABEL(&quot;Показатели&quot;);
GP_MAKE_BOX(GP.LABEL(&quot;Температура&quot;);       GP.LABEL(&quot;tempr&quot;, &quot;tempr&quot;);         );
GP_MAKE_BOX(GP.LABEL(&quot;Напряжение&quot;);        GP.LABEL(&quot;voltes&quot;, &quot;voltes&quot;);       );
GP_MAKE_BOX(GP.LABEL(&quot;Положение серво&quot;);   GP.LABEL(&quot;position&quot;, &quot;position&quot;);   );
)

  GP.BUILD_END();
}
void setup() {
  Serial.begin(115200);
  display.begin(SSD1306_SWITCHCAPVCC, 0x3c); // Указываем адрес дисплея
  pinMode(analogInput, INPUT);

  WiFi.mode(WIFI_STA);
  WiFi.begin(AP_SSID, AP_PASS);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(&quot;.&quot;);
  }
  Serial.println(WiFi.localIP());

  // подключаем конструктор и запускаем
  ui.attachBuild(build);
  ui.attach(action);
  ui.start();

    myservo.attach(2);
    myservo.write(0);
}
ui.updateFloat(&quot;tempr&quot;, tempera);
ui.updateFloat(&quot;voltes&quot;,i_i);
ui.updateInt(&quot;position&quot;,temp);

  if (ui.clickInt(&quot;num&quot;, nmin)) {
      Serial.print(&quot;Number: &quot;);

      Serial.println(nmin);
    }
     if (ui.clickInt(&quot;num1&quot;, nmax)) {
      Serial.print(&quot;Number1: &quot;);

      Serial.println(nmax);
    }
}
void loop() {
ui.tick();
sensor.requestTemp();

pos=map(i_iz,nmin,nmax,180,0);//map полодения сервы в завимости от температуры 
myservo.write(pos);
/////чтение температуры и отделение десятой части/////
v=sensor.getTemp();
V=round(v*10);
i_iz=V/10;
//////мин. и макс. значение температуры для map////
if(i_iz&gt;60){i_iz=60;}
if(i_iz&lt;nmin){i_iz=nmin;}
/////////вольтметр///////////////
 i_di = analogRead(analogInput);
 i_su = i_su+i_di;
 f++;if(f&gt;9){f=0;i_i=i_su/293.0;i_su=0;}
 
tempera = sensor.getTemp();

draw();//вывод на дисплей
}
void draw(){
display.clearDisplay(); 
display.setTextColor(WHITE);

display.setCursor(26,0);  
display.setTextSize(1);                  
display.println(&quot;temperature:&quot;);//текст &quot;температура:&quot;

display.setCursor(15,33);  
display.setTextSize(1);                  
display.println(&quot;pos:&quot;);// текст &quot;положение серво машинки 0-180*&quot;

display.setCursor(78,33);  
display.setTextSize(1);                  
display.println(&quot;volts:&quot;);// текст &quot;напряжение:&quot;

display.setCursor(56,42);  
display.setTextSize(3);                  
display.println(i_i,1);//вывод напряжения             

display.setCursor(25,10);  
display.setTextSize(3);                  
display.println(sensor.getTemp(),1);//вывод температуры 
  
display.setCursor(0,42);                    
display.setTextSize(3);                       
display.println(pos); // вывод положения сервы           
display.display(); 
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (vladbuharkin20)]]></author>
			<pubDate>Wed, 16 Oct 2024 13:04:27 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=10907#p10907</guid>
		</item>
	</channel>
</rss>
