<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[forum.rcl-radio.ru &mdash; Ступенчатая регулировка]]></title>
	<link rel="self" href="http://forum.rcl-radio.ru/extern.php?action=feed&amp;tid=452&amp;type=atom" />
	<updated>2022-02-03T14:54:50Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.rcl-radio.ru/viewtopic.php?id=452</id>
		<entry>
			<title type="html"><![CDATA[Re: Ступенчатая регулировка]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=5373#p5373" />
			<content type="html"><![CDATA[<p>Все, всем спасибо. Сам сообразил. Тема закрыта.</p>]]></content>
			<author>
				<name><![CDATA[pafnutiy]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=1659</uri>
			</author>
			<updated>2022-02-03T14:54:50Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=5373#p5373</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Ступенчатая регулировка]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=5372#p5372" />
			<content type="html"><![CDATA[<p>if (millis() - time4 &gt; 1000) {<br />&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp;i_ch = i_reg / 8;&nbsp; analogWrite(pwm, (i_reg * 255 / 2));&nbsp; &nbsp; &nbsp; //i_reg регулировочный ток,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;( далее уходит в шим), делю на 8&nbsp; ступеней ( i_ch),<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; от 0 до&nbsp; 8 ступени++, с 8&nbsp; ступени -- обратно в 0.</p><p>&nbsp; &nbsp; &nbsp; i_reg1 += i_ch;// i_ch </p><p>&nbsp; &nbsp; &nbsp; if (i_reg1 &lt;= 0 || i_reg1 &gt;= i_reg) { i_ch = -i_ch; }&nbsp; &nbsp; &nbsp; //когда i_reg1 (это 8*i_ch) он = i_reg (т.к. это один ток) должен <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; переключиться с&nbsp; с + i_ch на&nbsp; -i_ch и уйти в 0. Но он этого не <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;делает<br />&nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; time4 = millis();}</p>]]></content>
			<author>
				<name><![CDATA[pafnutiy]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=1659</uri>
			</author>
			<updated>2022-02-03T13:45:09Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=5372#p5372</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Ступенчатая регулировка]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=5371#p5371" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>unsigned long times;
int i;

void setup() {
 pinMode(9,OUTPUT); 
}

void loop() {
 if(millis()-times&gt;1000){
  i++;
  if(i&gt;255){i=0;}
  analogWrite(9,i);
  times=millis();
  }

}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2022-02-03T12:55:38Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=5371#p5371</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Ступенчатая регулировка]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=5369#p5369" />
			<content type="html"><![CDATA[<p>Помогите пожалуйста. Я только учусь. Надо, чтобы в этом цикле (за эту секунду) проскакивала только&nbsp; одна &quot;i&quot;.<br />&nbsp; &nbsp;&quot;i&quot; -это переменное значение в этой программе, так же как и i_reg.</p><p>&nbsp; if(millis()-time4&gt;1000){</p><p>&nbsp; for (float i=0; i&lt;=i_reg; i=i+i_ch){analogWrite(pwm,i*255/2);}<br />&nbsp; &nbsp;<br />&nbsp; &nbsp;for (float i=i_reg; i&gt;=0; i=i-i_ch){analogWrite(pwm,i*255/2);} </p><p>&nbsp; &nbsp;time4=millis();}</p><p>Был еще такой первоначальный вариант: Но в нем&nbsp; i_reg1 запросто перескакивает i_reg и уходит в 255.</p><p>if (millis() - time4 &gt; 1000) {<br />&nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp;i_ch = i_reg / 8;&nbsp; analogWrite(pwm, (i_reg * 255 / 2)); </p><p>&nbsp; &nbsp; &nbsp; i_reg1 += i_ch;</p><p>&nbsp; &nbsp; &nbsp; if (i_reg1 &lt;= 0 || i_reg1 &gt;= i_reg) { i_ch = -i_ch; }<br />&nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; time4 = millis();}<br />Не пойму, что не так.</p>]]></content>
			<author>
				<name><![CDATA[pafnutiy]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=1659</uri>
			</author>
			<updated>2022-02-03T12:48:50Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=5369#p5369</id>
		</entry>
</feed>
