<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[forum.rcl-radio.ru &mdash; w2812]]></title>
	<link rel="self" href="http://forum.rcl-radio.ru/extern.php?action=feed&amp;tid=287&amp;type=atom" />
	<updated>2021-03-17T16:39:53Z</updated>
	<generator>PunBB</generator>
	<id>http://forum.rcl-radio.ru/viewtopic.php?id=287</id>
		<entry>
			<title type="html"><![CDATA[Re: w2812]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=3297#p3297" />
			<content type="html"><![CDATA[<p>#define L_BIT&nbsp; &nbsp; PORTB &amp;= ~(1&lt;&lt;0)<br />#define H_BIT&nbsp; &nbsp; PORTB |=&nbsp; (1&lt;&lt;0)&nbsp; &nbsp; <br />#define LED_MAX&nbsp; 4</p><p>unsigned long data, dat[LED_MAX];</p><p>void setup(){<br />&nbsp; &nbsp;DDRB |= (1&lt;&lt;0);<br />}</p><p>void loop(){<br />&nbsp; &nbsp;for(int i1=0;i1&lt;LED_MAX;i1++){<br />&nbsp; for(int i=0;i&lt;50;i++){<br />&nbsp; &nbsp;<br />&nbsp; data_led(i1,&nbsp; 50,50-i1*3,50-i);<br />&nbsp; led_rgb();res();<br />&nbsp; delay(10);<br />&nbsp; }}</p><p>&nbsp; for(int i1=0;i1&lt;LED_MAX;i1++){<br />&nbsp; data_led(i1,0,0,0);<br />&nbsp; led_rgb();res();<br />&nbsp; delay(500);<br />&nbsp; }<br />}</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(){delayMicroseconds(100);}</p><p>void data_led(int num, long rrr, int ggg, byte bbb){<br />&nbsp; data = ((rrr &lt;&lt; 16) &amp; 0xFF0000) + ((ggg &lt;&lt; 8) &amp; 0xFF00) + bbb;<br />&nbsp; dat[num] = data;<br />&nbsp; }</p><p>void led_rgb(){<br />&nbsp; for(int num_i=0;num_i&lt;LED_MAX;num_i++){data=dat[num_i];<br />&nbsp; cli();<br />bit_w(data &amp; 0x80);<br />bit_w(data &amp; 0x40);<br />bit_w(data &amp; 0x20);<br />bit_w(data &amp; 0x10);<br />bit_w(data &amp; 0x08);<br />bit_w(data &amp; 0x04);<br />bit_w(data &amp; 0x02);<br />bit_w(data &amp; 0x01);<br />bit_w(data &amp; 0x800000);<br />bit_w(data &amp; 0x400000);<br />bit_w(data &amp; 0x200000);<br />bit_w(data &amp; 0x100000);<br />bit_w(data &amp; 0x080000);<br />bit_w(data &amp; 0x040000);<br />bit_w(data &amp; 0x020000);<br />bit_w(data &amp; 0x010000);&nbsp; <br />bit_w(data &amp; 0x8000);&nbsp; &nbsp; <br />bit_w(data &amp; 0x4000);&nbsp; &nbsp; <br />bit_w(data &amp; 0x2000);&nbsp; &nbsp; <br />bit_w(data &amp; 0x1000);&nbsp; &nbsp; <br />bit_w(data &amp; 0x0800);&nbsp; &nbsp; <br />bit_w(data &amp; 0x0400);&nbsp; &nbsp; <br />bit_w(data &amp; 0x0200);&nbsp; &nbsp; <br />bit_w(data &amp; 0x0100); <br />&nbsp; &nbsp;sei(); <br />delayMicroseconds(10);<br />}}</p>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2021-03-17T16:39:53Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=3297#p3297</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: w2812]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=3296#p3296" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>#define L_BIT    PORTB &amp;= ~(1&lt;&lt;0)
#define H_BIT    PORTB |=  (1&lt;&lt;0)    
#define LED_MAX  4

byte times;
int i=0;
unsigned long data;
unsigned long dat[LED_MAX];

void setup(){
   DDRB |= (1&lt;&lt;0);
}

void loop(){
   
res();
  for(int i1=0; i&lt;LED_MAX; i++)
  for(int i=0; i&lt;LED_MAX; i++) {
  
  if(i%2==1)data_led(i,50,0,0);
  else data_led(i,0,0,50);
  led();
  delay(500);
  }
  }

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(){delayMicroseconds(100);}

void data_led(int num, long rrr, int ggg, byte bbb){
  data = ((rrr &lt;&lt; 16) &amp; 0xFF0000) + ((ggg &lt;&lt; 8) &amp; 0xFF00) + bbb;
  dat[num] = data;
  return dat[num];
  }

void led(){
  for(i=0;i&lt;LED_MAX;i++){data=dat[i];
  cli();
bit_w(data  &amp; 0b100000000000000000000000);
bit_w(data  &amp; 0b010000000000000000000000);
bit_w(data  &amp; 0b001000000000000000000000);
bit_w(data  &amp; 0b000100000000000000000000);
bit_w(data  &amp; 0b000010000000000000000000);
bit_w(data  &amp; 0b000001000000000000000000);
bit_w(data  &amp; 0b000000100000000000000000);
bit_w(data  &amp; 0b000000010000000000000000);

bit_w(data  &amp; 0b000000000000000010000000);
bit_w(data  &amp; 0b000000000000000001000000);
bit_w(data  &amp; 0b000000000000000000100000);
bit_w(data  &amp; 0b000000000000000000010000);
bit_w(data  &amp; 0b000000000000000000001000);
bit_w(data  &amp; 0b000000000000000000000100);
bit_w(data  &amp; 0b000000000000000000000010);
bit_w(data  &amp; 0b000000000000000000000001);  
    
bit_w(data  &amp; 0b000000001000000000000000);    
bit_w(data  &amp; 0b000000000100000000000000);    
bit_w(data  &amp; 0b000000000010000000000000);    
bit_w(data  &amp; 0b000000000001000000000000);    
bit_w(data  &amp; 0b000000000000100000000000);    
bit_w(data  &amp; 0b000000000000010000000000);    
bit_w(data  &amp; 0b000000000000001000000000);    
bit_w(data  &amp; 0b000000000000000100000000);    
   sei(); 
delayMicroseconds(10);
  }
  }</code></pre></div>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2021-03-17T14:37:23Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=3296#p3296</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: w2812]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=3295#p3295" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>#define L_BIT    PORTB &amp;= ~(1&lt;&lt;0)
#define H_BIT    PORTB |=  (1&lt;&lt;0)    

byte times;
int i=0;

void setup(){
   DDRB |= (1&lt;&lt;0);
}

void loop(){ 
  

    led(10, 0, 0);
     led(0, 10, 0);
      led(0, 0, 10);
       led(10, 0, 0);
    res();
  delay(500);

  }

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(){delayMicroseconds(100);}

void led(long rrr, int ggg, byte bbb){
  unsigned long data = ((rrr &lt;&lt; 16) &amp; 0xFF0000) + ((ggg &lt;&lt; 8) &amp; 0xFF00) + bbb;
  cli();
bit_w(data  &amp; 0b100000000000000000000000);
bit_w(data  &amp; 0b010000000000000000000000);
bit_w(data  &amp; 0b001000000000000000000000);
bit_w(data  &amp; 0b000100000000000000000000);
bit_w(data  &amp; 0b000010000000000000000000);
bit_w(data  &amp; 0b000001000000000000000000);
bit_w(data  &amp; 0b000000100000000000000000);
bit_w(data  &amp; 0b000000010000000000000000);

bit_w(data  &amp; 0b000000000000000010000000);
bit_w(data  &amp; 0b000000000000000001000000);
bit_w(data  &amp; 0b000000000000000000100000);
bit_w(data  &amp; 0b000000000000000000010000);
bit_w(data  &amp; 0b000000000000000000001000);
bit_w(data  &amp; 0b000000000000000000000100);
bit_w(data  &amp; 0b000000000000000000000010);
bit_w(data  &amp; 0b000000000000000000000001);  
    
bit_w(data  &amp; 0b000000001000000000000000);    
bit_w(data  &amp; 0b000000000100000000000000);    
bit_w(data  &amp; 0b000000000010000000000000);    
bit_w(data  &amp; 0b000000000001000000000000);    
bit_w(data  &amp; 0b000000000000100000000000);    
bit_w(data  &amp; 0b000000000000010000000000);    
bit_w(data  &amp; 0b000000000000001000000000);    
bit_w(data  &amp; 0b000000000000000100000000);    
   sei(); 
delayMicroseconds(10);
  
  }</code></pre></div>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2021-03-17T13:34:27Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=3295#p3295</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: w2812]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=3294#p3294" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>#define L_BIT    PORTB &amp;= ~(1&lt;&lt;0)
#define H_BIT    PORTB |=  (1&lt;&lt;0)    

byte times;


void setup(){
   DDRB |= (1&lt;&lt;0);
   delayMicroseconds(1000); 

}

void loop(){ 
   if(times&gt;254){times=0;}
   led(255,0,0);
   led(0,255,0);
   led(0,0,255);
   led(255-times,255-times,50);
   delayMicroseconds(100);
   times++;
   delay(10);
  }

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 led(byte rrr, byte ggg, byte bbb){
  unsigned long data = ((rrr &lt;&lt; 8) &amp; 0xFF0000) | ((ggg &lt;&lt; 8) &amp; 0xFF00) | bbb;
  cli();
bit_w(data  &amp; 0b100000000000000000000000);
bit_w(data  &amp; 0b010000000000000000000000);
bit_w(data  &amp; 0b001000000000000000000000);
bit_w(data  &amp; 0b000100000000000000000000);
bit_w(data  &amp; 0b000010000000000000000000);
bit_w(data  &amp; 0b000001000000000000000000);
bit_w(data  &amp; 0b000000100000000000000000);
bit_w(data  &amp; 0b000000010000000000000000);

bit_w(data  &amp; 0b000000000000000010000000);
bit_w(data  &amp; 0b000000000000000001000000);
bit_w(data  &amp; 0b000000000000000000100000);
bit_w(data  &amp; 0b000000000000000000010000);
bit_w(data  &amp; 0b000000000000000000001000);
bit_w(data  &amp; 0b000000000000000000000100);
bit_w(data  &amp; 0b000000000000000000000010);
bit_w(data  &amp; 0b000000000000000000000001);  
    
bit_w(data  &amp; 0b000000001000000000000000);    
bit_w(data  &amp; 0b000000000100000000000000);    
bit_w(data  &amp; 0b000000000010000000000000);    
bit_w(data  &amp; 0b000000000001000000000000);    
bit_w(data  &amp; 0b000000000000100000000000);    
bit_w(data  &amp; 0b000000000000010000000000);    
bit_w(data  &amp; 0b000000000000001000000000);    
bit_w(data  &amp; 0b000000000000000100000000);    
   sei(); 
delayMicroseconds(10);
  }</code></pre></div>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2021-03-17T09:28:11Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=3294#p3294</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[w2812]]></title>
			<link rel="alternate" href="http://forum.rcl-radio.ru/viewtopic.php?pid=3289#p3289" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>#define L_BIT    PORTB &amp;= ~(1&lt;&lt;0)
#define H_BIT    PORTB |=  (1&lt;&lt;0)    

byte times;


void setup(){
   DDRB |= (1&lt;&lt;0);

   delayMicroseconds(1000); 

}

void loop(){ 
   if(times&gt;254){times=0;}
   led(0x000000+times);
   led(0x000000);
   led(0x010000);
   led(0x000100);
   delayMicroseconds(100);
   times++;
   delay(10);
  }

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 led(unsigned long data){
  cli();
bit_w(data  &amp; 0b100000000000000000000000);
bit_w(data  &amp; 0b010000000000000000000000);
bit_w(data  &amp; 0b001000000000000000000000);
bit_w(data  &amp; 0b000100000000000000000000);
bit_w(data  &amp; 0b000010000000000000000000);
bit_w(data  &amp; 0b000001000000000000000000);
bit_w(data  &amp; 0b000000100000000000000000);
bit_w(data  &amp; 0b000000010000000000000000);

bit_w(data  &amp; 0b000000000000000010000000);
bit_w(data  &amp; 0b000000000000000001000000);
bit_w(data  &amp; 0b000000000000000000100000);
bit_w(data  &amp; 0b000000000000000000010000);
bit_w(data  &amp; 0b000000000000000000001000);
bit_w(data  &amp; 0b000000000000000000000100);
bit_w(data  &amp; 0b000000000000000000000010);
bit_w(data  &amp; 0b000000000000000000000001);  
    
bit_w(data  &amp; 0b000000001000000000000000);    
bit_w(data  &amp; 0b000000000100000000000000);    
bit_w(data  &amp; 0b000000000010000000000000);    
bit_w(data  &amp; 0b000000000001000000000000);    
bit_w(data  &amp; 0b000000000000100000000000);    
bit_w(data  &amp; 0b000000000000010000000000);    
bit_w(data  &amp; 0b000000000000001000000000);    
bit_w(data  &amp; 0b000000000000000100000000);    
   sei(); 
delayMicroseconds(20);
  }</code></pre></div>]]></content>
			<author>
				<name><![CDATA[liman324]]></name>
				<uri>http://forum.rcl-radio.ru/profile.php?id=2</uri>
			</author>
			<updated>2021-03-15T18:07:24Z</updated>
			<id>http://forum.rcl-radio.ru/viewtopic.php?pid=3289#p3289</id>
		</entry>
</feed>
