<?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; Часы на адресной светодиодной ленте WS2812B (ATtiny2313)]]></title>
		<link>http://forum.rcl-radio.ru/viewtopic.php?id=443</link>
		<atom:link href="http://forum.rcl-radio.ru/extern.php?action=feed&amp;tid=443&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «Часы на адресной светодиодной ленте WS2812B (ATtiny2313)».]]></description>
		<lastBuildDate>Sun, 22 Mar 2026 15:10:15 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Часы на адресной светодиодной ленте WS2812B (ATtiny2313)]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=12623#p12623</link>
			<description><![CDATA[<p>Подскажите, какие фьюзы выставить на ATtiny2313 ?</p>]]></description>
			<author><![CDATA[null@example.com (andrey9786)]]></author>
			<pubDate>Sun, 22 Mar 2026 15:10:15 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=12623#p12623</guid>
		</item>
		<item>
			<title><![CDATA[Re: Часы на адресной светодиодной ленте WS2812B (ATtiny2313)]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=12520#p12520</link>
			<description><![CDATA[<p>Протестируйте 2313 , подключите светодиод через резистор 200 Ом к выводу 14 микросхемы</p><p>светодиод должен мигать 1 раз в секунду</p><div class="codebox"><pre><code>void setup() {
  pinMode(11, OUTPUT);// PIN14 PB2
}

void loop() {
  digitalWrite(11, HIGH);   
  delay(500);                       
  digitalWrite(11, LOW);   
  delay(500);              
}</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Sun, 22 Feb 2026 05:27:10 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=12520#p12520</guid>
		</item>
		<item>
			<title><![CDATA[Re: Часы на адресной светодиодной ленте WS2812B (ATtiny2313)]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=12519#p12519</link>
			<description><![CDATA[<p>На Arduino часы работают! Хотелось бы собрать&nbsp; на микросхеме ATtiny2313 как на схеме!</p>]]></description>
			<author><![CDATA[null@example.com (Vasiliy67)]]></author>
			<pubDate>Sun, 22 Feb 2026 05:16:03 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=12519#p12519</guid>
		</item>
		<item>
			<title><![CDATA[Re: Часы на адресной светодиодной ленте WS2812B (ATtiny2313)]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=12518#p12518</link>
			<description><![CDATA[<p>// ATtiny2313 20MHz<br />#include &lt;avr/io.h&gt;<br />#include &lt;util/delay.h&gt;<br />#define L_BIT&nbsp; &nbsp; PORTB &amp;= ~(1&lt;&lt;PB0)<br />#define H_BIT&nbsp; &nbsp; PORTB |=&nbsp; (1&lt;&lt;PB0) <br />#define SDA&nbsp; &nbsp; &nbsp; PD2&nbsp; // PIN6<br />#define SCL&nbsp; &nbsp; &nbsp; PD3&nbsp; // PIN7<br />#define SQW&nbsp; &nbsp; &nbsp; PD4&nbsp; // PIN8<br />#define LED_MAX&nbsp; 88</p><p>&nbsp; byte brig=1;<br />&nbsp; bool r,g,b;<br />&nbsp; bool rr[LED_MAX];<br />&nbsp; byte hh,mm,hour,min;<br />&nbsp; byte r_led=0,g_led=1,b_led=0;<br />&nbsp; byte mode;<br />&nbsp; bool sett,w,w1;<br />&nbsp; </p><p>int main(void){<br />&nbsp; DDRB |= (1&lt;&lt;PB0); // PIN12 WS2812B <br />&nbsp; DDRB &amp;= ~(1&lt;&lt;PB1);// PIN13 BUTTON MODE<br />&nbsp; DDRB &amp;= ~(1&lt;&lt;PB2);// PIN14 BUTTON UP<br />&nbsp; DDRB &amp;= ~(1&lt;&lt;PB3);// PIN15 BUTTON DOWN<br />&nbsp; DDRB &amp;= ~(1&lt;&lt;PB4);// PIN16 BUTTON SET<br />&nbsp; PORTB |= (1&lt;&lt;PB1)|(1&lt;&lt;PB2)|(1&lt;&lt;PB3)|(1&lt;&lt;PB4);<br />&nbsp; _delay_ms(100);<br />&nbsp; if(EEPROM_read(100)!=1){for(int i1=0;i1&lt;101;i1++){EEPROM_write(i1,1);}}// очистка памяти при первом включении <br />&nbsp; mode = EEPROM_read(0);brig = EEPROM_read(1);<br />//&nbsp; set_time(21,3,3,9,21,52,0);// год 00-99, ДН 1-7 (1=ВС), месяц 1-12, дата 1-31, час 0-23, минуты 0-59, секунды 0-59</p> <br /><p>while(1){<br />&nbsp; &nbsp;min =&nbsp; (ds_read(1) &amp; 0x0F) + (((ds_read(1) &amp; 0x70) &gt;&gt; 4) * 10);<br />&nbsp; &nbsp;hour = ((ds_read(2) &amp; 0x0F) + ((ds_read(2) &amp; 0x70) &gt;&gt; 4) * 10);<br />/////// BUTTON ///////////////////////////////////////////////<br />&nbsp; if(((PINB &gt;&gt; PB1) &amp; 1) == 0){mode++;if(mode&gt;6){mode=0;}_delay_ms(300);w=1;}<br />&nbsp; switch(mode){<br />&nbsp; &nbsp; case 0: r_led=1,g_led=1,b_led=1; break;<br />&nbsp; &nbsp; case 1: r_led=1,g_led=0,b_led=0; break;<br />&nbsp; &nbsp; case 2: r_led=0,g_led=1,b_led=0; break;<br />&nbsp; &nbsp; case 3: r_led=0,g_led=0,b_led=1; break;<br />&nbsp; &nbsp; case 4: r_led=1,g_led=1,b_led=0; break;<br />&nbsp; &nbsp; case 5: r_led=1,g_led=0,b_led=1; break;<br />&nbsp; &nbsp; case 6: r_led=0,g_led=1,b_led=1; break;<br />&nbsp; &nbsp; }<br />&nbsp; &nbsp;if(((PINB &gt;&gt; PB2) &amp; 1) == 0 &amp;&amp; sett==0){brig++;if(brig&gt;250){brig=250;}w=1;} <br />&nbsp; &nbsp;if(((PINB &gt;&gt; PB3) &amp; 1) == 0 &amp;&amp; sett==0){brig--;if(brig&lt;1){brig=1;}w=1;} <br />&nbsp; &nbsp;if(((PINB &gt;&gt; PB4) &amp; 1) == 0 &amp;&amp; sett==0){sett=1;_delay_ms(300);}<br />&nbsp; &nbsp;if(((PINB &gt;&gt; PB4) &amp; 1) == 0 &amp;&amp; sett==1){sett=0;_delay_ms(300);}&nbsp; &nbsp;</p><br /><p>////////// RGB ////////////////////////////////////////////////<br />&nbsp; &nbsp; indd(hour / 10, 0);<br />&nbsp; &nbsp; indd(hour % 10, 21);</p><p>&nbsp; &nbsp; if(((PIND &gt;&gt; SQW) &amp; 1) == 0 &amp;&amp; sett==0){data_led(42, 1);data_led(43, 1);data_led(44, 1);data_led(45, 1);}<br />&nbsp; &nbsp; &nbsp; else{data_led(42, 0);data_led(43,0);data_led(44, 0);data_led(45, 0);}</p><p>&nbsp; &nbsp; if(sett==1){data_led(42, 1);data_led(43, 1);data_led(44, 1);data_led(45, 1);}<br />&nbsp; <br />&nbsp; &nbsp; indd(min / 10, 46);<br />&nbsp; &nbsp; indd(min % 10, 67);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; led_rgb();res();<br />&nbsp; &nbsp; _delay_ms(100);</p><p>//////////// SET TIME ////////////////////////////////////////////////////////////////////// <br /> if(sett==1){<br />&nbsp; hh=hour;<br />&nbsp; mm=min;<br />&nbsp; if(((PINB &gt;&gt; PB2) &amp; 1) == 0){hh++;if(hh&gt;23){hh=0;}_delay_ms(100);w1=1;} <br />&nbsp; if(((PINB &gt;&gt; PB3) &amp; 1) == 0){mm++;if(mm&gt;59){mm=1;}_delay_ms(100);w1=1;} <br />&nbsp; if(w1==1){w1=0;set_time(21,1,12,26,hh,mm,0);}<br />&nbsp; }&nbsp; &nbsp;</p><p>////// EEPROM ///////////////////<br /> if(w==1){w=0;EEPROM_write(0,mode);EEPROM_write(1,brig);}&nbsp; <br />}} // end loop</p><p>void indd(byte t, byte sdv){<br />&nbsp; &nbsp; switch(t){&nbsp; &nbsp;<br />&nbsp; &nbsp; case 0: ws(0+sdv,1);ws(3+sdv,1);ws(6+sdv,1);ws(9+sdv,0);ws(12+sdv,1);ws(15+sdv,1);ws(18+sdv,1);break;<br />&nbsp; &nbsp; case 1: ws(0+sdv,0);ws(3+sdv,0);ws(6+sdv,1);ws(9+sdv,0);ws(12+sdv,0);ws(15+sdv,0);ws(18+sdv,1);break;<br />&nbsp; &nbsp; case 2: ws(0+sdv,0);ws(3+sdv,1);ws(6+sdv,1);ws(9+sdv,1);ws(12+sdv,1);ws(15+sdv,1);ws(18+sdv,0);break;<br />&nbsp; &nbsp; case 3: ws(0+sdv,0);ws(3+sdv,1);ws(6+sdv,1);ws(9+sdv,1);ws(12+sdv,0);ws(15+sdv,1);ws(18+sdv,1);break;<br />&nbsp; &nbsp; case 4: ws(0+sdv,1);ws(3+sdv,0);ws(6+sdv,1);ws(9+sdv,1);ws(12+sdv,0);ws(15+sdv,0);ws(18+sdv,1);break;<br />&nbsp; &nbsp; case 5: ws(0+sdv,1);ws(3+sdv,1);ws(6+sdv,0);ws(9+sdv,1);ws(12+sdv,0);ws(15+sdv,1);ws(18+sdv,1);break;<br />&nbsp; &nbsp; case 6: ws(0+sdv,1);ws(3+sdv,1);ws(6+sdv,0);ws(9+sdv,1);ws(12+sdv,1);ws(15+sdv,1);ws(18+sdv,1);break;<br />&nbsp; &nbsp; case 7: ws(0+sdv,0);ws(3+sdv,1);ws(6+sdv,1);ws(9+sdv,0);ws(12+sdv,0);ws(15+sdv,0);ws(18+sdv,1);break;<br />&nbsp; &nbsp; case 8: ws(0+sdv,1);ws(3+sdv,1);ws(6+sdv,1);ws(9+sdv,1);ws(12+sdv,1);ws(15+sdv,1);ws(18+sdv,1);break;<br />&nbsp; &nbsp; case 9: ws(0+sdv,1);ws(3+sdv,1);ws(6+sdv,1);ws(9+sdv,1);ws(12+sdv,0);ws(15+sdv,1);ws(18+sdv,1);break;<br />&nbsp; &nbsp; } <br />&nbsp; }</p><p>void ws(byte ind, bool datt){<br />&nbsp; if(datt==1){data_led(ind, 1);data_led(ind+1, 1);data_led(ind+2, 1);}<br />&nbsp; else{data_led(ind, 0);data_led(ind+1, 0);data_led(ind+2, 0);}}</p><p>void bit_0(){H_BIT;asm(&quot;nop&quot;);asm(&quot;nop&quot;);&nbsp; &nbsp;L_BIT;asm(&quot;nop&quot;);asm(&quot;nop&quot;);asm(&quot;nop&quot;);&nbsp; &nbsp;asm(&quot;nop&quot;);} <br />void bit_1(){H_BIT;asm(&quot;nop&quot;);asm(&quot;nop&quot;);asm(&quot;nop&quot;);asm(&quot;nop&quot;);asm(&quot;nop&quot;);asm(&quot;nop&quot;);asm(&quot;nop&quot;);asm(&quot;nop&quot;);&nbsp; &nbsp;L_BIT;}<br />void bit_w(bool x){if(x) bit_1(); else bit_0();}<br />void res(){_delay_us(100);}<br />void data_led(byte num, bool rrr){rr[num]=rrr;}<br />void led_rgb(){<br />&nbsp; for(byte num_i=0;num_i&lt;LED_MAX;num_i++){ <br />&nbsp; cli();<br />&nbsp; for(int ii=7;ii&gt;=0;ii--){bit_w((rr[num_i]*brig*r_led &amp; (1&lt;&lt;ii))&gt;&gt;ii);}<br />&nbsp; for(int ii=7;ii&gt;=0;ii--){bit_w((rr[num_i]*brig*g_led &amp; (1&lt;&lt;ii))&gt;&gt;ii);}&nbsp; <br />&nbsp; for(int ii=7;ii&gt;=0;ii--){bit_w((rr[num_i]*brig*b_led &amp; (1&lt;&lt;ii))&gt;&gt;ii);} <br />&nbsp; sei(); <br />}}<br />&nbsp; &nbsp; </p><br /><p>bool i2c_read_bit() {<br />&nbsp; &nbsp; bool i2c_bit = 1;&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; DDRD &amp;= ~(1 &lt;&lt; SDA);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; _delay_us(10); <br />&nbsp; &nbsp; DDRD &amp;= ~(1 &lt;&lt; SCL);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; if((PIND &gt;&gt; SDA) &amp; 1) i2c_bit=0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; _delay_us(10);&nbsp; <br />&nbsp; &nbsp; DDRD |= (1 &lt;&lt; SCL);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; return i2c_bit;&nbsp; <br />}</p><p>byte i2c_write_byte(byte data){<br />&nbsp; &nbsp; for (byte i=0; i&lt;8; i++){i2c_write_bit((data&amp;0x80)==0);data&lt;&lt;=1;}&nbsp; &nbsp; <br />&nbsp; &nbsp; return i2c_read_bit(); <br />}</p><p>byte i2c_read_byte(byte a){<br />&nbsp; &nbsp; byte data=0;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; for(byte i=0; i&lt;8; i++){if (!i2c_read_bit()) data++;if(i!=7) data&lt;&lt;=1;}&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; i2c_write_bit(a);return data;&nbsp; <br />}</p><p>void i2c_write_bit(byte b){<br />&nbsp; &nbsp; _delay_us(5);<br />&nbsp; &nbsp; if(b){DDRD |= (1 &lt;&lt; SDA);}else{DDRD &amp;= ~(1 &lt;&lt; SDA);}<br />&nbsp; &nbsp; _delay_us(5);<br />&nbsp; &nbsp; DDRD &amp;= ~(1 &lt;&lt; SCL);&nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; _delay_us(10);<br />&nbsp; &nbsp; DDRD |= (1 &lt;&lt; SCL);<br />}</p><p>void i2c_start(){<br />&nbsp; &nbsp; &nbsp;_delay_us(10);&nbsp; <br />&nbsp; &nbsp; &nbsp;DDRD &amp;= ~(1 &lt;&lt; SDA); DDRD &amp;= ~(1 &lt;&lt; SCL); <br />&nbsp; &nbsp; &nbsp;_delay_us(10); <br />&nbsp; &nbsp; &nbsp;DDRD |= (1 &lt;&lt; SDA);&nbsp; PORTD &amp;= ~(1 &lt;&lt; SDA);<br />&nbsp; &nbsp; &nbsp;_delay_us(10); <br />&nbsp; &nbsp; &nbsp;DDRD |= (1 &lt;&lt; SCL);&nbsp; PORTD &amp;= ~(1 &lt;&lt; SCL);&nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp;_delay_us(10);<br />}</p><p>void i2c_stop()&nbsp; {<br />&nbsp; &nbsp; &nbsp;DDRD |= (1 &lt;&lt; SDA);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp;_delay_us(10);<br />&nbsp; &nbsp; &nbsp;DDRD &amp;= ~(1 &lt;&lt; SCL);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp;_delay_us(10); <br />&nbsp; &nbsp; &nbsp;DDRD &amp;= ~(1 &lt;&lt; SDA);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />}</p><p>byte ds_read(byte reg){<br />&nbsp; &nbsp; &nbsp;byte data = 0;<br />&nbsp; &nbsp; &nbsp;i2c_start();<br />&nbsp; &nbsp; &nbsp;i2c_write_byte(0b11010000);<br />&nbsp; &nbsp; &nbsp;i2c_write_byte(reg);<br />&nbsp; &nbsp; &nbsp;i2c_start(); <br />&nbsp; &nbsp; &nbsp;i2c_write_byte(0b11010001); <br />&nbsp; &nbsp; &nbsp;data = i2c_read_byte(0);<br />&nbsp; &nbsp; &nbsp;i2c_stop();<br />&nbsp; &nbsp; &nbsp;return data;<br />&nbsp; }</p><p>void ds_write(byte reg, byte data){<br />&nbsp; &nbsp; &nbsp;i2c_start();<br />&nbsp; &nbsp; &nbsp;i2c_write_byte(0b11010000);<br />&nbsp; &nbsp; &nbsp;i2c_write_byte(reg);<br />&nbsp; &nbsp; &nbsp;i2c_write_byte(data);<br />&nbsp; &nbsp; &nbsp;i2c_stop();<br />&nbsp; } </p><p>void set_time(byte years, byte days, byte monts, byte datas, byte hours ,byte minute, byte second){<br />&nbsp; &nbsp; if(second &lt; 255){ds_write(0x00,(second/10&lt;&lt;4)+second%10);}<br />&nbsp; &nbsp; if(minute &lt; 255){ds_write(0x01,(minute/10&lt;&lt;4)+minute%10);} <br />&nbsp; &nbsp; if(hours &lt; 255){ds_write(0x02,(hours/10&lt;&lt;4)+hours%10);}<br />&nbsp; &nbsp; if(days &lt; 255){ds_write(0x03,days);}<br />&nbsp; &nbsp; if(datas &lt; 255){ds_write(0x04,(datas/10&lt;&lt;4)+datas%10);}<br />&nbsp; &nbsp; if(monts &lt; 255){ds_write(0x05,(monts/10&lt;&lt;4)+monts%10);}<br />&nbsp; &nbsp; if(years &lt; 255)ds_write(0x06,(years/10&lt;&lt;4)+years%10);<br />&nbsp; }&nbsp; </p><p>unsigned char EEPROM_read(unsigned int uiAddress){<br />&nbsp; while(EECR &amp; (1&lt;&lt;EEPE));&nbsp; // проверка готовности EEPROM <br />&nbsp; &nbsp; EEAR = uiAddress; // регистр адреса<br />&nbsp; &nbsp; EECR |= (1&lt;&lt;EERE);// чтение EEPROM<br />&nbsp; &nbsp; return EEDR; // вывод значения<br />}</p><p>void EEPROM_write(unsigned int uiAddress, unsigned char ucData){<br />&nbsp; while(EECR &amp; (1&lt;&lt;EEPE)); // проверка готовности EEPROM <br />&nbsp; &nbsp; &nbsp; EEAR = uiAddress; // регистр адреса<br />&nbsp; &nbsp; &nbsp; EEDR = ucData; // регистр данных <br />&nbsp; &nbsp; &nbsp; EECR |= (1&lt;&lt;EEMPE);// Разрешение записи в EEPROM<br />&nbsp; &nbsp; &nbsp; EECR |= (1&lt;&lt;EEPE); // Запись в EEPROM<br />}</p>]]></description>
			<author><![CDATA[null@example.com (Vasiliy67)]]></author>
			<pubDate>Sun, 22 Feb 2026 05:12:17 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=12518#p12518</guid>
		</item>
		<item>
			<title><![CDATA[Re: Часы на адресной светодиодной ленте WS2812B (ATtiny2313)]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=12517#p12517</link>
			<description><![CDATA[<p>У меня нет возможности проверить скетч, на момент написания все работало. Попробуйте использовать версию платы 1.2.5 и версию ардуино иде 1.8.15 как было на момент написания скетча.</p><p><a href="http://rcl-radio.ru/?p=94074">http://rcl-radio.ru/?p=94074</a></p>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Sun, 22 Feb 2026 03:16:14 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=12517#p12517</guid>
		</item>
		<item>
			<title><![CDATA[Re: Часы на адресной светодиодной ленте WS2812B (ATtiny2313)]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=12516#p12516</link>
			<description><![CDATA[<p><span class="postimg"><img src="http://forum.rcl-radio.ru/uploads/images/2026/02/80a23d430e4f01cc0b98560745241cf0.jpg" alt="http://forum.rcl-radio.ru/uploads/images/2026/02/80a23d430e4f01cc0b98560745241cf0.jpg" /></span></p>]]></description>
			<author><![CDATA[null@example.com (Vasiliy67)]]></author>
			<pubDate>Sat, 21 Feb 2026 16:42:45 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=12516#p12516</guid>
		</item>
		<item>
			<title><![CDATA[Re: Часы на адресной светодиодной ленте WS2812B (ATtiny2313)]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=12515#p12515</link>
			<description><![CDATA[<p>Добрый день! нет ли ошибки в прошивке или скетче? Часы на ATtiny2313 не работают!!! На Arduino все прекрасно!</p>]]></description>
			<author><![CDATA[null@example.com (Vasiliy67)]]></author>
			<pubDate>Sat, 21 Feb 2026 16:37:42 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=12515#p12515</guid>
		</item>
		<item>
			<title><![CDATA[Re: Часы на адресной светодиодной ленте WS2812B (ATtiny2313)]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=6135#p6135</link>
			<description><![CDATA[<p>Для термометра места не хватает ,если только 2313 заменить на тини 85,а порты ввода и вывода кнопок сделать на mcp23017 либо часы загрузить через ардуино и без кнопок,ставил DHT11 и DHT22 полное дерьмо врут, лучше и можно сказать из них ведёт себя отлично AHT10,работает по шине I2C параллельно часам,вот тогда можно сделать три кнопки ,предварительно заблокировав RST</p>]]></description>
			<author><![CDATA[null@example.com (sashok58)]]></author>
			<pubDate>Wed, 25 May 2022 12:57:15 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=6135#p6135</guid>
		</item>
		<item>
			<title><![CDATA[Re: Часы на адресной светодиодной ленте WS2812B (ATtiny2313)]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=5189#p5189</link>
			<description><![CDATA[<p>Термометр только в проекте для Arduino Nano - <a href="http://forum.rcl-radio.ru/viewtopic.php?pid=5003#p5003">http://forum.rcl-radio.ru/viewtopic.php?pid=5003#p5003</a></p>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Fri, 14 Jan 2022 15:41:25 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=5189#p5189</guid>
		</item>
		<item>
			<title><![CDATA[Re: Часы на адресной светодиодной ленте WS2812B (ATtiny2313)]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=5188#p5188</link>
			<description><![CDATA[<p>Видео есть? Термометр можно добавить?</p>]]></description>
			<author><![CDATA[null@example.com (Djonny 2022)]]></author>
			<pubDate>Fri, 14 Jan 2022 15:39:25 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=5188#p5188</guid>
		</item>
		<item>
			<title><![CDATA[Re: Часы на адресной светодиодной ленте WS2812B (ATtiny2313)]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=5187#p5187</link>
			<description><![CDATA[<p><strong>ATtiny2313 20 MHz</strong></p><p><span class="attention-yellow"></span> </p><p><span class="postimg"><img src="http://forum.rcl-radio.ru/uploads/images/2022/01/5132f8fc8903f08087a07e5fe0ac28a1.png" alt="http://forum.rcl-radio.ru/uploads/images/2022/01/5132f8fc8903f08087a07e5fe0ac28a1.png" /></span></p>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Fri, 14 Jan 2022 11:38:54 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=5187#p5187</guid>
		</item>
		<item>
			<title><![CDATA[Часы на адресной светодиодной ленте WS2812B (ATtiny2313)]]></title>
			<link>http://forum.rcl-radio.ru/viewtopic.php?pid=5185#p5185</link>
			<description><![CDATA[<p><span class="postimg"><img src="http://forum.rcl-radio.ru/uploads/images/2022/01/ad4c99630f3094dcff3cdcc1bd339382.png" alt="http://forum.rcl-radio.ru/uploads/images/2022/01/ad4c99630f3094dcff3cdcc1bd339382.png" /></span> </p><br /><div class="codebox"><pre><code>// ATtiny2313 20MHz
#include &lt;avr/io.h&gt;
#include &lt;util/delay.h&gt;
#define L_BIT    PORTB &amp;= ~(1&lt;&lt;PB0)
#define H_BIT    PORTB |=  (1&lt;&lt;PB0) 
#define SDA      PD2  // PIN6
#define SCL      PD3  // PIN7
#define SQW      PD4  // PIN8
#define LED_MAX  88

  byte brig=1;
  bool r,g,b;
  bool rr[LED_MAX];
  byte hh,mm,hour,min;
  byte r_led=0,g_led=1,b_led=0;
  byte mode;
  bool sett,w,w1;
  
 
int main(void){
  DDRB |= (1&lt;&lt;PB0); // PIN12 WS2812B 
  DDRB &amp;= ~(1&lt;&lt;PB1);// PIN13 BUTTON MODE
  DDRB &amp;= ~(1&lt;&lt;PB2);// PIN14 BUTTON UP
  DDRB &amp;= ~(1&lt;&lt;PB3);// PIN15 BUTTON DOWN
  DDRB &amp;= ~(1&lt;&lt;PB4);// PIN16 BUTTON SET
  PORTB |= (1&lt;&lt;PB1)|(1&lt;&lt;PB2)|(1&lt;&lt;PB3)|(1&lt;&lt;PB4);
  _delay_ms(100);
  if(EEPROM_read(100)!=1){for(int i1=0;i1&lt;101;i1++){EEPROM_write(i1,1);}}// очистка памяти при первом включении 
  mode = EEPROM_read(0);brig = EEPROM_read(1);
//  set_time(21,3,3,9,21,52,0);// год 00-99, ДН 1-7 (1=ВС), месяц 1-12, дата 1-31, час 0-23, минуты 0-59, секунды 0-59

 
while(1){
   min =  (ds_read(1) &amp; 0x0F) + (((ds_read(1) &amp; 0x70) &gt;&gt; 4) * 10);
   hour = ((ds_read(2) &amp; 0x0F) + ((ds_read(2) &amp; 0x70) &gt;&gt; 4) * 10);
/////// BUTTON ///////////////////////////////////////////////
  if(((PINB &gt;&gt; PB1) &amp; 1) == 0){mode++;if(mode&gt;6){mode=0;}_delay_ms(300);w=1;}
  switch(mode){
    case 0: r_led=1,g_led=1,b_led=1; break;
    case 1: r_led=1,g_led=0,b_led=0; break;
    case 2: r_led=0,g_led=1,b_led=0; break;
    case 3: r_led=0,g_led=0,b_led=1; break;
    case 4: r_led=1,g_led=1,b_led=0; break;
    case 5: r_led=1,g_led=0,b_led=1; break;
    case 6: r_led=0,g_led=1,b_led=1; break;
    }
   if(((PINB &gt;&gt; PB2) &amp; 1) == 0 &amp;&amp; sett==0){brig++;if(brig&gt;250){brig=250;}w=1;} 
   if(((PINB &gt;&gt; PB3) &amp; 1) == 0 &amp;&amp; sett==0){brig--;if(brig&lt;1){brig=1;}w=1;} 
   if(((PINB &gt;&gt; PB4) &amp; 1) == 0 &amp;&amp; sett==0){sett=1;_delay_ms(300);}
   if(((PINB &gt;&gt; PB4) &amp; 1) == 0 &amp;&amp; sett==1){sett=0;_delay_ms(300);}   


////////// RGB ////////////////////////////////////////////////
    indd(hour / 10, 0);
    indd(hour % 10, 21);
 
    if(((PIND &gt;&gt; SQW) &amp; 1) == 0 &amp;&amp; sett==0){data_led(42, 1);data_led(43, 1);data_led(44, 1);data_led(45, 1);}
      else{data_led(42, 0);data_led(43,0);data_led(44, 0);data_led(45, 0);}
 
    if(sett==1){data_led(42, 1);data_led(43, 1);data_led(44, 1);data_led(45, 1);}
  
    indd(min / 10, 46);
    indd(min % 10, 67);
          
    led_rgb();res();
    _delay_ms(100);

//////////// SET TIME ////////////////////////////////////////////////////////////////////// 
 if(sett==1){
  hh=hour;
  mm=min;
  if(((PINB &gt;&gt; PB2) &amp; 1) == 0){hh++;if(hh&gt;23){hh=0;}_delay_ms(100);w1=1;} 
  if(((PINB &gt;&gt; PB3) &amp; 1) == 0){mm++;if(mm&gt;59){mm=1;}_delay_ms(100);w1=1;} 
  if(w1==1){w1=0;set_time(21,1,12,26,hh,mm,0);}
  }   
 
////// EEPROM ///////////////////
 if(w==1){w=0;EEPROM_write(0,mode);EEPROM_write(1,brig);}  
}} // end loop

void indd(byte t, byte sdv){
    switch(t){   
    case 0: ws(0+sdv,1);ws(3+sdv,1);ws(6+sdv,1);ws(9+sdv,0);ws(12+sdv,1);ws(15+sdv,1);ws(18+sdv,1);break;
    case 1: ws(0+sdv,0);ws(3+sdv,0);ws(6+sdv,1);ws(9+sdv,0);ws(12+sdv,0);ws(15+sdv,0);ws(18+sdv,1);break;
    case 2: ws(0+sdv,0);ws(3+sdv,1);ws(6+sdv,1);ws(9+sdv,1);ws(12+sdv,1);ws(15+sdv,1);ws(18+sdv,0);break;
    case 3: ws(0+sdv,0);ws(3+sdv,1);ws(6+sdv,1);ws(9+sdv,1);ws(12+sdv,0);ws(15+sdv,1);ws(18+sdv,1);break;
    case 4: ws(0+sdv,1);ws(3+sdv,0);ws(6+sdv,1);ws(9+sdv,1);ws(12+sdv,0);ws(15+sdv,0);ws(18+sdv,1);break;
    case 5: ws(0+sdv,1);ws(3+sdv,1);ws(6+sdv,0);ws(9+sdv,1);ws(12+sdv,0);ws(15+sdv,1);ws(18+sdv,1);break;
    case 6: ws(0+sdv,1);ws(3+sdv,1);ws(6+sdv,0);ws(9+sdv,1);ws(12+sdv,1);ws(15+sdv,1);ws(18+sdv,1);break;
    case 7: ws(0+sdv,0);ws(3+sdv,1);ws(6+sdv,1);ws(9+sdv,0);ws(12+sdv,0);ws(15+sdv,0);ws(18+sdv,1);break;
    case 8: ws(0+sdv,1);ws(3+sdv,1);ws(6+sdv,1);ws(9+sdv,1);ws(12+sdv,1);ws(15+sdv,1);ws(18+sdv,1);break;
    case 9: ws(0+sdv,1);ws(3+sdv,1);ws(6+sdv,1);ws(9+sdv,1);ws(12+sdv,0);ws(15+sdv,1);ws(18+sdv,1);break;
    } 
  }

void ws(byte ind, bool datt){
  if(datt==1){data_led(ind, 1);data_led(ind+1, 1);data_led(ind+2, 1);}
  else{data_led(ind, 0);data_led(ind+1, 0);data_led(ind+2, 0);}}
 
void bit_0(){H_BIT;asm(&quot;nop&quot;);asm(&quot;nop&quot;);   L_BIT;asm(&quot;nop&quot;);asm(&quot;nop&quot;);asm(&quot;nop&quot;);   asm(&quot;nop&quot;);} 
void bit_1(){H_BIT;asm(&quot;nop&quot;);asm(&quot;nop&quot;);asm(&quot;nop&quot;);asm(&quot;nop&quot;);asm(&quot;nop&quot;);asm(&quot;nop&quot;);asm(&quot;nop&quot;);asm(&quot;nop&quot;);   L_BIT;}
void bit_w(bool x){if(x) bit_1(); else bit_0();}
void res(){_delay_us(100);}
void data_led(byte num, bool rrr){rr[num]=rrr;}
void led_rgb(){
  for(byte num_i=0;num_i&lt;LED_MAX;num_i++){ 
  cli();
  for(int ii=7;ii&gt;=0;ii--){bit_w((rr[num_i]*brig*r_led &amp; (1&lt;&lt;ii))&gt;&gt;ii);}
  for(int ii=7;ii&gt;=0;ii--){bit_w((rr[num_i]*brig*g_led &amp; (1&lt;&lt;ii))&gt;&gt;ii);}  
  for(int ii=7;ii&gt;=0;ii--){bit_w((rr[num_i]*brig*b_led &amp; (1&lt;&lt;ii))&gt;&gt;ii);} 
  sei(); 
}}
    
 

bool i2c_read_bit() {
    bool i2c_bit = 1;        
    DDRD &amp;= ~(1 &lt;&lt; SDA);            
    _delay_us(10); 
    DDRD &amp;= ~(1 &lt;&lt; SCL);                
    if((PIND &gt;&gt; SDA) &amp; 1) i2c_bit=0;                            
    _delay_us(10);  
    DDRD |= (1 &lt;&lt; SCL);              
    return i2c_bit;  
}
 
byte i2c_write_byte(byte data){
    for (byte i=0; i&lt;8; i++){i2c_write_bit((data&amp;0x80)==0);data&lt;&lt;=1;}    
    return i2c_read_bit(); 
}
 
byte i2c_read_byte(byte a){
    byte data=0;                
    for(byte i=0; i&lt;8; i++){if (!i2c_read_bit()) data++;if(i!=7) data&lt;&lt;=1;}        
    i2c_write_bit(a);return data;  
}
 
void i2c_write_bit(byte b){
    _delay_us(5);
    if(b){DDRD |= (1 &lt;&lt; SDA);}else{DDRD &amp;= ~(1 &lt;&lt; SDA);}
    _delay_us(5);
    DDRD &amp;= ~(1 &lt;&lt; SCL);       
    _delay_us(10);
    DDRD |= (1 &lt;&lt; SCL);
}
 
void i2c_start(){
     _delay_us(10);  
     DDRD &amp;= ~(1 &lt;&lt; SDA); DDRD &amp;= ~(1 &lt;&lt; SCL); 
     _delay_us(10); 
     DDRD |= (1 &lt;&lt; SDA);  PORTD &amp;= ~(1 &lt;&lt; SDA);
     _delay_us(10); 
     DDRD |= (1 &lt;&lt; SCL);  PORTD &amp;= ~(1 &lt;&lt; SCL);   
     _delay_us(10);
}
 
void i2c_stop()  {
     DDRD |= (1 &lt;&lt; SDA);            
     _delay_us(10);
     DDRD &amp;= ~(1 &lt;&lt; SCL);               
     _delay_us(10); 
     DDRD &amp;= ~(1 &lt;&lt; SDA);             
}
 
byte ds_read(byte reg){
     byte data = 0;
     i2c_start();
     i2c_write_byte(0b11010000);
     i2c_write_byte(reg);
     i2c_start(); 
     i2c_write_byte(0b11010001); 
     data = i2c_read_byte(0);
     i2c_stop();
     return data;
  }
 
void ds_write(byte reg, byte data){
     i2c_start();
     i2c_write_byte(0b11010000);
     i2c_write_byte(reg);
     i2c_write_byte(data);
     i2c_stop();
  } 

void set_time(byte years, byte days, byte monts, byte datas, byte hours ,byte minute, byte second){
    if(second &lt; 255){ds_write(0x00,(second/10&lt;&lt;4)+second%10);}
    if(minute &lt; 255){ds_write(0x01,(minute/10&lt;&lt;4)+minute%10);} 
    if(hours &lt; 255){ds_write(0x02,(hours/10&lt;&lt;4)+hours%10);}
    if(days &lt; 255){ds_write(0x03,days);}
    if(datas &lt; 255){ds_write(0x04,(datas/10&lt;&lt;4)+datas%10);}
    if(monts &lt; 255){ds_write(0x05,(monts/10&lt;&lt;4)+monts%10);}
    if(years &lt; 255)ds_write(0x06,(years/10&lt;&lt;4)+years%10);
  }  

unsigned char EEPROM_read(unsigned int uiAddress){
  while(EECR &amp; (1&lt;&lt;EEPE));  // проверка готовности EEPROM 
    EEAR = uiAddress; // регистр адреса
    EECR |= (1&lt;&lt;EERE);// чтение EEPROM
    return EEDR; // вывод значения
}
 
void EEPROM_write(unsigned int uiAddress, unsigned char ucData){
  while(EECR &amp; (1&lt;&lt;EEPE)); // проверка готовности EEPROM 
      EEAR = uiAddress; // регистр адреса
      EEDR = ucData; // регистр данных 
      EECR |= (1&lt;&lt;EEMPE);// Разрешение записи в EEPROM
      EECR |= (1&lt;&lt;EEPE); // Запись в EEPROM
}      </code></pre></div><div class="quotebox"><blockquote><p>Скетч использует 1926 байт (94%) памяти устройства. Всего доступно 2048 байт.<br />Глобальные переменные используют 100 байт (78%) динамической памяти, оставляя 28 байт для локальных переменных. Максимум: 128 байт.</p></blockquote></div>]]></description>
			<author><![CDATA[null@example.com (liman324)]]></author>
			<pubDate>Fri, 14 Jan 2022 00:30:15 +0000</pubDate>
			<guid>http://forum.rcl-radio.ru/viewtopic.php?pid=5185#p5185</guid>
		</item>
	</channel>
</rss>
