<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://bitwizard.nl/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Cartridge1987</id>
	<title>BitWizard Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://bitwizard.nl/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Cartridge1987"/>
	<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php/Special:Contributions/Cartridge1987"/>
	<updated>2026-04-05T18:32:17Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.6</generator>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_26&amp;diff=4006</id>
		<title>Blog 26</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_26&amp;diff=4006"/>
		<updated>2016-02-09T10:55:34Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*[http://www.bitwizard.nl/shop/expansion-boards/relay SPI Relay] | [[SPI Relay]]&lt;br /&gt;
*[http://www.bitwizard.nl/shop/raspberry-pi-ui-20x4 User interface 20x4] | [[User Interface]]&lt;br /&gt;
*Two [http://bitwizard.nl/shop/cables-connectors/6-pin-idc-cable-30cm IDC Cables, 6 Pin (SPI)] &lt;br /&gt;
&lt;br /&gt;
Hello, &lt;br /&gt;
&lt;br /&gt;
In this project I worked on the arduino. I made an pulse controller. With that you can control the amount of pulses and the pulse time of the relay. &lt;br /&gt;
Link to the code: [http://bitwizard.nl/source/Pulsecontroller.ino click here]&lt;br /&gt;
&lt;br /&gt;
I made this script building on the [http://www.bitwizard.nl/software/ardemo_lcd.pde arduino spi demo script]. The parts I am going to explain are only for my script part. &lt;br /&gt;
&lt;br /&gt;
In the script itself I also added some explanation. &lt;br /&gt;
&lt;br /&gt;
Setup part:&lt;br /&gt;
&lt;br /&gt;
 //int offms = 500;&lt;br /&gt;
 int OnTime = 500;&lt;br /&gt;
 unsigned int s = 0;&lt;br /&gt;
 int pulses = 1; &lt;br /&gt;
 int PulseTime = 500; &lt;br /&gt;
&lt;br /&gt;
  set_var (0x8e, 0x10, 0x00);&lt;br /&gt;
  PulsPrint(pulses);&lt;br /&gt;
  TimePrint(PulseTime);&lt;br /&gt;
&lt;br /&gt;
  char bufline2[32];&lt;br /&gt;
  char bufline4[32];&lt;br /&gt;
  &lt;br /&gt;
  sprintf(bufline2, &amp;quot;1=down |2=up |5=res&amp;quot;, bufline2);    &lt;br /&gt;
  write_at_lcd (0, 1, bufline2);&lt;br /&gt;
  &lt;br /&gt;
  delay(10);&lt;br /&gt;
  sprintf(bufline4, &amp;quot;3=down |4=up |6=run&amp;quot;, bufline4);    &lt;br /&gt;
  write_at_lcd (0, 3, bufline4);&lt;br /&gt;
  &lt;br /&gt;
  Serial.write (bufline2);&lt;br /&gt;
  Serial.write (&amp;quot;\r\n&amp;quot;);&lt;br /&gt;
  Serial.write (bufline4);&lt;br /&gt;
  Serial.write (&amp;quot;\r\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
loop part: &lt;br /&gt;
   // read the buttons:&lt;br /&gt;
  int Button = get_var (0x94, 0x31);&lt;br /&gt;
  // print out the state of the buttons:&lt;br /&gt;
  Serial.println(Button);&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
  //Button 6&lt;br /&gt;
  //runs the pulses with the given pulse time to the relay&lt;br /&gt;
  if (Button == 1){&lt;br /&gt;
       Pulsing(pulses);          &lt;br /&gt;
       get_var (0x94, 0x31);&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  // Button 5 &lt;br /&gt;
  // reset the pulses and time back to the start settings&lt;br /&gt;
  if (Button == 2){&lt;br /&gt;
    PulseTime = 500;&lt;br /&gt;
    pulses = 1;    &lt;br /&gt;
    TimePrint(PulseTime);&lt;br /&gt;
    PulsPrint(pulses);&lt;br /&gt;
    delay(OnTime);&lt;br /&gt;
    get_var (0x94, 0x31);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  // button 4 &lt;br /&gt;
  // +0.1 second to the previous amount of time&lt;br /&gt;
  // the maximum amount of seconds is 10&lt;br /&gt;
  if (Button == 4){&lt;br /&gt;
    PulseTime = PulseTime + 100; &lt;br /&gt;
    if ( PulseTime &amp;gt; 10000) PulseTime = 10000; &lt;br /&gt;
    TimePrint(PulseTime);&lt;br /&gt;
    delay(OnTime);&lt;br /&gt;
    get_var (0x94, 0x31);&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  // button 3 &lt;br /&gt;
  // -0.1second to the previous amount of time&lt;br /&gt;
  // The minimum amount of seconds is 0.1. &lt;br /&gt;
  if (Button == 8){&lt;br /&gt;
    PulseTime = PulseTime - 100;&lt;br /&gt;
    if ( PulseTime &amp;lt; 100) PulseTime = 100; &lt;br /&gt;
    TimePrint(PulseTime);&lt;br /&gt;
    delay(OnTime);&lt;br /&gt;
    get_var (0x94, 0x31);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  // button 2 &lt;br /&gt;
  // +1 to the previous value pulses  &lt;br /&gt;
  // the maximum amount of pulses is 99&lt;br /&gt;
  if (Button == 16){&lt;br /&gt;
    pulses = pulses +1;&lt;br /&gt;
    if ( pulses &amp;gt; 99) pulses = 99; &lt;br /&gt;
    PulsPrint(pulses);&lt;br /&gt;
    delay(OnTime);&lt;br /&gt;
    get_var (0x94, 0x31);&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  // button 1 &lt;br /&gt;
  // -1 to the previous value pulses  &lt;br /&gt;
  // the minimum value is 1&lt;br /&gt;
  if (Button == 32){&lt;br /&gt;
    pulses = pulses - 1;&lt;br /&gt;
    if ( pulses &amp;lt; 1) pulses = 1; &lt;br /&gt;
    PulsPrint(pulses);&lt;br /&gt;
    delay(OnTime);&lt;br /&gt;
    get_var (0x94, 0x31);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  delay(20);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
functions: &lt;br /&gt;
&lt;br /&gt;
 //function that shows the amount of pulses on the display&lt;br /&gt;
 void PulsPrint(int Puls){&lt;br /&gt;
  char buf[32];&lt;br /&gt;
  sprintf (buf, &amp;quot;Pulses: %02d&amp;quot;, Puls);&lt;br /&gt;
  write_at_lcd (0, 0, buf);&lt;br /&gt;
  Serial.write (buf);&lt;br /&gt;
  Serial.write (&amp;quot;\r\n&amp;quot;); &lt;br /&gt;
 }&lt;br /&gt;
 // function that shows the pulsetime on the display&lt;br /&gt;
 void TimePrint(int Time){&lt;br /&gt;
  float FloatTime = Time;&lt;br /&gt;
  FloatTime = FloatTime/1000;&lt;br /&gt;
  &lt;br /&gt;
  delay(10);&lt;br /&gt;
  char TextBuf[32];&lt;br /&gt;
  char buf[32];&lt;br /&gt;
&lt;br /&gt;
  sprintf(TextBuf, &amp;quot;Time:      seconds&amp;quot;, buf);    &lt;br /&gt;
  write_at_lcd (0, 2, TextBuf);&lt;br /&gt;
  &lt;br /&gt;
  dtostrf (FloatTime,3, 1, buf);&lt;br /&gt;
  write_at_lcd (7, 2, buf);&lt;br /&gt;
&lt;br /&gt;
  Serial.write (TextBuf);&lt;br /&gt;
  Serial.write (buf);&lt;br /&gt;
  Serial.write (&amp;quot;\r\n&amp;quot;);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 // function that will run the given pulses and pulsetime&lt;br /&gt;
 void Pulsing(int Puls){&lt;br /&gt;
 int PulsHalf = PulseTime / 2;&lt;br /&gt;
  for (int count = 0; pulses &amp;gt; count; count++){ &lt;br /&gt;
        set_var (0x8e, 0x20, 0x01);&lt;br /&gt;
        delay(PulsHalf);&lt;br /&gt;
        set_var (0x8e, 0x20, 0x00);      &lt;br /&gt;
        delay(PulsHalf);&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[DIO protocol]] - The SPI relay has the same protocol&lt;br /&gt;
*[[User Interface]]&lt;br /&gt;
*[http://www.bitwizard.nl/software/ardemo_lcd.pde arduino spi demo script] - My script uses the basics of that script.&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_26&amp;diff=4005</id>
		<title>Blog 26</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_26&amp;diff=4005"/>
		<updated>2016-02-04T07:58:12Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* Useful links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*[http://www.bitwizard.nl/shop/expansion-boards/relay SPI Relay] | [[SPI Relay]]&lt;br /&gt;
*[http://www.bitwizard.nl/shop/raspberry-pi-ui-20x4 User interface 20x4] | [[User Interface]]&lt;br /&gt;
*Two [http://bitwizard.nl/shop/cables-connectors/6-pin-idc-cable-30cm IDC Cables, 6 Pin (SPI)] &lt;br /&gt;
&lt;br /&gt;
Hello, &lt;br /&gt;
&lt;br /&gt;
In this project I worked on the arduino. I made an pulse controller. With that you can control the amount of pulses and the pulse time of the relay. &lt;br /&gt;
Link to the code: [http://bitwizard.nl/source/Pulsecontroller.ino click here]&lt;br /&gt;
&lt;br /&gt;
I made this script building on the [http://www.bitwizard.nl/software/ardemo_lcd.pde arduino spi demo script]. The parts I am going to explain are only for my script part. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[DIO protocol]] - The SPI relay has the same protocol&lt;br /&gt;
*[[User Interface]]&lt;br /&gt;
*[http://www.bitwizard.nl/software/ardemo_lcd.pde arduino spi demo script] - My script uses the basics of that script.&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_26&amp;diff=4004</id>
		<title>Blog 26</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_26&amp;diff=4004"/>
		<updated>2016-02-04T07:57:52Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*[http://www.bitwizard.nl/shop/expansion-boards/relay SPI Relay] | [[SPI Relay]]&lt;br /&gt;
*[http://www.bitwizard.nl/shop/raspberry-pi-ui-20x4 User interface 20x4] | [[User Interface]]&lt;br /&gt;
*Two [http://bitwizard.nl/shop/cables-connectors/6-pin-idc-cable-30cm IDC Cables, 6 Pin (SPI)] &lt;br /&gt;
&lt;br /&gt;
Hello, &lt;br /&gt;
&lt;br /&gt;
In this project I worked on the arduino. I made an pulse controller. With that you can control the amount of pulses and the pulse time of the relay. &lt;br /&gt;
Link to the code: [http://bitwizard.nl/source/Pulsecontroller.ino click here]&lt;br /&gt;
&lt;br /&gt;
I made this script building on the [http://www.bitwizard.nl/software/ardemo_lcd.pde arduino spi demo script]. The parts I am going to explain are only for my script part. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[DIO protocol]] - The SPI relay has the same protocol&lt;br /&gt;
*[[User Interface]]&lt;br /&gt;
*[[http://www.bitwizard.nl/software/ardemo_lcd.pde arduino spi demo script]] - My script uses the basics of that script.&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_26&amp;diff=4003</id>
		<title>Blog 26</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_26&amp;diff=4003"/>
		<updated>2016-01-22T17:24:41Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*[http://www.bitwizard.nl/shop/expansion-boards/relay SPI Relay] | [[SPI Relay]]&lt;br /&gt;
*[http://www.bitwizard.nl/shop/raspberry-pi-ui-20x4 User interface 20x4] | [[User Interface]]&lt;br /&gt;
*Two [http://bitwizard.nl/shop/cables-connectors/6-pin-idc-cable-30cm IDC Cables, 6 Pin (SPI)] &lt;br /&gt;
&lt;br /&gt;
Hello, &lt;br /&gt;
&lt;br /&gt;
In this project I worked on the arduino. I made an pulse controller. With that you can control the amount of pulses and the pulse time of the relay. &lt;br /&gt;
Link to the code: [http://bitwizard.nl/source/Pulsecontroller.ino click here]&lt;br /&gt;
&lt;br /&gt;
I made this script building on the [[http://www.bitwizard.nl/software/ardemo_lcd.pde arduino spi demo script]]. The parts I am going to explain are only for my script part. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[DIO protocol]] - The SPI relay has the same protocol&lt;br /&gt;
*[[User Interface]]&lt;br /&gt;
*[[http://www.bitwizard.nl/software/ardemo_lcd.pde arduino spi demo script]] - My script uses the basics of that script.&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_26&amp;diff=4002</id>
		<title>Blog 26</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_26&amp;diff=4002"/>
		<updated>2016-01-22T16:51:07Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*[http://www.bitwizard.nl/shop/expansion-boards/relay SPI Relay] | [[SPI Relay]]&lt;br /&gt;
*[http://www.bitwizard.nl/shop/raspberry-pi-ui-20x4 User interface 20x4] | [[User Interface]]&lt;br /&gt;
*Two [http://bitwizard.nl/shop/cables-connectors/6-pin-idc-cable-30cm IDC Cables, 6 Pin (SPI)] &lt;br /&gt;
&lt;br /&gt;
Hello, &lt;br /&gt;
&lt;br /&gt;
In this project I worked on a controllable sp relay. What the goal was that you could control the amount of pulses and the pulse time of the relay. &lt;br /&gt;
&lt;br /&gt;
Link to the code: [http://bitwizard.nl/source/Pulsecontroller.ino click here]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[DIO protocol]] - The SPI relay has the same protocol&lt;br /&gt;
*[[User Interface]]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_26&amp;diff=4001</id>
		<title>Blog 26</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_26&amp;diff=4001"/>
		<updated>2016-01-22T15:13:55Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*[http://www.bitwizard.nl/shop/expansion-boards/relay SPI Relay] | [[SPI Relay]]&lt;br /&gt;
*[http://www.bitwizard.nl/shop/raspberry-pi-ui-20x4 User interface 20x4] | [[User Interface]]&lt;br /&gt;
*Two [http://bitwizard.nl/shop/cables-connectors/6-pin-idc-cable-30cm IDC Cables, 6 Pin (SPI)] &lt;br /&gt;
&lt;br /&gt;
Hello, &lt;br /&gt;
&lt;br /&gt;
In this project I worked on a controllable sp relay. What the goal was that you could control the amount of pulses and the pulse time of the relay. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[DIO protocol]] - The SPI relay has the same protocol&lt;br /&gt;
*[[User Interface]]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=File:Arduinorelay.jpg&amp;diff=4000</id>
		<title>File:Arduinorelay.jpg</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=File:Arduinorelay.jpg&amp;diff=4000"/>
		<updated>2016-01-22T09:33:01Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_26&amp;diff=3999</id>
		<title>Blog 26</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_26&amp;diff=3999"/>
		<updated>2016-01-21T14:24:21Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*[http://www.bitwizard.nl/shop/expansion-boards/relay SPI Relay] | [[SPI Relay]]&lt;br /&gt;
*[http://www.bitwizard.nl/shop/raspberry-pi-ui-20x4 User interface 20x4] | [[User Interface]]&lt;br /&gt;
*Two [http://bitwizard.nl/shop/cables-connectors/6-pin-idc-cable-30cm IDC Cables, 6 Pin (SPI)] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[DIO protocol]] - The SPI relay has the same protocol&lt;br /&gt;
*[[User Interface]]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_26&amp;diff=3998</id>
		<title>Blog 26</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_26&amp;diff=3998"/>
		<updated>2016-01-21T14:23:31Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*[http://www.bitwizard.nl/shop/expansion-boards/relay SPI Relay] | [[SPI Relay]]&lt;br /&gt;
*[http://www.bitwizard.nl/shop/raspberry-pi-ui-20x4 User interface 20x4] | [[User Interface]]&lt;br /&gt;
*Two [http://bitwizard.nl/shop/cables-connectors/6-pin-idc-cable-30cm 6 PIN IDC cable] &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[DIO protocol]] - The SPI relay has the same protocol&lt;br /&gt;
*[[User Interface]]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=SPI_Relay&amp;diff=3997</id>
		<title>SPI Relay</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=SPI_Relay&amp;diff=3997"/>
		<updated>2016-01-21T10:04:30Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: Redirected page to Relay&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT[[Relay]]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_26&amp;diff=3996</id>
		<title>Blog 26</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_26&amp;diff=3996"/>
		<updated>2016-01-21T10:03:50Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*[http://www.bitwizard.nl/shop/expansion-boards/relay SPI Relay] | [[SPI Relay]]&lt;br /&gt;
*[http://www.bitwizard.nl/shop/raspberry-pi-ui-20x4 User interface 20x4] | [[User Interface]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[DIO protocol]] - The SPI relay has the same protocol&lt;br /&gt;
*[[User Interface]]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Rpi_ssr&amp;diff=3995</id>
		<title>Rpi ssr</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Rpi_ssr&amp;diff=3995"/>
		<updated>2016-01-20T15:32:03Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: Redirected page to Raspberry Relay&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT[[Raspberry Relay]]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=USB-step&amp;diff=3994</id>
		<title>USB-step</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=USB-step&amp;diff=3994"/>
		<updated>2016-01-18T15:57:50Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:usbstep.jpg|thumb|300px|alt=The USB_stepper board|The USB_stepper board]]&lt;br /&gt;
&lt;br /&gt;
= USB-step =&lt;br /&gt;
&lt;br /&gt;
The USB stepper allows you to step a small stepper a certain number of steps at regular intervals. &lt;br /&gt;
&lt;br /&gt;
The intended use is for example home-built clocks. &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
The usb-step has basically two connectors. The USB connector (micro USB), and a 5-pin JST for the stepper motor. &lt;br /&gt;
&lt;br /&gt;
The board has a few other connectors for debugging (for us), for power (GND/3V3/5V between the motor and USB connector), for SPI (in the future we might make it possible to add an SPI display for example), and for selecting the voltage of the powerpin of the SPI connector. These connectors are unpopulated. &lt;br /&gt;
&lt;br /&gt;
The board is 50x25. &lt;br /&gt;
&lt;br /&gt;
== pinout ==&lt;br /&gt;
&lt;br /&gt;
The JST power connector is something like &lt;br /&gt;
 1 - 5V&lt;br /&gt;
 2 - A+&lt;br /&gt;
 3 - B+&lt;br /&gt;
 4 - A-&lt;br /&gt;
 5 - B-&lt;br /&gt;
&lt;br /&gt;
== default ==&lt;br /&gt;
&lt;br /&gt;
By default the board will step every second, and make a full revolution in 15 minutes. &lt;br /&gt;
&lt;br /&gt;
== programming/protocol ==&lt;br /&gt;
&lt;br /&gt;
When you insert the board into your PC, you will get a virtual com port (VCP). &lt;br /&gt;
Under Windows you should get a device for which &amp;quot;no driver could be found&amp;quot;. install [http://www.bitwizard.nl/software/cdc.zip this driver], and you will get a virtual com port. &lt;br /&gt;
&lt;br /&gt;
Use your favorite serial-communciation program to connect to the VCP. (I suggest Minicom/Kermit for Linux users, putty for windows-users). &lt;br /&gt;
&lt;br /&gt;
you&amp;#039;ll be presented with a commandline interface. The &amp;quot;help&amp;quot; command lists the available commands. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;clock&amp;#039;&amp;#039;&amp;#039; lists or sets the &amp;quot;steps-per-second&amp;quot; setting.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;cal&amp;#039;&amp;#039;&amp;#039; lists or sets the crystal calbration. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;write&amp;#039;&amp;#039;&amp;#039; writes the current settings to flash. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;pat&amp;#039;&amp;#039;&amp;#039; allows setting the activation pattern. For forward use: 4 1 2 4 8, for reverse use &amp;quot;4 8 4 2 1&amp;quot; as the arguments. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;step&amp;#039;&amp;#039;&amp;#039; allows setting the time that the motor is activated/stepping speed. Times are in ms.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For adjusting the clock setting you must know that the board uses microsteps. It won&amp;#039;t drive the motor with better than &amp;quot;full step&amp;quot; resolution, but it uses very small steps internally. The motor will make a full revolution every 34190060316 of these internal steps. The motor is actually stepped when the accumulated number of steps internally exceeds 2^24 = 16777216. So at the slowest setting, 1 internal microstep per second, the motor wil be issued a step every 2^24 seconds (about twice a year), resulting in a full revolution every milennium. &lt;br /&gt;
&lt;br /&gt;
The time required for each step limits the fastest possible stepping rate. You can experiment with reducing the &amp;quot;step&amp;quot; times with the &amp;#039;&amp;#039;&amp;#039;step&amp;#039;&amp;#039;&amp;#039; command to see what is the fastest possible step rate with your load.&lt;br /&gt;
&lt;br /&gt;
== current usage ==&lt;br /&gt;
&lt;br /&gt;
the board uses about 120mA per motor-phase that is activated. Normally only one is activated at a time. The motor is powered off between the movements. We measured about 12mA &amp;quot;in rest&amp;quot;, Add to that (by default) about 1% times 120mA, the total average power is around 13-14 mA.&lt;br /&gt;
&lt;br /&gt;
== future ==&lt;br /&gt;
&lt;br /&gt;
In the future the interval between each group-of-steps will be configurable, currently fixed at &amp;quot;1s&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=USB-step&amp;diff=3993</id>
		<title>USB-step</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=USB-step&amp;diff=3993"/>
		<updated>2016-01-18T15:16:06Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* programming/protocol */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:usbstep.jpg|thumb|300px|alt=The USB_stepper board|The USB_stepper board]]&lt;br /&gt;
&lt;br /&gt;
= USB-step =&lt;br /&gt;
&lt;br /&gt;
The USB stepper allows you to step a small stepper a certain number of steps at regular intervals. &lt;br /&gt;
&lt;br /&gt;
The intended use is for example home-built clocks. &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
The usb-step has basically two connectors. The USB connector (micro USB), and a 5-pin JST for the stepper motor. &lt;br /&gt;
&lt;br /&gt;
The board has a few other connectors for debugging (for us), for power (GND/3V3/5V between the motor and USB connector), for SPI (in the future we might make it possible to add an SPI display for example), and for selecting the voltage of the powerpin of the SPI connector. These connectors are unpopulated. &lt;br /&gt;
&lt;br /&gt;
The board is 50x25. &lt;br /&gt;
&lt;br /&gt;
== pinout ==&lt;br /&gt;
&lt;br /&gt;
The JST power connector is something like &lt;br /&gt;
 1 - 5V&lt;br /&gt;
 2 - A+&lt;br /&gt;
 3 - B+&lt;br /&gt;
 4 - A-&lt;br /&gt;
 5 - B-&lt;br /&gt;
&lt;br /&gt;
== default ==&lt;br /&gt;
&lt;br /&gt;
By default the board will step every second, and make a full revolution in 15 minutes. &lt;br /&gt;
&lt;br /&gt;
== programming/protocol ==&lt;br /&gt;
&lt;br /&gt;
When you insert the board into your PC, you will get a virtual com port (VCP). &lt;br /&gt;
Under Windows you should get a device for which &amp;quot;no driver could be found&amp;quot;. install [http://forum.chibios.org/phpbb/download/file.php?id=968&amp;amp;sid=1ea558897dff1ee77df5aa87ad6a008a this driver], and you will get a virtual com port. &lt;br /&gt;
&lt;br /&gt;
Use your favorite serial-communciation program to connect to the VCP. (I suggest Minicom/Kermit for Linux users, putty for windows-users). &lt;br /&gt;
&lt;br /&gt;
you&amp;#039;ll be presented with a commandline interface. The &amp;quot;help&amp;quot; command lists the available commands. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;clock&amp;#039;&amp;#039;&amp;#039; lists or sets the &amp;quot;steps-per-second&amp;quot; setting.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;cal&amp;#039;&amp;#039;&amp;#039; lists or sets the crystal calbration. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;write&amp;#039;&amp;#039;&amp;#039; writes the current settings to flash. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;pat&amp;#039;&amp;#039;&amp;#039; allows setting the activation pattern. For forward use: 4 1 2 4 8, for reverse use &amp;quot;4 8 4 2 1&amp;quot; as the arguments. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;step&amp;#039;&amp;#039;&amp;#039; allows setting the time that the motor is activated/stepping speed. Times are in ms.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For adjusting the clock setting you must know that the board uses microsteps. It won&amp;#039;t drive the motor with better than &amp;quot;full step&amp;quot; resolution, but it uses very small steps internally. The motor will make a full revolution every 34190060316 of these internal steps. The motor is actually stepped when the accumulated number of steps internally exceeds 2^24 = 16777216. So at the slowest setting, 1 internal microstep per second, the motor wil be issued a step every 2^24 seconds (about twice a year), resulting in a full revolution every milennium. &lt;br /&gt;
&lt;br /&gt;
The time required for each step limits the fastest possible stepping rate. You can experiment with reducing the &amp;quot;step&amp;quot; times with the &amp;#039;&amp;#039;&amp;#039;step&amp;#039;&amp;#039;&amp;#039; command to see what is the fastest possible step rate with your load.&lt;br /&gt;
&lt;br /&gt;
== current usage ==&lt;br /&gt;
&lt;br /&gt;
the board uses about 120mA per motor-phase that is activated. Normally only one is activated at a time. The motor is powered off between the movements. We measured about 12mA &amp;quot;in rest&amp;quot;, Add to that (by default) about 1% times 120mA, the total average power is around 13-14 mA.&lt;br /&gt;
&lt;br /&gt;
== future ==&lt;br /&gt;
&lt;br /&gt;
In the future the interval between each group-of-steps will be configurable, currently fixed at &amp;quot;1s&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=User_Interface&amp;diff=3992</id>
		<title>User Interface</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=User_Interface&amp;diff=3992"/>
		<updated>2016-01-14T15:02:40Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* Read ports */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:RPi-UI.jpg|thumb|300px|alt=The RPi_UI PCB|The RPi_UI PCB]]&lt;br /&gt;
&lt;br /&gt;
This is the documentation page for the RPi_UI board. That can be found in the [http://www.bitwizard.nl/shop/index.php?route=product/search&amp;amp;search=user%20interface BitWizard shop].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Installation ==&lt;br /&gt;
See [[bw_tool#Setting up I2C/SPI under Linux | Setting up I2C/SPI under Linux]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== External resources ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Datasheets ===&lt;br /&gt;
&lt;br /&gt;
* [http://ww1.microchip.com/downloads/en/DeviceDoc/22266D.pdf MCP79412 (I2C RTC)]&lt;br /&gt;
* [http://ww1.microchip.com/downloads/en/DeviceDoc/22300A.pdf MCP79522 (SPI RTC)]&lt;br /&gt;
* [http://ww1.microchip.com/downloads/en/DeviceDoc/21942e.pdf MCP9700 thermistor]&lt;br /&gt;
&lt;br /&gt;
== Additional software ==&lt;br /&gt;
&lt;br /&gt;
The [[Bw_tool]] is meant to provide a basic commandline access to the bitwizard expansion boards&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Pinout ==&lt;br /&gt;
&lt;br /&gt;
The 26 pin gpio connector is described at [http://elinux.org/RPi_Low-level_peripherals elinux]&amp;lt;br&amp;gt;&lt;br /&gt;
The SPI connector has the same pinout as the atmel 6-pin ICSP connector and is documented here: [[SPI_connector_pinout]].&amp;lt;br&amp;gt;&lt;br /&gt;
The I2C connector is documented here: [[I2C_connector_pinout]].&amp;lt;br&amp;gt;&lt;br /&gt;
The UART connector is documented here: [[uart connector pinout]].&amp;lt;br&amp;gt;&lt;br /&gt;
The analog connector has the following pinout:&lt;br /&gt;
{| border=1&lt;br /&gt;
! pin !! function &lt;br /&gt;
|-&lt;br /&gt;
| 1 || 5V&lt;br /&gt;
|-&lt;br /&gt;
| 2 || Analog in&lt;br /&gt;
|-&lt;br /&gt;
| 3 || GND&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Some people report they find it difficult to read the names of the connectors on the PCB. We&amp;#039;ll fix that in a future version. In the meanwhile: &lt;br /&gt;
[[File:Rpi_ui_docu.png|none|thumb|500px|alt=The RPi_UI PCB|The RPi_UI PCB]]&lt;br /&gt;
&lt;br /&gt;
Note that for the 20x4 version of the board, the connectors are in the same order with the same pinout. &lt;br /&gt;
&lt;br /&gt;
=== LEDs ===&lt;br /&gt;
&lt;br /&gt;
The only LED is a power indicator.&lt;br /&gt;
&lt;br /&gt;
== Jumper settings ==&lt;br /&gt;
&lt;br /&gt;
There is one 2x2 pin jumper (JP1), which controls which SPI bus (actually which SPI chip-select line) is routed to the AVRs slave-select pin, and which is routed to the reset pin (to enable reprogramming of the AVR):&amp;lt;br&amp;gt;&lt;br /&gt;
Left pads/pins connected: SPI0 connected to Slave-Select&lt;br /&gt;
Right pads/pins connected: SPI1 connected to RESET&lt;br /&gt;
Bottom pads/pins connected: SPI0 connected to RESET&lt;br /&gt;
Top (near the LCD) pads/pins connected: SPI1 connected to Slave-Select&lt;br /&gt;
&lt;br /&gt;
The recommended configuration is to have 1-3 connected. The pins 1 and 2 are marked on the PCB. So 1-3 means the jumper is closest to the board edge, running from the &amp;quot;1&amp;quot; to the &amp;quot;J&amp;quot; of &amp;quot;JP1&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
People with the buttons/LCD on I2C can/should not install any jumpers here. &lt;br /&gt;
&lt;br /&gt;
There is also one solder jumper, SJ1, which controls the supply voltage on the SPI, I2C, and UART connectors:&amp;lt;br&amp;gt;&lt;br /&gt;
1-2: 5V (left)&amp;lt;br&amp;gt;&lt;br /&gt;
2-3: 3V3 (right, near the PCB edge)&lt;br /&gt;
&lt;br /&gt;
We deliver this jumper in the &amp;quot;5V&amp;quot; position with a small PCB trace. If you want to switch to 3.3V you&amp;#039;ll have to cut the small trace with a knife.&lt;br /&gt;
&lt;br /&gt;
== Protocol ==&lt;br /&gt;
&lt;br /&gt;
To make the RPI_UI PCB do things, you need to send things over the SPI or I2C bus to the PCB. A comparison of the two protocols can be found [[SPI_versus_I2C_protocols|here]].&lt;br /&gt;
&lt;br /&gt;
The general overview of the SPI protocol is [[General_SPI_protocol|here]].&lt;br /&gt;
&lt;br /&gt;
the list of the default addresses is [[Default_addresses|here]].&lt;br /&gt;
&lt;br /&gt;
== The software ==&lt;br /&gt;
&lt;br /&gt;
Controlling the display works the same way as our SPI_LCD or I2C_LCD modules. Reading the pushbuttons is very much like the DIO module. The read and write ports are described below.&lt;br /&gt;
&lt;br /&gt;
=== Write ports ===&lt;br /&gt;
&lt;br /&gt;
Some ports just set a single value. So writing more than one byte to such a port is redundant. Other ports are logically a stream of bytes. So writing more than one byte is encouraged. &lt;br /&gt;
&lt;br /&gt;
The rpi_ui board defines several ports. &lt;br /&gt;
{| border=1&lt;br /&gt;
! port !! function &lt;br /&gt;
|-&lt;br /&gt;
| 0x00 || display data.&lt;br /&gt;
|- &lt;br /&gt;
| 0x01 || write data as command to LCD.&lt;br /&gt;
|- &lt;br /&gt;
| 0x08 || Set startup message line 1. After setting the startup message please wait 100ms before sending the next line. works from version 1.6+&lt;br /&gt;
|- &lt;br /&gt;
| 0x09 || Set startup message line 2. &lt;br /&gt;
|- &lt;br /&gt;
| 0x0a || Set startup message line 3. &lt;br /&gt;
|- &lt;br /&gt;
| 0x0b || Set startup message line 4. &lt;br /&gt;
|- &lt;br /&gt;
| 0x10 || any data clears the screen. &lt;br /&gt;
|- &lt;br /&gt;
| 0x11 || move the cursor to line l, position p. &amp;lt;br&amp;gt;l is the top 3 bits&amp;lt;br&amp;gt;p is the bottom 5 bits of the data. &lt;br /&gt;
|- &lt;br /&gt;
| 0x12 || set contrast. &lt;br /&gt;
|- &lt;br /&gt;
| 0x13 || set backlight. &lt;br /&gt;
|- &lt;br /&gt;
| 0x14 || reinit LCD.  The initialzation procedure of the LCD takes a long time. A timed delay of about 500ms is in order after issuing this command&lt;br /&gt;
|-&lt;br /&gt;
| 0x15 || send 0 to set overrun-status back to zero. &lt;br /&gt;
|-&lt;br /&gt;
| 0x17 || Set the boot-time backlight intensity. (0xff means: use programmed default (0xc0))&lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || set display number-of-lines. These are passed on to the display software, but seem to have little effect. &lt;br /&gt;
|-&lt;br /&gt;
| 0x21 || set display number-of-characters. &lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
| 0x70 .. 0x71 || Select which i/o is coupled to which ADC channel&lt;br /&gt;
|-&lt;br /&gt;
| 0x80 || Set number of ADC channels to read&lt;br /&gt;
|-&lt;br /&gt;
| 0x81 || Set number of samples to add (we suggest using a power of 2) (two bytes) See: [[annoying bug]]&lt;br /&gt;
|-&lt;br /&gt;
| 0x82 || Set ammounts of bits to shift accumulated sample value&lt;br /&gt;
|-&lt;br /&gt;
| 0xf0 || change address. But need to unlock first. See below.  &amp;lt;br&amp;gt; Might require a reboot to take effect.&lt;br /&gt;
|-&lt;br /&gt;
| 0xf1 || change address: unlock phase 1: write 0x55 here to start unlocking. &lt;br /&gt;
|-&lt;br /&gt;
| 0xf2 || change address: unlock phase 2: write 0xaa here to allow changing of the address (after writing 0x55 to f1). &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Read ports ===&lt;br /&gt;
The rpi_ui board supports several read ports: &lt;br /&gt;
&lt;br /&gt;
{| border=1&lt;br /&gt;
! port !! function &lt;br /&gt;
|-&lt;br /&gt;
| 0x01 || identification string. (terminated with 0).&lt;br /&gt;
|-&lt;br /&gt;
| 0x02 || read eeprom (serial number). &lt;br /&gt;
|-&lt;br /&gt;
| 0x12 || contrast &lt;br /&gt;
|-&lt;br /&gt;
| 0x13 || backlight intensity&lt;br /&gt;
|-&lt;br /&gt;
| 0x15 || read FIFO(first in, first out) overrun status. If different from previous value, you&amp;#039;ve had an overrun. Best to&lt;br /&gt;
clear the screen and resend any data you want displayed. &lt;br /&gt;
|-&lt;br /&gt;
| 0x16 || read FIFO bytes-in-buffer. The fifo is 32 bytes, So you can send 20 chars to display if the value is less than 12. &lt;br /&gt;
|-&lt;br /&gt;
| 0x17 || read stored backlight intensity. &lt;br /&gt;
|-&lt;br /&gt;
| 0x20 || read button 1 (1 means NOT pushed, 0 means pushed)&lt;br /&gt;
|-&lt;br /&gt;
| 0x21 || read button 2 (1 means NOT pushed, 0 means pushed)&lt;br /&gt;
|-&lt;br /&gt;
| 0x22 || read button 3 (1 means NOT pushed, 0 means pushed)&lt;br /&gt;
|-&lt;br /&gt;
| 0x23 || read button 4 (1 means NOT pushed, 0 means pushed)&lt;br /&gt;
|-&lt;br /&gt;
| 0x24 || read button 5 (1 means NOT pushed, 0 means pushed)&lt;br /&gt;
|-&lt;br /&gt;
| 0x25 || read button 6 (1 means NOT pushed, 0 means pushed)&lt;br /&gt;
|-&lt;br /&gt;
| 0x30 || reports which buttons have been pushed since last read of this register&amp;lt;br&amp;gt;&lt;br /&gt;
If you keep a button pushed, it will read out as 1 multiple times&lt;br /&gt;
|-&lt;br /&gt;
| 0x31 || reports which buttons have been pushed since last read of this register (V1.2 and up)&amp;lt;br&amp;gt;&lt;br /&gt;
If you keep a button pushed, it will read out as 1 only once&lt;br /&gt;
|-&lt;br /&gt;
| 0x40 || read button 1 (1 means pushed, 0 means NOT pushed) (V1.1 and up)&lt;br /&gt;
|-&lt;br /&gt;
| 0x41 || read button 2 (1 means pushed, 0 means NOT pushed) (V1.1 and up)&lt;br /&gt;
|-&lt;br /&gt;
| 0x42 || read button 3 (1 means pushed, 0 means NOT pushed) (V1.1 and up)&lt;br /&gt;
|-&lt;br /&gt;
| 0x43 || read button 4 (1 means pushed, 0 means NOT pushed) (V1.1 and up)&lt;br /&gt;
|-&lt;br /&gt;
| 0x44 || read button 5 (1 means pushed, 0 means NOT pushed) (V1.1 and up)&lt;br /&gt;
|-&lt;br /&gt;
| 0x45 || read button 6 (1 means pushed, 0 means NOT pushed) (V1.1 and up)&lt;br /&gt;
|-&lt;br /&gt;
| 0x60.. 0x61 || Return analog value (2 bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x68 .. 0x69 || Return added and bitshifted analog value (2 bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x70 .. 0x71 || Return which i/o is coupled to which ADC channel&lt;br /&gt;
|-&lt;br /&gt;
| 0x80 || Return number of ADC channels to read&lt;br /&gt;
|-&lt;br /&gt;
| 0x81 || Return number of samples to add (two bytes)&lt;br /&gt;
|-&lt;br /&gt;
| 0x82 || Return ammounts of bits to shift accumulated sample value&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Using the analog inputs ==&lt;br /&gt;
&lt;br /&gt;
Please see [[DIO_protocol#Using_the_analog_inputs|this]] chapter on the page explaining the DIO protocol. There are two major differences: &lt;br /&gt;
* The internal reference voltage needs to be configured in a different way&lt;br /&gt;
* The mapping of the analog inputs; please use the following table instead:&lt;br /&gt;
&lt;br /&gt;
{| border=1&lt;br /&gt;
! IO pin !! value&lt;br /&gt;
|-&lt;br /&gt;
| temp || 0xC7 (Vref=1V1) OR 0x47 (Vref=Vcc=~5V)&lt;br /&gt;
|-&lt;br /&gt;
| ext || 0xC6 (Vref=1V1) OR 0x46 (Vref=Vcc=~5V)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
Setup the ADC (only needed once after reboot):&lt;br /&gt;
 bw_tool -a 94 -w 70:c7 //Set ADC channel 0 to temperature sensor, and internal 1V1 reference&lt;br /&gt;
 bw_tool -a 94 -w 80:01 //Set number of channels to sample to 1&lt;br /&gt;
&lt;br /&gt;
Read the value:&lt;br /&gt;
 bw_tool -a 94 -R 60:s // Read the result, output in hex&lt;br /&gt;
&lt;br /&gt;
== Using the temperature sensor ==&lt;br /&gt;
&lt;br /&gt;
The temperature sensor is a MCP9700. It&amp;#039;s output voltage depends on the temperature. For more information, please see the [http://ww1.microchip.com/downloads/en/DeviceDoc/21942e.pdf MCP9700 datasheet].&lt;br /&gt;
&lt;br /&gt;
An initialization and readout script are available on the [[Temperature sensor example]] page.&lt;br /&gt;
&lt;br /&gt;
== Using the RTC ==&lt;br /&gt;
&lt;br /&gt;
We first designed the User Interface to be equipped with either an SPI RTC or an I2C RTC. In practice the driver for the i2c version was a lot easier, so we&amp;#039;re not selling the ones with the SPI RTC unless you really, really want (and we haven&amp;#039;t run out of boards by then). &lt;br /&gt;
&lt;br /&gt;
=== I2C ===&lt;br /&gt;
&lt;br /&gt;
The I2C RTC has a Linux driver, which is available in the standard kernels delivered with raspian. (and probably others too). &lt;br /&gt;
&lt;br /&gt;
Just use: &lt;br /&gt;
 modprobe i2c:mcp7941x&lt;br /&gt;
 echo mcp7941x 0x6f &amp;gt; /sys/class/i2c-dev/i2c-1/device/new_device&lt;br /&gt;
and the module is loaded and detects the RTC. &lt;br /&gt;
&lt;br /&gt;
You can then set the RTC with: &amp;quot;hwclock -w&amp;quot;. This will write the unix clock to the RTC. Put a &amp;quot;hwclock -s&amp;quot; somewhere in your startup scripts to initialize the unix clock from the RTC.&lt;br /&gt;
The version 1 raspberry pi&amp;#039;s had the i2c-0 bus on the gpio connector, you for the older raspberry pi you&amp;#039;ll need to change i2c-1 into i2c-0..&lt;br /&gt;
&lt;br /&gt;
=== SPI ===&lt;br /&gt;
&lt;br /&gt;
We are not aware of a device driver for the SPI version of the RTC. We can read/write the RTC with bw_tool from the command line using the raw SPI bytes command line option &amp;quot;--hex&amp;quot;. The CPU on the board has to enable the CS line for the SPI RTC. This limits the speed of the SPI transactions a bit (50 kHz has been verified working). &lt;br /&gt;
&lt;br /&gt;
  bw_tool -s 50000 --hex 96 12 20 1 2 34 5 6 7 89&lt;br /&gt;
&lt;br /&gt;
will write (0x12) the test-bytes 1 2 34 5 6 7 89 to the RAM at location 0x20 in the RAM. &lt;br /&gt;
&lt;br /&gt;
  bw_tool -s 50000 --hex 96 13 20 0 0 0 0 0 0 0 0&lt;br /&gt;
&lt;br /&gt;
will read them back. &lt;br /&gt;
&lt;br /&gt;
Refer to the datasheet of the MCP79522 for information on the registers of the chip http://ww1.microchip.com/downloads/en/DeviceDoc/22300A.pdf&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
== Read identification ==&lt;br /&gt;
&lt;br /&gt;
read the identification string of the board.&lt;br /&gt;
{| border=1&lt;br /&gt;
! data sent !! data recieved || explanation &lt;br /&gt;
|-&lt;br /&gt;
| 0x95 || xx || select destination with address 0x94 for READ.  &lt;br /&gt;
|-&lt;br /&gt;
| 0x01 || xx || identify&lt;br /&gt;
|-&lt;br /&gt;
| xx || 0x73  || &amp;#039;s&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| xx || 0x70  || &amp;#039;p&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| xx || 0x69  || &amp;#039;i&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| xx || ... || etc. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Send text to display ==&lt;br /&gt;
Display the string &amp;quot;Hello World!&amp;quot; (only the first 5 bytes of the string shown). &lt;br /&gt;
{| border=1&lt;br /&gt;
! data sent !! data recieved || explanation &lt;br /&gt;
|-&lt;br /&gt;
| 0x94 || xx || select destination with address 0x94 for WRITE&lt;br /&gt;
|-&lt;br /&gt;
| 0x00 || xx || datastream&lt;br /&gt;
|-&lt;br /&gt;
| 0x48 || xx  || &amp;#039;H&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| 0x65 || xx  || &amp;#039;e&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| 0x6c || xx  || &amp;#039;l&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| 0x6c || xx  || &amp;#039;l&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| 0x6f || xx  || &amp;#039;o&amp;#039;&lt;br /&gt;
|-&lt;br /&gt;
| xx || ... || etc. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Set cursor position ==&lt;br /&gt;
move to line 1, character 5:&lt;br /&gt;
{| border=1&lt;br /&gt;
! data sent !! data recieved || explanation &lt;br /&gt;
|-&lt;br /&gt;
| 0x94 || xx || select destination with address 0x94 for WRITE&lt;br /&gt;
|-&lt;br /&gt;
| 0x11 || xx || port 0x11 = set cursor position. &lt;br /&gt;
|-&lt;br /&gt;
| 0x25 || xx  || 0x25 = 001 00101 = line 1 position 5. &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Bash script to show system informations ==&lt;br /&gt;
&lt;br /&gt;
This bash script shows the current time and load averages of the cpu. The refresh is set to 5 seconds.&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 &lt;br /&gt;
 # What display to use: &lt;br /&gt;
 DISPL=&amp;quot;bw_tool -I -D /dev/i2c-1 -a 94&amp;quot;&lt;br /&gt;
 # e.g. for SPI use: &lt;br /&gt;
 #DISPL=&amp;quot;bw_tool -D /dev/spidev1.0 -a 94&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 #clean the display&lt;br /&gt;
 $DISPL -W 10:0:b&lt;br /&gt;
 &lt;br /&gt;
 while true; do&lt;br /&gt;
        #get cpu loads&lt;br /&gt;
        load=`cut -d&amp;#039; &amp;#039; -f-3 /proc/loadavg`&lt;br /&gt;
    &lt;br /&gt;
        #print the current time &lt;br /&gt;
        $DISPL -W 11:00:b&lt;br /&gt;
        $DISPL -t `date +%H:%M:%S`&lt;br /&gt;
 &lt;br /&gt;
        #print the load averages&lt;br /&gt;
        $DISPL -W 11:20:b&lt;br /&gt;
        $DISPL -t $load&lt;br /&gt;
 &lt;br /&gt;
        #idle for 5 seconds&lt;br /&gt;
        sleep 5&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
== Changelog ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== 1.0 ===&lt;br /&gt;
* Initial public release&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_26&amp;diff=3991</id>
		<title>Blog 26</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_26&amp;diff=3991"/>
		<updated>2016-01-13T17:28:26Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: Created page with &amp;quot;  Hardware used: *[http://www.bitwizard.nl/shop/expansion-boards/relay SPI Relay] | spi relay *[http://www.bitwizard.nl/shop/raspberry-pi-ui-20x4 User interface 20x4] | [[...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*[http://www.bitwizard.nl/shop/expansion-boards/relay SPI Relay] | [[spi relay]]&lt;br /&gt;
*[http://www.bitwizard.nl/shop/raspberry-pi-ui-20x4 User interface 20x4] | [[User Interface]]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Default_address&amp;diff=3990</id>
		<title>Default address</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Default_address&amp;diff=3990"/>
		<updated>2016-01-13T11:31:11Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: Redirected page to Default addresses&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT[[Default addresses]]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3989</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3989"/>
		<updated>2016-01-11T16:41:02Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* The code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Connecting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
First you just have to connect the WS2812 with a micro-USB cable to your device. &lt;br /&gt;
&lt;br /&gt;
You have to use C-kermit or PuTTY: &lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use an other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY]&lt;br /&gt;
&lt;br /&gt;
On a UNIX device, when you want to run the code from the device to the WS2812. You have to type in the terminal:&lt;br /&gt;
 /usr/bin/kermit -l /dev/ttyACM0 &lt;br /&gt;
It could be that you have to send to/from an other destination. &lt;br /&gt;
&lt;br /&gt;
It will then say C-kermit is opened. You then just have to type the letter:&lt;br /&gt;
 c&lt;br /&gt;
&lt;br /&gt;
It will tell you to turn off carrier watch with: &lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
If you don&amp;#039;t want to ask this every time you start up with c. You can make a new terminal and write:&lt;br /&gt;
 nano .kermrc &lt;br /&gt;
&lt;br /&gt;
That file(.kermrc) should only have the code:&lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
When the carrier-watch is off you have to type c again. &lt;br /&gt;
&lt;br /&gt;
Before you send a code to the ws2812 check it with:&lt;br /&gt;
 gcc -Wall -o randomname randomname.c&lt;br /&gt;
&lt;br /&gt;
After that you can send it to the ws2812 with:&lt;br /&gt;
 ./randomname &amp;gt; /dev/ttyACM1&lt;br /&gt;
&lt;br /&gt;
== Resetting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
Maybe you will get the experience that the ws2812 crashes and has to be reseted. When the RGB leds are still attached they will give a rainbow effect. To reset the WS2812 you have to put a cable in pin 5 of the 6 pin connector with a ground.  The ground of the ws2812 is every odd number on the 16 pin connector. &lt;br /&gt;
After that you can do the previous commands and everything should work fine again.&lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*WS2812 usb controller: [http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 Shop link] | [[Usb ws2812|Wiki link]]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
The image pretty much explains itself. What you have to do is connect RGB with the 3-pin header.( GND - pin 1  | DO - pin 2 | +5V - pin 3 ) &lt;br /&gt;
The pointers of this example RGB strip should be pointing away from the WS2812 usb controller.&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I drew a Christmas tree. At the points where every single RGB led were laying I put a dot by using a pencil.&lt;br /&gt;
After that I cut the tree out and made holes at the pencil dots. After that I used some scotch tape to bring the front and back paper together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The full c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
What the code does in short is this: When starting up it will make the the peak RGB led white. It will then read the for statement where it goes through all the RGB leds(Except the peak). Every RGB led will randomly get the color green or red. The script will then keep fading the colors of the RGB leds to the opposite color. ( red to green or green to red )    &lt;br /&gt;
&lt;br /&gt;
The parts of the script that I will give some explanation:&lt;br /&gt;
&lt;br /&gt;
This is the list of colors, with their given RGB values. This gets invoked later in the script to give the right color value. &lt;br /&gt;
 #define WHITE  0x808080&lt;br /&gt;
 #define YELLOW 0x808000&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x000080&lt;br /&gt;
 #define BLACK  0x000000&lt;br /&gt;
&amp;lt;!--Because it&amp;#039;s RGB ( red green blue ) the first two numbers after 0x can be used for changing the red color value. The middle two numbers are for the amount of green and the last two are for blue. With RGB you can mix the colors into different colors. --&amp;gt; &lt;br /&gt;
( The first two numbers behind 0x are for Red. The second two numbers are for green and the last two are for blue. ) &lt;br /&gt;
&lt;br /&gt;
Here the amount of time in milliseconds and steps given for to make the fading go fluent. ( later used in the script ) &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
In interpolate it will get the values from fadeto three times ( for every color r, g &amp;amp; b ). &lt;br /&gt;
It will give new values to c1 and c2 it will bit shift it to the right, and give it the value together with 0xff.  &lt;br /&gt;
After that it calculates difference between previous color. The value would be send back which then could be printed out in the terminal in that display. &lt;br /&gt;
&lt;br /&gt;
The bit shifting to the right is needed to &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
Void fadeto receives the information from int main for example: (5, RED, GREEN). &lt;br /&gt;
It will give the information to every single part of the RGB led. So in this example it would be that red will change from 80 to 00. &lt;br /&gt;
The reason for making it 80, instead of FF is to makes the light not hurting your eyes. &lt;br /&gt;
it will keep doing calculations of the steps until it reached 30(nfadesteps). &lt;br /&gt;
After that it prints out on the certain RGB led that given color values. It also print that information in the C-Kermit terminal. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here are the given amount of RGB leds is given. When you want to run the script you can give a value after it. ( ./randomname 20 ) When the script runs it will look if a value about one is given if it is true it will give nleds an new value. &lt;br /&gt;
&lt;br /&gt;
After that the peak RGB led will become white.&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
&lt;br /&gt;
The for statement will count from zero till nine. Every time it counts one up it will get a random number and use a remainder that divides it to two. The result could be a zero or an one. If it is zero the color red will be given else it would be green. After that it will directly be printed, so that the for statement can count to the next number until it reached the end.  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
In the while statement it has to choose a random led. It does this by giving a random number and remainder it with nleds. It will then look if the chosen RGB led is red. If that is true it will say that the newcolor it has to become is green. Else the opposite will happen. ( The RGB led will become red. ) The given values will then be send to fadeto. ( Example: (5, RED, GREEN). After that it will replace the previous color with the newcolor. so pixels[05] would become green. &lt;br /&gt;
&lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812|usb ws2812 wiki]] &lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B C Operator list]&lt;br /&gt;
*[http://www.cplusplus.com/ C programming site]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3988</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3988"/>
		<updated>2016-01-11T15:51:18Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* Useful links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Connecting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
First you just have to connect the WS2812 with a micro-USB cable to your device. &lt;br /&gt;
&lt;br /&gt;
You have to use C-kermit or PuTTY: &lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use an other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY]&lt;br /&gt;
&lt;br /&gt;
On a UNIX device, when you want to run the code from the device to the WS2812. You have to type in the terminal:&lt;br /&gt;
 /usr/bin/kermit -l /dev/ttyACM0 &lt;br /&gt;
It could be that you have to send to/from an other destination. &lt;br /&gt;
&lt;br /&gt;
It will then say C-kermit is opened. You then just have to type the letter:&lt;br /&gt;
 c&lt;br /&gt;
&lt;br /&gt;
It will tell you to turn off carrier watch with: &lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
If you don&amp;#039;t want to ask this every time you start up with c. You can make a new terminal and write:&lt;br /&gt;
 nano .kermrc &lt;br /&gt;
&lt;br /&gt;
That file(.kermrc) should only have the code:&lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
When the carrier-watch is off you have to type c again. &lt;br /&gt;
&lt;br /&gt;
Before you send a code to the ws2812 check it with:&lt;br /&gt;
 gcc -Wall -o randomname randomname.c&lt;br /&gt;
&lt;br /&gt;
After that you can send it to the ws2812 with:&lt;br /&gt;
 ./randomname &amp;gt; /dev/ttyACM1&lt;br /&gt;
&lt;br /&gt;
== Resetting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
Maybe you will get the experience that the ws2812 crashes and has to be reseted. When the RGB leds are still attached they will give a rainbow effect. To reset the WS2812 you have to put a cable in pin 5 of the 6 pin connector with a ground.  The ground of the ws2812 is every odd number on the 16 pin connector. &lt;br /&gt;
After that you can do the previous commands and everything should work fine again.&lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*WS2812 usb controller: [http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 Shop link] | [[Usb ws2812|Wiki link]]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
The image pretty much explains itself. What you have to do is connect RGB with the 3-pin header.( GND - pin 1  | DO - pin 2 | +5V - pin 3 ) &lt;br /&gt;
The pointers of this example RGB strip should be pointing away from the WS2812 usb controller.&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I drew a Christmas tree. At the points where every single RGB led were laying I put a dot by using a pencil.&lt;br /&gt;
After that I cut the tree out and made holes at the pencil dots. After that I used some scotch tape to bring the front and back paper together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The full c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
What the code does in short is this: When starting up it will make the the peak RGB led white. It will then read the for statement where it goes through all the RGB leds(Except the peak). Every RGB led will randomly get the color green or red. The script will then keep fading the colors of the RGB leds to the opposite color. ( red to green or green to red )    &lt;br /&gt;
&lt;br /&gt;
The parts of the script that I will give some explanation:&lt;br /&gt;
&lt;br /&gt;
This is the list of colors, with their given RGB values. This gets invoked later in the script to give the right color value. &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000&lt;br /&gt;
&amp;lt;!--Because it&amp;#039;s RGB ( red green blue ) the first two numbers after 0x can be used for changing the red color value. The middle two numbers are for the amount of green and the last two are for blue. With RGB you can mix the colors into different colors. --&amp;gt; &lt;br /&gt;
( The first two numbers behind 0x are for Red. The second two numbers are for green and the last two are for blue. ) &lt;br /&gt;
&lt;br /&gt;
Here the amount of time in milliseconds and steps given for to make the fading go fluent. ( later used in the script ) &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
In interpolate it will get the values from fadeto three times ( for every color r, g &amp;amp; b ). &lt;br /&gt;
It will give new values to c1 and c2 it will bit shift it to the right, and give it the value together with 0xff.  &lt;br /&gt;
After that it calculates difference between previous color. The value would be send back which then could be printed out in the terminal in that display. &lt;br /&gt;
&lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
Void fadeto receives the information from int main for example: (5, RED, GREEN). &lt;br /&gt;
It will give the information to every single part of the RGB led. So in this example it would be that red will change from 80 to 00. &lt;br /&gt;
it will keep doing calculations of the steps until it reached 30(nfadesteps). &lt;br /&gt;
After that it prints out on the certain RGB led that given color values.&lt;br /&gt;
&lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here are the given amount of RGB leds is given. When you want to run the script you can give a value after it. ( ./randomname 20 ) When the script runs it will look if a value about one is given if it is true it will give nleds an new value. &lt;br /&gt;
&lt;br /&gt;
After that the peak RGB led will become white.&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
&lt;br /&gt;
The for statement will count from zero till nine. Every time it counts one up it will get a random number and use a remainder that divides it to two. The result could be a zero or an one. If it is zero the color red will be given else it would be green. After that it will directly be printed, so that the for statement can count to the next number until it reached the end.  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
In the while statement it has to choose a random led. It does this by giving a random number and remainder it with nleds. It will then look if the chosen RGB led is red. If that is true it will say that the newcolor it has to become is green. Else the opposite will happen. ( The RGB led will become red. ) The given values will then be send to fadeto. ( Example: (5, RED, GREEN). After that it will replace the previous color with the newcolor. so pixels[05] would become green. &lt;br /&gt;
&lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812|usb ws2812 wiki]] &lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B C Operator list]&lt;br /&gt;
*[http://www.cplusplus.com/ C programming site]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3987</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3987"/>
		<updated>2016-01-08T15:46:40Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* The code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Connecting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
First you just have to connect the WS2812 with a micro-USB cable to your device. &lt;br /&gt;
&lt;br /&gt;
You have to use C-kermit or PuTTY: &lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use an other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY]&lt;br /&gt;
&lt;br /&gt;
On a UNIX device, when you want to run the code from the device to the WS2812. You have to type in the terminal:&lt;br /&gt;
 /usr/bin/kermit -l /dev/ttyACM0 &lt;br /&gt;
It could be that you have to send to/from an other destination. &lt;br /&gt;
&lt;br /&gt;
It will then say C-kermit is opened. You then just have to type the letter:&lt;br /&gt;
 c&lt;br /&gt;
&lt;br /&gt;
It will tell you to turn off carrier watch with: &lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
If you don&amp;#039;t want to ask this every time you start up with c. You can make a new terminal and write:&lt;br /&gt;
 nano .kermrc &lt;br /&gt;
&lt;br /&gt;
That file(.kermrc) should only have the code:&lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
When the carrier-watch is off you have to type c again. &lt;br /&gt;
&lt;br /&gt;
Before you send a code to the ws2812 check it with:&lt;br /&gt;
 gcc -Wall -o randomname randomname.c&lt;br /&gt;
&lt;br /&gt;
After that you can send it to the ws2812 with:&lt;br /&gt;
 ./randomname &amp;gt; /dev/ttyACM1&lt;br /&gt;
&lt;br /&gt;
== Resetting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
Maybe you will get the experience that the ws2812 crashes and has to be reseted. When the RGB leds are still attached they will give a rainbow effect. To reset the WS2812 you have to put a cable in pin 5 of the 6 pin connector with a ground.  The ground of the ws2812 is every odd number on the 16 pin connector. &lt;br /&gt;
After that you can do the previous commands and everything should work fine again.&lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*WS2812 usb controller: [http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 Shop link] | [[Usb ws2812|Wiki link]]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
The image pretty much explains itself. What you have to do is connect RGB with the 3-pin header.( GND - pin 1  | DO - pin 2 | +5V - pin 3 ) &lt;br /&gt;
The pointers of this example RGB strip should be pointing away from the WS2812 usb controller.&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I drew a Christmas tree. At the points where every single RGB led were laying I put a dot by using a pencil.&lt;br /&gt;
After that I cut the tree out and made holes at the pencil dots. After that I used some scotch tape to bring the front and back paper together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The full c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
What the code does in short is this: When starting up it will make the the peak RGB led white. It will then read the for statement where it goes through all the RGB leds(Except the peak). Every RGB led will randomly get the color green or red. The script will then keep fading the colors of the RGB leds to the opposite color. ( red to green or green to red )    &lt;br /&gt;
&lt;br /&gt;
The parts of the script that I will give some explanation:&lt;br /&gt;
&lt;br /&gt;
This is the list of colors, with their given RGB values. This gets invoked later in the script to give the right color value. &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000&lt;br /&gt;
&amp;lt;!--Because it&amp;#039;s RGB ( red green blue ) the first two numbers after 0x can be used for changing the red color value. The middle two numbers are for the amount of green and the last two are for blue. With RGB you can mix the colors into different colors. --&amp;gt; &lt;br /&gt;
( The first two numbers behind 0x are for Red. The second two numbers are for green and the last two are for blue. ) &lt;br /&gt;
&lt;br /&gt;
Here the amount of time in milliseconds and steps given for to make the fading go fluent. ( later used in the script ) &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
In interpolate it will get the values from fadeto three times ( for every color r, g &amp;amp; b ). &lt;br /&gt;
It will give new values to c1 and c2 it will bit shift it to the right, and give it the value together with 0xff.  &lt;br /&gt;
After that it calculates difference between previous color. The value would be send back which then could be printed out in the terminal in that display. &lt;br /&gt;
&lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
Void fadeto receives the information from int main for example: (5, RED, GREEN). &lt;br /&gt;
It will give the information to every single part of the RGB led. So in this example it would be that red will change from 80 to 00. &lt;br /&gt;
it will keep doing calculations of the steps until it reached 30(nfadesteps). &lt;br /&gt;
After that it prints out on the certain RGB led that given color values.&lt;br /&gt;
&lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here are the given amount of RGB leds is given. When you want to run the script you can give a value after it. ( ./randomname 20 ) When the script runs it will look if a value about one is given if it is true it will give nleds an new value. &lt;br /&gt;
&lt;br /&gt;
After that the peak RGB led will become white.&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
&lt;br /&gt;
The for statement will count from zero till nine. Every time it counts one up it will get a random number and use a remainder that divides it to two. The result could be a zero or an one. If it is zero the color red will be given else it would be green. After that it will directly be printed, so that the for statement can count to the next number until it reached the end.  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
In the while statement it has to choose a random led. It does this by giving a random number and remainder it with nleds. It will then look if the chosen RGB led is red. If that is true it will say that the newcolor it has to become is green. Else the opposite will happen. ( The RGB led will become red. ) The given values will then be send to fadeto. ( Example: (5, RED, GREEN). After that it will replace the previous color with the newcolor. so pixels[05] would become green. &lt;br /&gt;
&lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812|usb ws2812 wiki]] &lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B Operator list of C]&lt;br /&gt;
*[http://www.cplusplus.com/ C programming site]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3986</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3986"/>
		<updated>2016-01-08T15:11:02Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* The code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Connecting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
First you just have to connect the WS2812 with a micro-USB cable to your device. &lt;br /&gt;
&lt;br /&gt;
You have to use C-kermit or PuTTY: &lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use an other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY]&lt;br /&gt;
&lt;br /&gt;
On a UNIX device, when you want to run the code from the device to the WS2812. You have to type in the terminal:&lt;br /&gt;
 /usr/bin/kermit -l /dev/ttyACM0 &lt;br /&gt;
It could be that you have to send to/from an other destination. &lt;br /&gt;
&lt;br /&gt;
It will then say C-kermit is opened. You then just have to type the letter:&lt;br /&gt;
 c&lt;br /&gt;
&lt;br /&gt;
It will tell you to turn off carrier watch with: &lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
If you don&amp;#039;t want to ask this every time you start up with c. You can make a new terminal and write:&lt;br /&gt;
 nano .kermrc &lt;br /&gt;
&lt;br /&gt;
That file(.kermrc) should only have the code:&lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
When the carrier-watch is off you have to type c again. &lt;br /&gt;
&lt;br /&gt;
Before you send a code to the ws2812 check it with:&lt;br /&gt;
 gcc -Wall -o randomname randomname.c&lt;br /&gt;
&lt;br /&gt;
After that you can send it to the ws2812 with:&lt;br /&gt;
 ./randomname &amp;gt; /dev/ttyACM1&lt;br /&gt;
&lt;br /&gt;
== Resetting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
Maybe you will get the experience that the ws2812 crashes and has to be reseted. When the RGB leds are still attached they will give a rainbow effect. To reset the WS2812 you have to put a cable in pin 5 of the 6 pin connector with a ground.  The ground of the ws2812 is every odd number on the 16 pin connector. &lt;br /&gt;
After that you can do the previous commands and everything should work fine again.&lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*WS2812 usb controller: [http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 Shop link] | [[Usb ws2812|Wiki link]]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
The image pretty much explains itself. What you have to do is connect RGB with the 3-pin header.( GND - pin 1  | DO - pin 2 | +5V - pin 3 ) &lt;br /&gt;
The pointers of this example RGB strip should be pointing away from the WS2812 usb controller.&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I drew a Christmas tree. At the points where every single RGB led were laying I put a dot by using a pencil.&lt;br /&gt;
After that I cut the tree out and made holes at the pencil dots. After that I used some scotch tape to bring the front and back paper together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The full c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
What the code does in short is this: When starting up it will make the the peak RGB led white. It will then read the for statement where it goes through all the RGB leds(Except the peak). Every RGB led will randomly get the color green or red. The script will then keep fading the colors of the RGB leds to the opposite color. ( red to green or green to red )    &lt;br /&gt;
&lt;br /&gt;
The parts of the script that I will give some explanation:&lt;br /&gt;
&lt;br /&gt;
This is the list of colors, with their given RGB values. This gets invoked later in the script to give the right color value. &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000&lt;br /&gt;
&amp;lt;!--Because it&amp;#039;s RGB ( red green blue ) the first two numbers after 0x can be used for changing the red color value. The middle two numbers are for the amount of green and the last two are for blue. With RGB you can mix the colors into different colors. --&amp;gt; &lt;br /&gt;
( The first two numbers behind 0x are for Red. The second two numbers are for green and the last two are for blue. ) &lt;br /&gt;
&lt;br /&gt;
Here the amount of time and steps in milliseconds is given for to make the fading go fluent. ( later used in the script ) &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
In interpolate it will get the values from fadeto three times ( for every color r, g &amp;amp; b ) &lt;br /&gt;
It will give new values to c1 and c2 it will bit shift it to the right, and give it the value together with 0xff.  &lt;br /&gt;
After that it calculates difference between previous color.&lt;br /&gt;
&lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
Void fadeto receives the information from int main for example: (5, RED, GREEN). &lt;br /&gt;
It will give the information to every single part of the rgb led. So in this example it would be that red will change from 80 to 00. &lt;br /&gt;
it will keep doing calculations of the steps until it reached 30(nfadesteps). &lt;br /&gt;
After that it prints out on the certain RGB led that given color values.&lt;br /&gt;
&lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here are the given amount of RGB leds is given. When you want to run the script you can give a value after it. ( ./randomname 20 ) When the script runs it will look if a value about one is given if it is true it will give nleds an new value. &lt;br /&gt;
&lt;br /&gt;
After that the peak RGB led will become white.&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
&lt;br /&gt;
The for statement will count from zero till nine. Every time it counts one up it will get a random number and use a remainder that divides it to two. The result could be a zero or an one. If it is zero the color red will be given else it would be green. After that it will directly be printed, so that the for statement can count to the next number until it reached the end.  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
In the while statement it has to choose a random led. It does this by giving a random number and remainder it with nleds. It will then look if the chosen RGB led is red. If that is true it will say that the newcolor it has to become is green. Else the opposite will happen. ( The RGB led will become red. ) The given values will then be send to fadeto. ( Example: (5, RED, GREEN). After that it will replace the previous color with the newcolor. so pixels[05] would become green. &lt;br /&gt;
&lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812|usb ws2812 wiki]] &lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B Operator list of C]&lt;br /&gt;
*[http://www.cplusplus.com/ C programming site]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3985</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3985"/>
		<updated>2016-01-08T14:41:44Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* The code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Connecting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
First you just have to connect the WS2812 with a micro-USB cable to your device. &lt;br /&gt;
&lt;br /&gt;
You have to use C-kermit or PuTTY: &lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use an other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY]&lt;br /&gt;
&lt;br /&gt;
On a UNIX device, when you want to run the code from the device to the WS2812. You have to type in the terminal:&lt;br /&gt;
 /usr/bin/kermit -l /dev/ttyACM0 &lt;br /&gt;
It could be that you have to send to/from an other destination. &lt;br /&gt;
&lt;br /&gt;
It will then say C-kermit is opened. You then just have to type the letter:&lt;br /&gt;
 c&lt;br /&gt;
&lt;br /&gt;
It will tell you to turn off carrier watch with: &lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
If you don&amp;#039;t want to ask this every time you start up with c. You can make a new terminal and write:&lt;br /&gt;
 nano .kermrc &lt;br /&gt;
&lt;br /&gt;
That file(.kermrc) should only have the code:&lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
When the carrier-watch is off you have to type c again. &lt;br /&gt;
&lt;br /&gt;
Before you send a code to the ws2812 check it with:&lt;br /&gt;
 gcc -Wall -o randomname randomname.c&lt;br /&gt;
&lt;br /&gt;
After that you can send it to the ws2812 with:&lt;br /&gt;
 ./randomname &amp;gt; /dev/ttyACM1&lt;br /&gt;
&lt;br /&gt;
== Resetting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
Maybe you will get the experience that the ws2812 crashes and has to be reseted. When the RGB leds are still attached they will give a rainbow effect. To reset the WS2812 you have to put a cable in pin 5 of the 6 pin connector with a ground.  The ground of the ws2812 is every odd number on the 16 pin connector. &lt;br /&gt;
After that you can do the previous commands and everything should work fine again.&lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*WS2812 usb controller: [http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 Shop link] | [[Usb ws2812|Wiki link]]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
The image pretty much explains itself. What you have to do is connect RGB with the 3-pin header.( GND - pin 1  | DO - pin 2 | +5V - pin 3 ) &lt;br /&gt;
The pointers of this example RGB strip should be pointing away from the WS2812 usb controller.&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I drew a Christmas tree. At the points where every single RGB led were laying I put a dot by using a pencil.&lt;br /&gt;
After that I cut the tree out and made holes at the pencil dots. After that I used some scotch tape to bring the front and back paper together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The full c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
What the code does in short is this: When starting up it will make the the peak RGB led white. It will then read the for statement where it goes through all the RGB leds(Except the peak). Every RGB led will randomly get the color green or red. The script will then keep fading the colors of the RGB leds to the opposite color. ( red to green or green to red )    &lt;br /&gt;
&lt;br /&gt;
The parts of the script that I will give some explanation:&lt;br /&gt;
&lt;br /&gt;
This is the list of colors, with their given RGB values. This can be invoked by typing the capital name. &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000&lt;br /&gt;
Because it&amp;#039;s RGB ( red green blue ) the first two numbers after 0x can be used for changing the red color value. The middle two numbers are for the amount of green and the last two are for blue. With RGB you can mix the colors into different colors.    &lt;br /&gt;
&lt;br /&gt;
Here the amount of time and steps in milliseconds is given for to make the fading go fluent. &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
In interpolate it will get the values from fadeto three times ( for every color r, g &amp;amp; b ) &lt;br /&gt;
It will give new values to c1 and c2 it will bit shift it to the right, and give it the value together with 0xff.  &lt;br /&gt;
After that it calculates difference between previous color.&lt;br /&gt;
&lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
Void fadeto receives the information from int main for example: (5, RED, GREEN). &lt;br /&gt;
It will give the information to every single part of the rgb led. So in this example it would be that red will change from 80 to 00. &lt;br /&gt;
it will keep doing calculations of the steps until it reached 30(nfadesteps). &lt;br /&gt;
After that it prints out on the certain RGB led that given color values.&lt;br /&gt;
&lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here are the given amount of RGB leds is given. When you want to run the script you can give a value after it. ( ./randomname 20 ) When the script runs it will look if a value about one is given if it is true it will give nleds an new value. &lt;br /&gt;
&lt;br /&gt;
After that the peak RGB led will become white.&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
&lt;br /&gt;
The for statement will count from zero till nine. Every time it counts one up it will get a random number and use a remainder that divides it to two. The result could be a zero or an one. If it is zero the color red will be given else it would be green. After that it will directly be printed, so that the for statement can count to the next number until it reached the end.  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
In the while statement it has to choose a random led. It does this by giving a random number and remainder it with nleds. It will then look if the chosen RGB led is red. If that is true it will say that the newcolor it has to become is green. Else the opposite will happen. ( The RGB led will become red. ) The given values will then be send to fadeto. ( Example: (5, RED, GREEN). After that it will replace the previous color with the newcolor. so pixels[05] would become green. &lt;br /&gt;
&lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812|usb ws2812 wiki]] &lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B Operator list of C]&lt;br /&gt;
*[http://www.cplusplus.com/ C programming site]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_25&amp;diff=3984</id>
		<title>Blog 25</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_25&amp;diff=3984"/>
		<updated>2016-01-08T13:39:06Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: Created page with &amp;quot; == Working with the usb stepper ==&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Working with the usb stepper ==&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=USB-step&amp;diff=3983</id>
		<title>USB-step</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=USB-step&amp;diff=3983"/>
		<updated>2016-01-08T12:46:12Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* programming/protocol */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:usbstep.jpg|thumb|300px|alt=The USB_stepper board|The USB_stepper board]]&lt;br /&gt;
&lt;br /&gt;
= USB-step =&lt;br /&gt;
&lt;br /&gt;
The USB stepper allows you to step a small stepper a certain number of steps at regular intervals. &lt;br /&gt;
&lt;br /&gt;
The intended use is for example home-built clocks. &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
The usb-step has basically two connectors. The USB connector (micro USB), and a 5-pin JST for the stepper motor. &lt;br /&gt;
&lt;br /&gt;
The board has a few other connectors for debugging (for us), for power (GND/3V3/5V between the motor and USB connector), for SPI (in the future we might make it possible to add an SPI display for example), and for selecting the voltage of the powerpin of the SPI connector. These connectors are unpopulated. &lt;br /&gt;
&lt;br /&gt;
The board is 50x25. &lt;br /&gt;
&lt;br /&gt;
== pinout ==&lt;br /&gt;
&lt;br /&gt;
The JST power connector is something like &lt;br /&gt;
 1 - 5V&lt;br /&gt;
 2 - A+&lt;br /&gt;
 3 - B+&lt;br /&gt;
 4 - A-&lt;br /&gt;
 5 - B-&lt;br /&gt;
&lt;br /&gt;
== default ==&lt;br /&gt;
&lt;br /&gt;
By default the board will step every second, and make a full revolution in 15 minutes. &lt;br /&gt;
&lt;br /&gt;
== programming/protocol ==&lt;br /&gt;
&lt;br /&gt;
When you insert the board into your PC, you will get a virtual com port (VCP). &lt;br /&gt;
Under Windows you should get a device for which &amp;quot;no driver could be found&amp;quot;. install XXX this driver, and you will get a virtual com port. &lt;br /&gt;
&lt;br /&gt;
Use your favorite serial-communciation program to connect to the VCP. (I suggest Minicom/Kermit for Linux users, putty for windows-users). &lt;br /&gt;
&lt;br /&gt;
you&amp;#039;ll be presented with a commandline interface. The &amp;quot;help&amp;quot; command lists the available commands. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;clock&amp;#039;&amp;#039;&amp;#039; lists or sets the &amp;quot;steps-per-second&amp;quot; setting.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;cal&amp;#039;&amp;#039;&amp;#039; lists or sets the crystal calbration. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;write&amp;#039;&amp;#039;&amp;#039; writes the current settings to flash. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;pat&amp;#039;&amp;#039;&amp;#039; allows setting the activation pattern. For forward use: 4 1 2 4 8, for reverse use &amp;quot;4 8 4 2 1&amp;quot; as the arguments. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;step&amp;#039;&amp;#039;&amp;#039; allows setting the time that the motor is activated/stepping speed. Times are in ms.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For adjusting the clock setting you must know that the board uses microsteps. It won&amp;#039;t drive the motor with better than &amp;quot;full step&amp;quot; resolution, but it uses very small steps internally. The motor will make a full revolution every 34190060316 of these internal steps. The motor is actually stepped when the accumulated number of steps internally exceeds 2^24 = 16777216. So at the slowest setting, 1 internal microstep per second, the motor wil be issued a step every 2^24 seconds (about twice a year), resulting in a full revolution every milennium. &lt;br /&gt;
&lt;br /&gt;
The time required for each step limits the fastest possible stepping rate. You can experiment with reducing the &amp;quot;step&amp;quot; times with the &amp;#039;&amp;#039;&amp;#039;step&amp;#039;&amp;#039;&amp;#039; command to see what is the fastest possible step rate with your load.&lt;br /&gt;
&lt;br /&gt;
== current usage ==&lt;br /&gt;
&lt;br /&gt;
the board uses about 120mA per motor-phase that is activated. Normally only one is activated at a time. The motor is powered off between the movements. We measured about 12mA &amp;quot;in rest&amp;quot;, Add to that (by default) about 1% times 120mA, the total average power is around 13-14 mA.&lt;br /&gt;
&lt;br /&gt;
== future ==&lt;br /&gt;
&lt;br /&gt;
In the future the interval between each group-of-steps will be configurable, currently fixed at &amp;quot;1s&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Usb_ws2812&amp;diff=3982</id>
		<title>Usb ws2812</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Usb_ws2812&amp;diff=3982"/>
		<updated>2016-01-08T12:46:07Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* Protocol */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:ws2812.jpg|thumb|300px|alt=The USB_WS2812 board|The USB_WS2812 board]]&lt;br /&gt;
&lt;br /&gt;
This is the documentation page for the USB_WS2812 board. That you can buy in the [http://www.bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161&amp;amp;search=ws2812 BitWizard shop].&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
This board enables you to drive up to 600 WS2812 fullcolor RGB leds. These leds are sometimes called &amp;quot;neopixels&amp;quot;. The board can drive up to 75 leds in in 8 strings. Due to the way things are implemented it is not possible to drive a single string of say 600 leds. Furthermore you would not want that: for each led on a string there is a fixed amount of time necessary for sending its data. Too many leds and the refresh rate has to drop!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Assembly instructions ==&lt;br /&gt;
&lt;br /&gt;
None: the board comes fully assembled.&lt;br /&gt;
&lt;br /&gt;
== External resources ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Datasheets ===&lt;br /&gt;
&lt;br /&gt;
[http://www.bitwizard.nl/pdf/WS2812B.pdf The datasheet of the WS2812B chip/led.]&lt;br /&gt;
&lt;br /&gt;
== Additional software ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Related projects ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Pinout ==&lt;br /&gt;
&lt;br /&gt;
The USB connector is a standard micro USB connector. &lt;br /&gt;
&lt;br /&gt;
Pinout of the 16-pin header: &lt;br /&gt;
&lt;br /&gt;
{| border=1&lt;br /&gt;
! function !! pin !! pin !! function &lt;br /&gt;
|-&lt;br /&gt;
| GND || 1 || 2 || D7 || Data for led-chain 7.&lt;br /&gt;
|-&lt;br /&gt;
| GND || 3 || 4 || D6 || Data for led-chain 6.&lt;br /&gt;
|-&lt;br /&gt;
| GND || 5 || 6 || D5 || Data for led-chain 5.&lt;br /&gt;
|-&lt;br /&gt;
| GND || 7 || 8 || D4 || Data for led-chain 4.&lt;br /&gt;
|-&lt;br /&gt;
| GND || 9 || 10 || D3 || Data for led-chain 3.&lt;br /&gt;
|-&lt;br /&gt;
| GND || 11 || 12 || D2 || Data for led-chain 2.&lt;br /&gt;
|-&lt;br /&gt;
| GND || 13 || 14 || D1 || Data for led-chain 1.&lt;br /&gt;
|-&lt;br /&gt;
| GND || 15 || 16 || D0 || Data for led-chain 0.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Please ignore the other connectors on the board. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Each pin controls 75 leds: &lt;br /&gt;
&lt;br /&gt;
{| border=1&lt;br /&gt;
! pin  !! leds&lt;br /&gt;
|-&lt;br /&gt;
| D0 || 0-74&lt;br /&gt;
|-&lt;br /&gt;
| D1 || 75-149&lt;br /&gt;
|-&lt;br /&gt;
| D2 || 150-224&lt;br /&gt;
|-&lt;br /&gt;
| D3 || 225-299&lt;br /&gt;
|-&lt;br /&gt;
| D4 || 300-374&lt;br /&gt;
|-&lt;br /&gt;
| D5 || 375-449&lt;br /&gt;
|-&lt;br /&gt;
| D6 || 450-524&lt;br /&gt;
|-&lt;br /&gt;
| D7 || 525-599&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== LEDs ===&lt;br /&gt;
&lt;br /&gt;
There are two leds. One is the power led. It should be lit whenever the USB is connected. The other should blink every two seconds (one second on, one second off).&lt;br /&gt;
&lt;br /&gt;
== Jumper settings ==&lt;br /&gt;
&lt;br /&gt;
This board has no jumpers. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Protocol ==&lt;br /&gt;
&lt;br /&gt;
When you connect the board to your PC or raspberry PI, you will get a virtual com port. You can use your favorite communications program to talk to the device. (I personally use &amp;quot;kermit&amp;quot; because I&amp;#039;ve been using that for 30 years. &amp;quot;Minicom&amp;quot; is also a good option) &lt;br /&gt;
&lt;br /&gt;
The board supports the following commands: &lt;br /&gt;
&lt;br /&gt;
=== help ===&lt;br /&gt;
&lt;br /&gt;
Print a list of supported commands, and also the compilation time of the firmware. &lt;br /&gt;
You might see a few commands that are there for debugging purposes. Consider those not described here as &amp;quot;do not use&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
=== pix ===&lt;br /&gt;
&lt;br /&gt;
 pix &amp;lt;num&amp;gt; &amp;lt;color&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set pixel &amp;quot;num&amp;quot; to color &amp;quot;color&amp;quot;. Color is specified in 6 hexadecimal digits specifying the color in RGB order. Specifying 102030 will set the red component to 0x10, or about 1/16th of full intensity, the green component to 0x20/0xff or aobut 1/8th of full intensity and blue to about 3/16th. &lt;br /&gt;
&lt;br /&gt;
===  shift ===&lt;br /&gt;
&lt;br /&gt;
Shift each chain one pixel towards the controller board. &lt;br /&gt;
&lt;br /&gt;
===  rainbow ===&lt;br /&gt;
&lt;br /&gt;
Create a rainbow color effect. &lt;br /&gt;
&lt;br /&gt;
   rainbow [start] [nleds]&lt;br /&gt;
&lt;br /&gt;
will create a rainbow starting at the led &amp;quot;start&amp;quot; and extend over &amp;quot;nleds&amp;quot; leds. The rainbow starts with red, fades via yellow, green, cyan, blue, violet back to red, so it is cyclic. &lt;br /&gt;
&lt;br /&gt;
===  white ===&lt;br /&gt;
&lt;br /&gt;
will set all leds to white. &lt;br /&gt;
&lt;br /&gt;
===  black ===&lt;br /&gt;
&lt;br /&gt;
will set all leds  off (black). &lt;br /&gt;
&lt;br /&gt;
=== color ===&lt;br /&gt;
&lt;br /&gt;
sets a fixed color. &lt;br /&gt;
&lt;br /&gt;
  color &amp;lt;color&amp;gt; [start] [nleds]&lt;br /&gt;
&lt;br /&gt;
Sets &amp;quot;nleds&amp;quot; starting at &amp;quot;start&amp;quot; to the color specified by &amp;quot;color&amp;quot;. &lt;br /&gt;
&lt;br /&gt;
===  fade ===&lt;br /&gt;
&lt;br /&gt;
creates a fade from one color to another color. &lt;br /&gt;
&lt;br /&gt;
  fade &amp;lt;start&amp;gt; &amp;lt;nleds&amp;gt; &amp;lt;color1&amp;gt; &amp;lt;color2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===   uid ===&lt;br /&gt;
&lt;br /&gt;
print the uuniq identifier for this board. &lt;br /&gt;
&lt;br /&gt;
Some chips have an&lt;br /&gt;
&lt;br /&gt;
== The software ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Default operation ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Future hardware enhancements ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Future software enhancements ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Changelog ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== 1.0 ===&lt;br /&gt;
* Initial public release&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=USB-step&amp;diff=3981</id>
		<title>USB-step</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=USB-step&amp;diff=3981"/>
		<updated>2016-01-08T12:17:04Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* pinout */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:usbstep.jpg|thumb|300px|alt=The USB_stepper board|The USB_stepper board]]&lt;br /&gt;
&lt;br /&gt;
= USB-step =&lt;br /&gt;
&lt;br /&gt;
The USB stepper allows you to step a small stepper a certain number of steps at regular intervals. &lt;br /&gt;
&lt;br /&gt;
The intended use is for example home-built clocks. &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
The usb-step has basically two connectors. The USB connector (micro USB), and a 5-pin JST for the stepper motor. &lt;br /&gt;
&lt;br /&gt;
The board has a few other connectors for debugging (for us), for power (GND/3V3/5V between the motor and USB connector), for SPI (in the future we might make it possible to add an SPI display for example), and for selecting the voltage of the powerpin of the SPI connector. These connectors are unpopulated. &lt;br /&gt;
&lt;br /&gt;
The board is 50x25. &lt;br /&gt;
&lt;br /&gt;
== pinout ==&lt;br /&gt;
&lt;br /&gt;
The JST power connector is something like &lt;br /&gt;
 1 - 5V&lt;br /&gt;
 2 - A+&lt;br /&gt;
 3 - B+&lt;br /&gt;
 4 - A-&lt;br /&gt;
 5 - B-&lt;br /&gt;
&lt;br /&gt;
== default ==&lt;br /&gt;
&lt;br /&gt;
By default the board will step every second, and make a full revolution in 15 minutes. &lt;br /&gt;
&lt;br /&gt;
== programming/protocol ==&lt;br /&gt;
&lt;br /&gt;
When you insert the board into your PC, you will get a virtual com port (VCP). &lt;br /&gt;
Under Windows you should get a device for which &amp;quot;no driver could be found&amp;quot;. install XXX this driver, and you will get a virtual com port. &lt;br /&gt;
&lt;br /&gt;
Use your favorite serial-communciation program to connect to the VCP. (I suggest Minicom for Linux users, putty for windows-users). &lt;br /&gt;
&lt;br /&gt;
you&amp;#039;ll be presented with a commandline interface. The &amp;quot;help&amp;quot; command lists the available commands. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;clock&amp;#039;&amp;#039;&amp;#039; lists or sets the &amp;quot;steps-per-second&amp;quot; setting.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;cal&amp;#039;&amp;#039;&amp;#039; lists or sets the crystal calbration. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;write&amp;#039;&amp;#039;&amp;#039; writes the current settings to flash. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;pat&amp;#039;&amp;#039;&amp;#039; allows setting the activation pattern. For forward use: 4 1 2 4 8, for reverse use &amp;quot;4 8 4 2 1&amp;quot; as the arguments. &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;step&amp;#039;&amp;#039;&amp;#039; allows setting the time that the motor is activated/stepping speed. Times are in ms.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For adjusting the clock setting you must know that the board uses microsteps. It won&amp;#039;t drive the motor with better than &amp;quot;full step&amp;quot; resolution, but it uses very small steps internally. The motor will make a full revolution every 34190060316 of these internal steps. The motor is actually stepped when the accumulated number of steps internally exceeds 2^24 = 16777216. So at the slowest setting, 1 internal microstep per second, the motor wil be issued a step every 2^24 seconds (about twice a year), resulting in a full revolution every milennium. &lt;br /&gt;
&lt;br /&gt;
The time required for each step limits the fastest possible stepping rate. You can experiment with reducing the &amp;quot;step&amp;quot; times with the &amp;#039;&amp;#039;&amp;#039;step&amp;#039;&amp;#039;&amp;#039; command to see what is the fastest possible step rate with your load. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== current usage ==&lt;br /&gt;
&lt;br /&gt;
the board uses about 120mA per motor-phase that is activated. Normally only one is activated at a time. The motor is powered off between the movements. We measured about 12mA &amp;quot;in rest&amp;quot;, Add to that (by default) about 1% times 120mA, the total average power is around 13-14 mA.&lt;br /&gt;
&lt;br /&gt;
== future ==&lt;br /&gt;
&lt;br /&gt;
In the future the interval between each group-of-steps will be configurable, currently fixed at &amp;quot;1s&amp;quot;.&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Usb_ws_2812&amp;diff=3980</id>
		<title>Usb ws 2812</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Usb_ws_2812&amp;diff=3980"/>
		<updated>2016-01-08T11:54:22Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: Redirected page to Usb ws2812&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT[[Usb ws2812]]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3979</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3979"/>
		<updated>2016-01-08T11:37:04Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* Resetting the WS2812 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Connecting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
First you just have to connect the WS2812 with a micro-USB cable to your device. &lt;br /&gt;
&lt;br /&gt;
You have to use C-kermit or PuTTY: &lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use an other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY]&lt;br /&gt;
&lt;br /&gt;
On a UNIX device, when you want to run the code from the device to the WS2812. You have to type in the terminal:&lt;br /&gt;
 /usr/bin/kermit -l /dev/ttyACM0 &lt;br /&gt;
It could be that you have to send to/from an other destination. &lt;br /&gt;
&lt;br /&gt;
It will then say C-kermit is opened. You then just have to type the letter:&lt;br /&gt;
 c&lt;br /&gt;
&lt;br /&gt;
It will tell you to turn off carrier watch with: &lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
If you don&amp;#039;t want to ask this every time you start up with c. You can make a new terminal and write:&lt;br /&gt;
 nano .kermrc &lt;br /&gt;
&lt;br /&gt;
That file(.kermrc) should only have the code:&lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
When the carrier-watch is off you have to type c again. &lt;br /&gt;
&lt;br /&gt;
Before you send a code to the ws2812 check it with:&lt;br /&gt;
 gcc -Wall -o randomname randomname.c&lt;br /&gt;
&lt;br /&gt;
After that you can send it to the ws2812 with:&lt;br /&gt;
 ./randomname &amp;gt; /dev/ttyACM1&lt;br /&gt;
&lt;br /&gt;
== Resetting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
Maybe you will get the experience that the ws2812 crashes and has to be reseted. When the RGB leds are still attached they will give a rainbow effect. To reset the WS2812 you have to put a cable in pin 5 of the 6 pin connector with a ground.  The ground of the ws2812 is every odd number on the 16 pin connector. &lt;br /&gt;
After that you can do the previous commands and everything should work fine again.&lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*WS2812 usb controller: [http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 Shop link] | [[Usb ws2812|Wiki link]]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
The image pretty much explains itself. What you have to do is connect RGB with the 3-pin header.( GND - pin 1  | DO - pin 2 | +5V - pin 3 ) &lt;br /&gt;
The pointers of this example RGB strip should be pointing away from the WS2812 usb controller.&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I drew a Christmas tree. At the points where every single RGB led were laying I put a dot by using a pencil.&lt;br /&gt;
After that I cut the tree out and made holes at the pencil dots. After that I used some scotch tape to bring the front and back paper together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The full c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
What the code does in short is this: When starting up it will make the the peak RGB led white. It will then read the for statement where it goes through all the RGB leds(Except the peak). Every RGB led will randomly get the color green or red. The script will then keep fading the colors of the RGB leds to the opposite color. ( red to green or green to red )    &lt;br /&gt;
&lt;br /&gt;
The parts of the script that I will give some explanation:&lt;br /&gt;
&lt;br /&gt;
Here I made a list of colors(if you also want other colors search for: color table): &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000&lt;br /&gt;
Because it&amp;#039;s RGB ( red green blue ) the first two numbers after 0x can be used for changing the red color value. The middle two numbers are for the amount of green and the last two are for blue. With RGB you can mix the colors into different colors.    &lt;br /&gt;
&lt;br /&gt;
Here the amount of time and steps in milliseconds is given for to make the fading go fluent. &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
In interpolate it will get the values from fadeto three times ( for every color r, g &amp;amp; b ) &lt;br /&gt;
It will give new values to c1 and c2 it will bit shift it to the right, and give it the value together with 0xff.  &lt;br /&gt;
After that it calculates difference between previous color.&lt;br /&gt;
&lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
Void fadeto receives the information from int main for example: (5, RED, GREEN). &lt;br /&gt;
It will give the information to every single part of the rgb led. So in this example it would be that red will change from 80 to 00. &lt;br /&gt;
it will keep doing calculations of the steps until it reached 30(nfadesteps). &lt;br /&gt;
After that it prints out on the certain RGB led that given color values.&lt;br /&gt;
&lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here are the given amount of RGB leds is given. When you want to run the script you can give a value after it. ( ./randomname 20 ) When the script runs it will look if a value about one is given if it is true it will give nleds an new value. &lt;br /&gt;
&lt;br /&gt;
After that the peak RGB led will become white.&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
&lt;br /&gt;
The for statement will count from zero till nine. Every time it counts one up it will get a random number and use a remainder that divides it to two. The result could be a zero or an one. If it is zero the color red will be given else it would be green. After that it will directly be printed, so that the for statement can count to the next number until it reached the end.  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
In the while statement it has to choose a random led. It does this by giving a random number and remainder it with nleds. It will then look if the chosen RGB led is red. If that is true it will say that the newcolor it has to become is green. Else the opposite will happen. ( The RGB led will become red. ) The given values will then be send to fadeto. ( Example: (5, RED, GREEN). After that it will replace the previous color with the newcolor. so pixels[05] would become green. &lt;br /&gt;
&lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812|usb ws2812 wiki]] &lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B Operator list of C]&lt;br /&gt;
*[http://www.cplusplus.com/ C programming site]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3978</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3978"/>
		<updated>2016-01-08T11:32:47Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* Resetting the WS2812 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Connecting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
First you just have to connect the WS2812 with a micro-USB cable to your device. &lt;br /&gt;
&lt;br /&gt;
You have to use C-kermit or PuTTY: &lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use an other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY]&lt;br /&gt;
&lt;br /&gt;
On a UNIX device, when you want to run the code from the device to the WS2812. You have to type in the terminal:&lt;br /&gt;
 /usr/bin/kermit -l /dev/ttyACM0 &lt;br /&gt;
It could be that you have to send to/from an other destination. &lt;br /&gt;
&lt;br /&gt;
It will then say C-kermit is opened. You then just have to type the letter:&lt;br /&gt;
 c&lt;br /&gt;
&lt;br /&gt;
It will tell you to turn off carrier watch with: &lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
If you don&amp;#039;t want to ask this every time you start up with c. You can make a new terminal and write:&lt;br /&gt;
 nano .kermrc &lt;br /&gt;
&lt;br /&gt;
That file(.kermrc) should only have the code:&lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
When the carrier-watch is off you have to type c again. &lt;br /&gt;
&lt;br /&gt;
Before you send a code to the ws2812 check it with:&lt;br /&gt;
 gcc -Wall -o randomname randomname.c&lt;br /&gt;
&lt;br /&gt;
After that you can send it to the ws2812 with:&lt;br /&gt;
 ./randomname &amp;gt; /dev/ttyACM1&lt;br /&gt;
&lt;br /&gt;
== Resetting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
Maybe you will get the experience that the ws2812 crashes and has to be reseted. When the RGB leds are still attached they will give a rainbow effect. To reset the WS2812 you have put a male-female cable on pin 5 on the horizontal connector. The male part of the connector should then hit the ground once. The grounds on the ws2812 are the odd numbers for the 16 pins. &lt;br /&gt;
After that you can do the previous commands and everything should work fine again.&lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*WS2812 usb controller: [http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 Shop link] | [[Usb ws2812|Wiki link]]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
The image pretty much explains itself. What you have to do is connect RGB with the 3-pin header.( GND - pin 1  | DO - pin 2 | +5V - pin 3 ) &lt;br /&gt;
The pointers of this example RGB strip should be pointing away from the WS2812 usb controller.&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I drew a Christmas tree. At the points where every single RGB led were laying I put a dot by using a pencil.&lt;br /&gt;
After that I cut the tree out and made holes at the pencil dots. After that I used some scotch tape to bring the front and back paper together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The full c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
What the code does in short is this: When starting up it will make the the peak RGB led white. It will then read the for statement where it goes through all the RGB leds(Except the peak). Every RGB led will randomly get the color green or red. The script will then keep fading the colors of the RGB leds to the opposite color. ( red to green or green to red )    &lt;br /&gt;
&lt;br /&gt;
The parts of the script that I will give some explanation:&lt;br /&gt;
&lt;br /&gt;
Here I made a list of colors(if you also want other colors search for: color table): &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000&lt;br /&gt;
Because it&amp;#039;s RGB ( red green blue ) the first two numbers after 0x can be used for changing the red color value. The middle two numbers are for the amount of green and the last two are for blue. With RGB you can mix the colors into different colors.    &lt;br /&gt;
&lt;br /&gt;
Here the amount of time and steps in milliseconds is given for to make the fading go fluent. &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
In interpolate it will get the values from fadeto three times ( for every color r, g &amp;amp; b ) &lt;br /&gt;
It will give new values to c1 and c2 it will bit shift it to the right, and give it the value together with 0xff.  &lt;br /&gt;
After that it calculates difference between previous color.&lt;br /&gt;
&lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
Void fadeto receives the information from int main for example: (5, RED, GREEN). &lt;br /&gt;
It will give the information to every single part of the rgb led. So in this example it would be that red will change from 80 to 00. &lt;br /&gt;
it will keep doing calculations of the steps until it reached 30(nfadesteps). &lt;br /&gt;
After that it prints out on the certain RGB led that given color values.&lt;br /&gt;
&lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here are the given amount of RGB leds is given. When you want to run the script you can give a value after it. ( ./randomname 20 ) When the script runs it will look if a value about one is given if it is true it will give nleds an new value. &lt;br /&gt;
&lt;br /&gt;
After that the peak RGB led will become white.&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
&lt;br /&gt;
The for statement will count from zero till nine. Every time it counts one up it will get a random number and use a remainder that divides it to two. The result could be a zero or an one. If it is zero the color red will be given else it would be green. After that it will directly be printed, so that the for statement can count to the next number until it reached the end.  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
In the while statement it has to choose a random led. It does this by giving a random number and remainder it with nleds. It will then look if the chosen RGB led is red. If that is true it will say that the newcolor it has to become is green. Else the opposite will happen. ( The RGB led will become red. ) The given values will then be send to fadeto. ( Example: (5, RED, GREEN). After that it will replace the previous color with the newcolor. so pixels[05] would become green. &lt;br /&gt;
&lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812|usb ws2812 wiki]] &lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B Operator list of C]&lt;br /&gt;
*[http://www.cplusplus.com/ C programming site]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Main_Page&amp;diff=3977</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Main_Page&amp;diff=3977"/>
		<updated>2016-01-08T11:27:45Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* Other boards */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;#039;&amp;#039;&amp;#039;BitWizard documentation wiki.&amp;#039;&amp;#039;&amp;#039;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This WIKI is for documentation of the BitWizard SPI/I2C expansion system and other boards, available from the [http://www.bitwizard.nl/catalog/ BitWizard Shop]. If you are considering adding information that is not related to one of our products, please contact us beforehand.&amp;lt;br&amp;gt;&lt;br /&gt;
It is expressly forbidden to add information intended to promote other sites. It is expressly forbidden to have a program add accounts and add articles with links to other sites. &lt;br /&gt;
&lt;br /&gt;
= How-to&amp;#039;s =&lt;br /&gt;
* [[Beginners guide to SPI on Raspberry Pi]]&lt;br /&gt;
* [[Installing and booting FriendlyArm mini6410]]&lt;br /&gt;
&lt;br /&gt;
= Kits =&lt;br /&gt;
* [[RGB clock]]&lt;br /&gt;
* [[Raspberry Pi camera extension kit]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Developement boards =&lt;br /&gt;
* [[Raspduino]]&lt;br /&gt;
* [[FTDI_ATmega]]&lt;br /&gt;
* [[USB-multio]]&lt;br /&gt;
* [[Usbbigmultio]]&lt;br /&gt;
* [[Cyclone dev board]]&lt;br /&gt;
&lt;br /&gt;
= Expansion boards =&lt;br /&gt;
&lt;br /&gt;
== General ==&lt;br /&gt;
* [[Default addresses]] (both SPI and I2C)&lt;br /&gt;
* [[SPI versus I2C protocols]]&lt;br /&gt;
* [[Daisy-chaining BitWizard I2C boards]]&lt;br /&gt;
* [[USB Relay]]&lt;br /&gt;
* [[Model B+ compatibility]]&lt;br /&gt;
&lt;br /&gt;
== Board specific pages ==&lt;br /&gt;
These expansion boards come in I2C and SPI versions, and thus can be connected to a single bus. This allows you to easily expand your microcontroller system with new functions, without the cost of additional I/O pins.&lt;br /&gt;
&lt;br /&gt;
* [[LCD|LCD]]&lt;br /&gt;
* [[DIO|DIO]]&lt;br /&gt;
* [[Servo|Servo]]&lt;br /&gt;
* [[7FETs|7FETs]]&lt;br /&gt;
* [[3FETs|3FETs]]&lt;br /&gt;
* [[temp|Temperature Interface]]&lt;br /&gt;
* [[relay|Relay/BigRelay]]&lt;br /&gt;
* [[motor|Motor]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [[PiPower|PiPower]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* [[Raspberry Juice]]&lt;br /&gt;
* [[Raspberry Relay]]&lt;br /&gt;
* [[User Interface|User Interface]]&lt;br /&gt;
* [[7_Segment]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [[SPI_SPI]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* [[Pushbutton]]&lt;br /&gt;
* [[Rtc]]&lt;br /&gt;
* [[Dimmer]]&lt;br /&gt;
* [[16 LEDs]]&lt;br /&gt;
&lt;br /&gt;
== Other boards ==&lt;br /&gt;
* [[USB-SATA powerswitch]]&lt;br /&gt;
* [[USB-opto]]&lt;br /&gt;
* [[Servotester]]&lt;br /&gt;
* [[USB-step]]&lt;br /&gt;
* [[Usb ws2812]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [[USB relay board]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Breakout boards =&lt;br /&gt;
&lt;br /&gt;
* [[Raspberry Pi Serial]]&lt;br /&gt;
* [[Dio breakout]]&lt;br /&gt;
&lt;br /&gt;
== FTDI chips ==&lt;br /&gt;
&lt;br /&gt;
* [[FT201X]] USB I2C slave&lt;br /&gt;
* [[FT220X]] USB 4-bit SPI/FT1248&lt;br /&gt;
* [[FT221X]] USB 8-bit SPI/FT1248&lt;br /&gt;
* [[FT230X]] USB to basic UART&lt;br /&gt;
* [[FT231X]] USB to full handshake UART&lt;br /&gt;
* [[FT240X]] USB 8-bit FIFO&lt;br /&gt;
* [[FT245RL V1.5]] USB FIFO&lt;br /&gt;
* [[FT311D]] USB Android host, compatible with AOA (Android Open Accessory)&lt;br /&gt;
* [[FT312D]] USB Android host, compatible with AOA (Android Open Accessory)&lt;br /&gt;
* [[FT245RL breakout board]]&lt;br /&gt;
* [[FT2232H breakout board]]&lt;br /&gt;
* [[FTDI serial]]&lt;br /&gt;
* [[FTDI serial 2]]&lt;br /&gt;
&lt;br /&gt;
== I2C chips ==&lt;br /&gt;
* [[I2C DAC|Dual MCP4726 DAC]]&lt;br /&gt;
* [[I2C ADC|MCP3424 ADC]]&lt;br /&gt;
* [[I2C splitter|PCA9548A I2C switch/mux]]&lt;br /&gt;
* [[IO Expander|MCP23008 IO Expander]]&lt;br /&gt;
* [[I2C accellerometer]]&lt;br /&gt;
* [[I2C magnetometer]]&lt;br /&gt;
* [[I2C pressure sensor]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== SPI chips ==&lt;br /&gt;
* [[IO Expander|MCP23S08 IO Expander]]&lt;br /&gt;
* [[SPI DAC|MCP4822 DAC]]&lt;br /&gt;
&lt;br /&gt;
= Sample programs =&lt;br /&gt;
* [[Usbio kitt]]&lt;br /&gt;
* [[Usbio ACM sample program]]&lt;br /&gt;
* [[Raspberry Pi LCD program]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= Preparing your development environment =&lt;br /&gt;
* [[Linux]]&lt;br /&gt;
* [[Windows]]&lt;br /&gt;
* [[MacOS]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
= Sample projects =&lt;br /&gt;
* [[Temperature control]] (ftdi_atmega, spi_temp, spi_relay).&lt;br /&gt;
&lt;br /&gt;
= Raspberry Pi projects =&lt;br /&gt;
* [[Reducing power consumption of a raspberry Pi]]&lt;br /&gt;
* [[LCD + 3FETs demonstration|Connecting two 1602 LCDs and an RGB LED Strip to a Raspberry Pi]]&lt;br /&gt;
* [[Connecting a motor and 1602 LCD to a Raspberry Pi]]&lt;br /&gt;
* [[MPU-6050 sensor connected to Raspberry Pi]]&lt;br /&gt;
* [[Raspberry pi expansion system page]]&lt;br /&gt;
* [[GPS reciever connected to Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
= Help! =&lt;br /&gt;
&lt;br /&gt;
If you have trouble finding things on this wiki you can: &lt;br /&gt;
* Use the search function on the left&lt;br /&gt;
* [http://www.bitwizard.nl/contact.php Contact us]&lt;br /&gt;
* Or use the [http://forum.bitwizard.nl/  forum]&lt;br /&gt;
&lt;br /&gt;
= Miscellaneous =&lt;br /&gt;
* [[Solder jumpers]]&lt;br /&gt;
* [[SPI_connector_pinout]]&lt;br /&gt;
* [[Template]]&lt;br /&gt;
* [[Nikon D80 wired remote]]&lt;br /&gt;
* [[Iphone 3GS camera]]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Main_Page&amp;diff=3976</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Main_Page&amp;diff=3976"/>
		<updated>2016-01-08T11:24:30Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* Breakout boards */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;big&amp;gt;&amp;#039;&amp;#039;&amp;#039;BitWizard documentation wiki.&amp;#039;&amp;#039;&amp;#039;&amp;lt;/big&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This WIKI is for documentation of the BitWizard SPI/I2C expansion system and other boards, available from the [http://www.bitwizard.nl/catalog/ BitWizard Shop]. If you are considering adding information that is not related to one of our products, please contact us beforehand.&amp;lt;br&amp;gt;&lt;br /&gt;
It is expressly forbidden to add information intended to promote other sites. It is expressly forbidden to have a program add accounts and add articles with links to other sites. &lt;br /&gt;
&lt;br /&gt;
= How-to&amp;#039;s =&lt;br /&gt;
* [[Beginners guide to SPI on Raspberry Pi]]&lt;br /&gt;
* [[Installing and booting FriendlyArm mini6410]]&lt;br /&gt;
&lt;br /&gt;
= Kits =&lt;br /&gt;
* [[RGB clock]]&lt;br /&gt;
* [[Raspberry Pi camera extension kit]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Developement boards =&lt;br /&gt;
* [[Raspduino]]&lt;br /&gt;
* [[FTDI_ATmega]]&lt;br /&gt;
* [[USB-multio]]&lt;br /&gt;
* [[Usbbigmultio]]&lt;br /&gt;
* [[Cyclone dev board]]&lt;br /&gt;
&lt;br /&gt;
= Expansion boards =&lt;br /&gt;
&lt;br /&gt;
== General ==&lt;br /&gt;
* [[Default addresses]] (both SPI and I2C)&lt;br /&gt;
* [[SPI versus I2C protocols]]&lt;br /&gt;
* [[Daisy-chaining BitWizard I2C boards]]&lt;br /&gt;
* [[USB Relay]]&lt;br /&gt;
* [[Model B+ compatibility]]&lt;br /&gt;
&lt;br /&gt;
== Board specific pages ==&lt;br /&gt;
These expansion boards come in I2C and SPI versions, and thus can be connected to a single bus. This allows you to easily expand your microcontroller system with new functions, without the cost of additional I/O pins.&lt;br /&gt;
&lt;br /&gt;
* [[LCD|LCD]]&lt;br /&gt;
* [[DIO|DIO]]&lt;br /&gt;
* [[Servo|Servo]]&lt;br /&gt;
* [[7FETs|7FETs]]&lt;br /&gt;
* [[3FETs|3FETs]]&lt;br /&gt;
* [[temp|Temperature Interface]]&lt;br /&gt;
* [[relay|Relay/BigRelay]]&lt;br /&gt;
* [[motor|Motor]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [[PiPower|PiPower]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* [[Raspberry Juice]]&lt;br /&gt;
* [[Raspberry Relay]]&lt;br /&gt;
* [[User Interface|User Interface]]&lt;br /&gt;
* [[7_Segment]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [[SPI_SPI]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
* [[Pushbutton]]&lt;br /&gt;
* [[Rtc]]&lt;br /&gt;
* [[Dimmer]]&lt;br /&gt;
* [[16 LEDs]]&lt;br /&gt;
&lt;br /&gt;
== Other boards ==&lt;br /&gt;
* [[USB-SATA powerswitch]]&lt;br /&gt;
* [[USB-opto]]&lt;br /&gt;
* [[Servotester]]&lt;br /&gt;
* [[USB-step]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
* [[USB relay board]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Breakout boards =&lt;br /&gt;
&lt;br /&gt;
* [[Raspberry Pi Serial]]&lt;br /&gt;
* [[Dio breakout]]&lt;br /&gt;
&lt;br /&gt;
== FTDI chips ==&lt;br /&gt;
&lt;br /&gt;
* [[FT201X]] USB I2C slave&lt;br /&gt;
* [[FT220X]] USB 4-bit SPI/FT1248&lt;br /&gt;
* [[FT221X]] USB 8-bit SPI/FT1248&lt;br /&gt;
* [[FT230X]] USB to basic UART&lt;br /&gt;
* [[FT231X]] USB to full handshake UART&lt;br /&gt;
* [[FT240X]] USB 8-bit FIFO&lt;br /&gt;
* [[FT245RL V1.5]] USB FIFO&lt;br /&gt;
* [[FT311D]] USB Android host, compatible with AOA (Android Open Accessory)&lt;br /&gt;
* [[FT312D]] USB Android host, compatible with AOA (Android Open Accessory)&lt;br /&gt;
* [[FT245RL breakout board]]&lt;br /&gt;
* [[FT2232H breakout board]]&lt;br /&gt;
* [[FTDI serial]]&lt;br /&gt;
* [[FTDI serial 2]]&lt;br /&gt;
&lt;br /&gt;
== I2C chips ==&lt;br /&gt;
* [[I2C DAC|Dual MCP4726 DAC]]&lt;br /&gt;
* [[I2C ADC|MCP3424 ADC]]&lt;br /&gt;
* [[I2C splitter|PCA9548A I2C switch/mux]]&lt;br /&gt;
* [[IO Expander|MCP23008 IO Expander]]&lt;br /&gt;
* [[I2C accellerometer]]&lt;br /&gt;
* [[I2C magnetometer]]&lt;br /&gt;
* [[I2C pressure sensor]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== SPI chips ==&lt;br /&gt;
* [[IO Expander|MCP23S08 IO Expander]]&lt;br /&gt;
* [[SPI DAC|MCP4822 DAC]]&lt;br /&gt;
&lt;br /&gt;
= Sample programs =&lt;br /&gt;
* [[Usbio kitt]]&lt;br /&gt;
* [[Usbio ACM sample program]]&lt;br /&gt;
* [[Raspberry Pi LCD program]]&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
= Preparing your development environment =&lt;br /&gt;
* [[Linux]]&lt;br /&gt;
* [[Windows]]&lt;br /&gt;
* [[MacOS]]&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
= Sample projects =&lt;br /&gt;
* [[Temperature control]] (ftdi_atmega, spi_temp, spi_relay).&lt;br /&gt;
&lt;br /&gt;
= Raspberry Pi projects =&lt;br /&gt;
* [[Reducing power consumption of a raspberry Pi]]&lt;br /&gt;
* [[LCD + 3FETs demonstration|Connecting two 1602 LCDs and an RGB LED Strip to a Raspberry Pi]]&lt;br /&gt;
* [[Connecting a motor and 1602 LCD to a Raspberry Pi]]&lt;br /&gt;
* [[MPU-6050 sensor connected to Raspberry Pi]]&lt;br /&gt;
* [[Raspberry pi expansion system page]]&lt;br /&gt;
* [[GPS reciever connected to Raspberry Pi]]&lt;br /&gt;
&lt;br /&gt;
= Help! =&lt;br /&gt;
&lt;br /&gt;
If you have trouble finding things on this wiki you can: &lt;br /&gt;
* Use the search function on the left&lt;br /&gt;
* [http://www.bitwizard.nl/contact.php Contact us]&lt;br /&gt;
* Or use the [http://forum.bitwizard.nl/  forum]&lt;br /&gt;
&lt;br /&gt;
= Miscellaneous =&lt;br /&gt;
* [[Solder jumpers]]&lt;br /&gt;
* [[SPI_connector_pinout]]&lt;br /&gt;
* [[Template]]&lt;br /&gt;
* [[Nikon D80 wired remote]]&lt;br /&gt;
* [[Iphone 3GS camera]]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3975</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3975"/>
		<updated>2016-01-08T10:35:14Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* Useful links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Connecting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
First you just have to connect the WS2812 with a micro-USB cable to your device. &lt;br /&gt;
&lt;br /&gt;
You have to use C-kermit or PuTTY: &lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use an other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY]&lt;br /&gt;
&lt;br /&gt;
On a UNIX device, when you want to run the code from the device to the WS2812. You have to type in the terminal:&lt;br /&gt;
 /usr/bin/kermit -l /dev/ttyACM0 &lt;br /&gt;
It could be that you have to send to/from an other destination. &lt;br /&gt;
&lt;br /&gt;
It will then say C-kermit is opened. You then just have to type the letter:&lt;br /&gt;
 c&lt;br /&gt;
&lt;br /&gt;
It will tell you to turn off carrier watch with: &lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
If you don&amp;#039;t want to ask this every time you start up with c. You can make a new terminal and write:&lt;br /&gt;
 nano .kermrc &lt;br /&gt;
&lt;br /&gt;
That file(.kermrc) should only have the code:&lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
When the carrier-watch is off you have to type c again. &lt;br /&gt;
&lt;br /&gt;
Before you send a code to the ws2812 check it with:&lt;br /&gt;
 gcc -Wall -o randomname randomname.c&lt;br /&gt;
&lt;br /&gt;
After that you can send it to the ws2812 with:&lt;br /&gt;
 ./randomname &amp;gt; /dev/ttyACM1&lt;br /&gt;
&lt;br /&gt;
== Resetting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
Maybe you will get the experience that the ws2812 crashed and has to be resetted. When the RGB leds are still attached they will get a rainbow effect. To reset the WS2812 you have put a male-female cable on pin 5 on the horizontal connector. The male part of the connector should then hit the ground once. After that you can do the previous commands and everything should work fine again.&lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*WS2812 usb controller: [http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 Shop link] | [[Usb ws2812|Wiki link]]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
The image pretty much explains itself. What you have to do is connect RGB with the 3-pin header.( GND - pin 1  | DO - pin 2 | +5V - pin 3 ) &lt;br /&gt;
The pointers of this example RGB strip should be pointing away from the WS2812 usb controller.&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I drew a Christmas tree. At the points where every single RGB led were laying I put a dot by using a pencil.&lt;br /&gt;
After that I cut the tree out and made holes at the pencil dots. After that I used some scotch tape to bring the front and back paper together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The full c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
What the code does in short is this: When starting up it will make the the peak RGB led white. It will then read the for statement where it goes through all the RGB leds(Except the peak). Every RGB led will randomly get the color green or red. The script will then keep fading the colors of the RGB leds to the opposite color. ( red to green or green to red )    &lt;br /&gt;
&lt;br /&gt;
The parts of the script that I will give some explanation:&lt;br /&gt;
&lt;br /&gt;
Here I made a list of colors(if you also want other colors search for: color table): &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000&lt;br /&gt;
Because it&amp;#039;s RGB ( red green blue ) the first two numbers after 0x can be used for changing the red color value. The middle two numbers are for the amount of green and the last two are for blue. With RGB you can mix the colors into different colors.    &lt;br /&gt;
&lt;br /&gt;
Here the amount of time and steps in milliseconds is given for to make the fading go fluent. &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
In interpolate it will get the values from fadeto three times ( for every color r, g &amp;amp; b ) &lt;br /&gt;
It will give new values to c1 and c2 it will bit shift it to the right, and give it the value together with 0xff.  &lt;br /&gt;
After that it calculates difference between previous color.&lt;br /&gt;
&lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
Void fadeto receives the information from int main for example: (5, RED, GREEN). &lt;br /&gt;
It will give the information to every single part of the rgb led. So in this example it would be that red will change from 80 to 00. &lt;br /&gt;
it will keep doing calculations of the steps until it reached 30(nfadesteps). &lt;br /&gt;
After that it prints out on the certain RGB led that given color values.&lt;br /&gt;
&lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here are the given amount of RGB leds is given. When you want to run the script you can give a value after it. ( ./randomname 20 ) When the script runs it will look if a value about one is given if it is true it will give nleds an new value. &lt;br /&gt;
&lt;br /&gt;
After that the peak RGB led will become white.&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
&lt;br /&gt;
The for statement will count from zero till nine. Every time it counts one up it will get a random number and use a remainder that divides it to two. The result could be a zero or an one. If it is zero the color red will be given else it would be green. After that it will directly be printed, so that the for statement can count to the next number until it reached the end.  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
In the while statement it has to choose a random led. It does this by giving a random number and remainder it with nleds. It will then look if the chosen RGB led is red. If that is true it will say that the newcolor it has to become is green. Else the opposite will happen. ( The RGB led will become red. ) The given values will then be send to fadeto. ( Example: (5, RED, GREEN). After that it will replace the previous color with the newcolor. so pixels[05] would become green. &lt;br /&gt;
&lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812|usb ws2812 wiki]] &lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B Operator list of C]&lt;br /&gt;
*[http://www.cplusplus.com/ C programming site]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3974</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3974"/>
		<updated>2016-01-08T10:33:44Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* The code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Connecting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
First you just have to connect the WS2812 with a micro-USB cable to your device. &lt;br /&gt;
&lt;br /&gt;
You have to use C-kermit or PuTTY: &lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use an other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY]&lt;br /&gt;
&lt;br /&gt;
On a UNIX device, when you want to run the code from the device to the WS2812. You have to type in the terminal:&lt;br /&gt;
 /usr/bin/kermit -l /dev/ttyACM0 &lt;br /&gt;
It could be that you have to send to/from an other destination. &lt;br /&gt;
&lt;br /&gt;
It will then say C-kermit is opened. You then just have to type the letter:&lt;br /&gt;
 c&lt;br /&gt;
&lt;br /&gt;
It will tell you to turn off carrier watch with: &lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
If you don&amp;#039;t want to ask this every time you start up with c. You can make a new terminal and write:&lt;br /&gt;
 nano .kermrc &lt;br /&gt;
&lt;br /&gt;
That file(.kermrc) should only have the code:&lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
When the carrier-watch is off you have to type c again. &lt;br /&gt;
&lt;br /&gt;
Before you send a code to the ws2812 check it with:&lt;br /&gt;
 gcc -Wall -o randomname randomname.c&lt;br /&gt;
&lt;br /&gt;
After that you can send it to the ws2812 with:&lt;br /&gt;
 ./randomname &amp;gt; /dev/ttyACM1&lt;br /&gt;
&lt;br /&gt;
== Resetting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
Maybe you will get the experience that the ws2812 crashed and has to be resetted. When the RGB leds are still attached they will get a rainbow effect. To reset the WS2812 you have put a male-female cable on pin 5 on the horizontal connector. The male part of the connector should then hit the ground once. After that you can do the previous commands and everything should work fine again.&lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*WS2812 usb controller: [http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 Shop link] | [[Usb ws2812|Wiki link]]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
The image pretty much explains itself. What you have to do is connect RGB with the 3-pin header.( GND - pin 1  | DO - pin 2 | +5V - pin 3 ) &lt;br /&gt;
The pointers of this example RGB strip should be pointing away from the WS2812 usb controller.&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I drew a Christmas tree. At the points where every single RGB led were laying I put a dot by using a pencil.&lt;br /&gt;
After that I cut the tree out and made holes at the pencil dots. After that I used some scotch tape to bring the front and back paper together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The full c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
What the code does in short is this: When starting up it will make the the peak RGB led white. It will then read the for statement where it goes through all the RGB leds(Except the peak). Every RGB led will randomly get the color green or red. The script will then keep fading the colors of the RGB leds to the opposite color. ( red to green or green to red )    &lt;br /&gt;
&lt;br /&gt;
The parts of the script that I will give some explanation:&lt;br /&gt;
&lt;br /&gt;
Here I made a list of colors(if you also want other colors search for: color table): &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000&lt;br /&gt;
Because it&amp;#039;s RGB ( red green blue ) the first two numbers after 0x can be used for changing the red color value. The middle two numbers are for the amount of green and the last two are for blue. With RGB you can mix the colors into different colors.    &lt;br /&gt;
&lt;br /&gt;
Here the amount of time and steps in milliseconds is given for to make the fading go fluent. &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
In interpolate it will get the values from fadeto three times ( for every color r, g &amp;amp; b ) &lt;br /&gt;
It will give new values to c1 and c2 it will bit shift it to the right, and give it the value together with 0xff.  &lt;br /&gt;
After that it calculates difference between previous color.&lt;br /&gt;
&lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
Void fadeto receives the information from int main for example: (5, RED, GREEN). &lt;br /&gt;
It will give the information to every single part of the rgb led. So in this example it would be that red will change from 80 to 00. &lt;br /&gt;
it will keep doing calculations of the steps until it reached 30(nfadesteps). &lt;br /&gt;
After that it prints out on the certain RGB led that given color values.&lt;br /&gt;
&lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Here are the given amount of RGB leds is given. When you want to run the script you can give a value after it. ( ./randomname 20 ) When the script runs it will look if a value about one is given if it is true it will give nleds an new value. &lt;br /&gt;
&lt;br /&gt;
After that the peak RGB led will become white.&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
&lt;br /&gt;
The for statement will count from zero till nine. Every time it counts one up it will get a random number and use a remainder that divides it to two. The result could be a zero or an one. If it is zero the color red will be given else it would be green. After that it will directly be printed, so that the for statement can count to the next number until it reached the end.  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
In the while statement it has to choose a random led. It does this by giving a random number and remainder it with nleds. It will then look if the chosen RGB led is red. If that is true it will say that the newcolor it has to become is green. Else the opposite will happen. ( The RGB led will become red. ) The given values will then be send to fadeto. ( Example: (5, RED, GREEN). After that it will replace the previous color with the newcolor. so pixels[05] would become green. &lt;br /&gt;
&lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812|usb ws2812 wiki]] &lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B Operator list of C]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3973</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3973"/>
		<updated>2016-01-08T09:38:21Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* The code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Connecting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
First you just have to connect the WS2812 with a micro-USB cable to your device. &lt;br /&gt;
&lt;br /&gt;
You have to use C-kermit or PuTTY: &lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use an other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY]&lt;br /&gt;
&lt;br /&gt;
On a UNIX device, when you want to run the code from the device to the WS2812. You have to type in the terminal:&lt;br /&gt;
 /usr/bin/kermit -l /dev/ttyACM0 &lt;br /&gt;
It could be that you have to send to/from an other destination. &lt;br /&gt;
&lt;br /&gt;
It will then say C-kermit is opened. You then just have to type the letter:&lt;br /&gt;
 c&lt;br /&gt;
&lt;br /&gt;
It will tell you to turn off carrier watch with: &lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
If you don&amp;#039;t want to ask this every time you start up with c. You can make a new terminal and write:&lt;br /&gt;
 nano .kermrc &lt;br /&gt;
&lt;br /&gt;
That file(.kermrc) should only have the code:&lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
When the carrier-watch is off you have to type c again. &lt;br /&gt;
&lt;br /&gt;
Before you send a code to the ws2812 check it with:&lt;br /&gt;
 gcc -Wall -o randomname randomname.c&lt;br /&gt;
&lt;br /&gt;
After that you can send it to the ws2812 with:&lt;br /&gt;
 ./randomname &amp;gt; /dev/ttyACM1&lt;br /&gt;
&lt;br /&gt;
== Resetting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
Maybe you will get the experience that the ws2812 crashed and has to be resetted. When the RGB leds are still attached they will get a rainbow effect. To reset the WS2812 you have put a male-female cable on pin 5 on the horizontal connector. The male part of the connector should then hit the ground once. After that you can do the previous commands and everything should work fine again.&lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*WS2812 usb controller: [http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 Shop link] | [[Usb ws2812|Wiki link]]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
The image pretty much explains itself. What you have to do is connect RGB with the 3-pin header.( GND - pin 1  | DO - pin 2 | +5V - pin 3 ) &lt;br /&gt;
The pointers of this example RGB strip should be pointing away from the WS2812 usb controller.&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I drew a Christmas tree. At the points where every single RGB led were laying I put a dot by using a pencil.&lt;br /&gt;
After that I cut the tree out and made holes at the pencil dots. After that I used some scotch tape to bring the front and back paper together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The full c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
What the code does in short is this: When starting up it will make the the peak RGB led white. It will then read the for statement where it goes through all the RGB leds(Except the peak). Every RGB led will randomly get the color green or red. The script will then keep fading the colors of the RGB leds to the opposite color. ( red to green or green to red )    &lt;br /&gt;
&lt;br /&gt;
The parts of the script that I will give some explanation:&lt;br /&gt;
&lt;br /&gt;
Here I made a list of colors(if you also want other colors search for: color table): &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000&lt;br /&gt;
Because it&amp;#039;s RGB ( red green blue ) the first two numbers after 0x can be used for changing the red color value. The middle two numbers are for the amount of green and the last two are for blue. With RGB you can mix the colors into different colors.    &lt;br /&gt;
&lt;br /&gt;
Here the amount of time and steps in milliseconds is given for to make the fading go fluent. &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
In interpolate it will get the values from fadeto three times ( for every color r, g &amp;amp; b ) &lt;br /&gt;
It will give new values to c1 and c2 it will bit shift it to the right, and give it the value together with 0xff.  &lt;br /&gt;
After that it calculates difference between previous color.&lt;br /&gt;
&lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
Void fadeto receives the information from int main for example: (5, RED, GREEN). &lt;br /&gt;
It will give the information to every single part of the rgb led. So in this example it would be that red will change from 80 to 00. &lt;br /&gt;
it will keep doing calculations of the steps until it reached 30(nfadesteps). &lt;br /&gt;
After that it prints out on the certain RGB led that given color values.&lt;br /&gt;
&lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After that the peak led will get white.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
&lt;br /&gt;
The for statement will count from zero till nine. Every time it counts one up it will get a random number and use a remainder that divides it to two. The result could be a zero or an one. If it is zero the color red will be given else it would be green. After that it will directly be printed, so that the for statement can count to the next number until it reached the end.  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
In the while statement it has to choose a random led. It does this by giving a random number and remainder it with nleds. It will then look if the chosen RGB led is red. If that is true it will say that the newcolor it has to become is green. Else the opposite will happen. ( The RGB led will become red. ) The given values will then be send to fadeto. ( Example: (5, RED, GREEN). After that it will replace the previous color with the newcolor. so pixels[05] would become green. &lt;br /&gt;
&lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812|usb ws2812 wiki]] &lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B Operator list of C]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3972</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3972"/>
		<updated>2016-01-08T08:48:27Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Connecting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
First you just have to connect the WS2812 with a micro-USB cable to your device. &lt;br /&gt;
&lt;br /&gt;
You have to use C-kermit or PuTTY: &lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use an other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY]&lt;br /&gt;
&lt;br /&gt;
On a UNIX device, when you want to run the code from the device to the WS2812. You have to type in the terminal:&lt;br /&gt;
 /usr/bin/kermit -l /dev/ttyACM0 &lt;br /&gt;
It could be that you have to send to/from an other destination. &lt;br /&gt;
&lt;br /&gt;
It will then say C-kermit is opened. You then just have to type the letter:&lt;br /&gt;
 c&lt;br /&gt;
&lt;br /&gt;
It will tell you to turn off carrier watch with: &lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
If you don&amp;#039;t want to ask this every time you start up with c. You can make a new terminal and write:&lt;br /&gt;
 nano .kermrc &lt;br /&gt;
&lt;br /&gt;
That file(.kermrc) should only have the code:&lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
When the carrier-watch is off you have to type c again. &lt;br /&gt;
&lt;br /&gt;
Before you send a code to the ws2812 check it with:&lt;br /&gt;
 gcc -Wall -o randomname randomname.c&lt;br /&gt;
&lt;br /&gt;
After that you can send it to the ws2812 with:&lt;br /&gt;
 ./randomname &amp;gt; /dev/ttyACM1&lt;br /&gt;
&lt;br /&gt;
== Resetting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
Maybe you will get the experience that the ws2812 crashed and has to be resetted. When the RGB leds are still attached they will get a rainbow effect. To reset the WS2812 you have put a male-female cable on pin 5 on the horizontal connector. The male part of the connector should then hit the ground once. After that you can do the previous commands and everything should work fine again.&lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*WS2812 usb controller: [http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 Shop link] | [[Usb ws2812|Wiki link]]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
The image pretty much explains itself. What you have to do is connect RGB with the 3-pin header.( GND - pin 1  | DO - pin 2 | +5V - pin 3 ) &lt;br /&gt;
The pointers of this example RGB strip should be pointing away from the WS2812 usb controller.&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I drew a Christmas tree. At the points where every single RGB led were laying I put a dot by using a pencil.&lt;br /&gt;
After that I cut the tree out and made holes at the pencil dots. After that I used some scotch tape to bring the front and back paper together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The full c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
What the code does in short is this: When starting up it will make the the peak RGB led white. It will then read the for statement where it goes through all the RGB leds(Except the peak). Every RGB led will randomly get the color green or red. The script will then keep fading the colors of the RGB leds to the opposite color. ( red to green or green to red )    &lt;br /&gt;
&lt;br /&gt;
The parts of the script that I will give some explanation:&lt;br /&gt;
&lt;br /&gt;
Here I made a list of colors(if you also want other colors search for: color table): &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000&lt;br /&gt;
Because it&amp;#039;s RGB ( red green blue ) the first two zeros can be used for changing the the amount of red color. The middle  two zeros are for the amount of green and the last two are for blue. With this you can mix the colors and make different colors.    &lt;br /&gt;
&lt;br /&gt;
Here the amount of time and steps in milliseconds is given for to make the fading go fluent. &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
In interpolate it will get the values from fadeto three times ( for every color r, g &amp;amp; b ) &lt;br /&gt;
It will give new values to c1 and c2 it will bit shift it to the right, and give it the value together with 0xff.  &lt;br /&gt;
After that it calculates difference between previous color.&lt;br /&gt;
&lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
Void fadeto receives the information from int main for example: (5, RED, GREEN). &lt;br /&gt;
It will give the information to every single part of the rgb led. So in this example it would be that red will change from 80 to 00. &lt;br /&gt;
it will keep doing calculations of the steps until it reached 30(nfadesteps). &lt;br /&gt;
After that it prints out on the certain RGB led that given color values.&lt;br /&gt;
&lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After that the peak led will get white.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
&lt;br /&gt;
The for statements is the first loop that is getting used. It will count from zero till nine. Every time it counts it will get a random number and use a remainder to divide it with. The result could be a zero or an one. If it is zero the color red will be given else it would be green. After that it will directly be printed, so that i can be changed to the next number.  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
In the while statement it has to choose a random led. It does this by giving a random number and remainder it with nleds. If it then has chosen the certain led it will look if the led is red. If that is true it will say that the newcolor has to become green. Else the opposite will happen, so that the led will become red. The given values will then be sended to fadeto. ( Example: (5, RED, GREEN). After that it will save the newcolour in the previous led color. so pixels[05] would become green. &lt;br /&gt;
&lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812|usb ws2812 wiki]] &lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B Operator list of C]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3971</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3971"/>
		<updated>2016-01-08T08:47:56Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Connecting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
First you just have to connect the WS2812 with a micro-USB cable to your device. &lt;br /&gt;
&lt;br /&gt;
You have to use C-kermit or PuTTY: &lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use an other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY]&lt;br /&gt;
&lt;br /&gt;
On a UNIX device, when you want to run the code from the device to the WS2812. You have to type in the terminal:&lt;br /&gt;
 /usr/bin/kermit -l /dev/ttyACM0 &lt;br /&gt;
It could be that you have to send to/from an other destination. &lt;br /&gt;
&lt;br /&gt;
It will then say C-kermit is opened. You then just have to type the letter:&lt;br /&gt;
 c&lt;br /&gt;
&lt;br /&gt;
It will tell you to turn off carrier watch with: &lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
If you don&amp;#039;t want to ask this every time you start up with c. You can make a new terminal and write:&lt;br /&gt;
 nano .kermrc &lt;br /&gt;
&lt;br /&gt;
That file(.kermrc) should only have the code:&lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
When the carrier-watch is off you have to type c again. &lt;br /&gt;
&lt;br /&gt;
Before you send a code to the ws2812 check it with:&lt;br /&gt;
 gcc -Wall -o randomname randomname.c&lt;br /&gt;
&lt;br /&gt;
After that you can send it to the ws2812 with:&lt;br /&gt;
 ./randomname &amp;gt; /dev/ttyACM1&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Resetting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
Maybe you will get the experience that the ws2812 crashed and has to be resetted. When the RGB leds are still attached they will get a rainbow effect. To reset the WS2812 you have put a male-female cable on pin 5 on the horizontal connector. The male part of the connector should then hit the ground once. After that you can do the previous commands and everything should work fine again.&lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*WS2812 usb controller: [http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 Shop link] | [[Usb ws2812|Wiki link]]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
The image pretty much explains itself. What you have to do is connect RGB with the 3-pin header.( GND - pin 1  | DO - pin 2 | +5V - pin 3 ) &lt;br /&gt;
The pointers of this example RGB strip should be pointing away from the WS2812 usb controller.&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I drew a Christmas tree. At the points where every single RGB led were laying I put a dot by using a pencil.&lt;br /&gt;
After that I cut the tree out and made holes at the pencil dots. After that I used some scotch tape to bring the front and back paper together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The full c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
What the code does in short is this: When starting up it will make the the peak RGB led white. It will then read the for statement where it goes through all the RGB leds(Except the peak). Every RGB led will randomly get the color green or red. The script will then keep fading the colors of the RGB leds to the opposite color. ( red to green or green to red )    &lt;br /&gt;
&lt;br /&gt;
The parts of the script that I will give some explanation:&lt;br /&gt;
&lt;br /&gt;
Here I made a list of colors(if you also want other colors search for: color table): &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000&lt;br /&gt;
Because it&amp;#039;s RGB ( red green blue ) the first two zeros can be used for changing the the amount of red color. The middle  two zeros are for the amount of green and the last two are for blue. With this you can mix the colors and make different colors.    &lt;br /&gt;
&lt;br /&gt;
Here the amount of time and steps in milliseconds is given for to make the fading go fluent. &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
In interpolate it will get the values from fadeto three times ( for every color r, g &amp;amp; b ) &lt;br /&gt;
It will give new values to c1 and c2 it will bit shift it to the right, and give it the value together with 0xff.  &lt;br /&gt;
After that it calculates difference between previous color.&lt;br /&gt;
&lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
Void fadeto receives the information from int main for example: (5, RED, GREEN). &lt;br /&gt;
It will give the information to every single part of the rgb led. So in this example it would be that red will change from 80 to 00. &lt;br /&gt;
it will keep doing calculations of the steps until it reached 30(nfadesteps). &lt;br /&gt;
After that it prints out on the certain RGB led that given color values.&lt;br /&gt;
&lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After that the peak led will get white.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
&lt;br /&gt;
The for statements is the first loop that is getting used. It will count from zero till nine. Every time it counts it will get a random number and use a remainder to divide it with. The result could be a zero or an one. If it is zero the color red will be given else it would be green. After that it will directly be printed, so that i can be changed to the next number.  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
In the while statement it has to choose a random led. It does this by giving a random number and remainder it with nleds. If it then has chosen the certain led it will look if the led is red. If that is true it will say that the newcolor has to become green. Else the opposite will happen, so that the led will become red. The given values will then be sended to fadeto. ( Example: (5, RED, GREEN). After that it will save the newcolour in the previous led color. so pixels[05] would become green. &lt;br /&gt;
&lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812|usb ws2812 wiki]] &lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B Operator list of C]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3970</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3970"/>
		<updated>2016-01-07T17:33:01Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Connecting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
First you just have to connect the WS2812 with a micro-USB cable to your device. &lt;br /&gt;
&lt;br /&gt;
You have to use C-kermit or PuTTY: &lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use an other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY]&lt;br /&gt;
&lt;br /&gt;
On a UNIX device, when you want to run the code from the device to the WS2812. You have to type in the terminal:&lt;br /&gt;
 /usr/bin/kermit -l /dev/ttyACM0 &lt;br /&gt;
It could be that you have to send to/from an other destination. &lt;br /&gt;
&lt;br /&gt;
It will then say C-kermit is opened. You then just have to type the letter:&lt;br /&gt;
 c&lt;br /&gt;
&lt;br /&gt;
It will tell you to turn off carrier watch with: &lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
If you don&amp;#039;t want to ask this every time you start up with c. You can make a new terminal and write:&lt;br /&gt;
 nano .kermrc &lt;br /&gt;
&lt;br /&gt;
That file(.kermrc) should only have the code:&lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
When the carrier-watch is off you have to type c again. &lt;br /&gt;
&lt;br /&gt;
Before you send a code to the ws2812 check it with:&lt;br /&gt;
 gcc -Wall -o randomname randomname.c&lt;br /&gt;
&lt;br /&gt;
After that you can send it to the ws2812 with:&lt;br /&gt;
 ./randomname &amp;gt; /dev/ttyACM1&lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*WS2812 usb controller: [http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 Shop link] | [[Usb ws2812|Wiki link]]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
The image pretty much explains itself. What you have to do is connect RGB with the 3-pin header.( GND - pin 1  | DO - pin 2 | +5V - pin 3 ) &lt;br /&gt;
The pointers of this example RGB strip should be pointing away from the WS2812 usb controller.&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I drew a Christmas tree. At the points where every single RGB led were laying I put a dot by using a pencil.&lt;br /&gt;
After that I cut the tree out and made holes at the pencil dots. After that I used some scotch tape to bring the front and back paper together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The full c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
What the code does in short is this: When starting up it will make the the peak RGB led white. It will then read the for statement where it goes through all the RGB leds(Except the peak). Every RGB led will randomly get the color green or red. The script will then keep fading the colors of the RGB leds to the opposite color. ( red to green or green to red )    &lt;br /&gt;
&lt;br /&gt;
The parts of the script that I will give some explanation:&lt;br /&gt;
&lt;br /&gt;
Here I made a list of colors(if you also want other colors search for: color table): &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000&lt;br /&gt;
Because it&amp;#039;s RGB ( red green blue ) the first two zeros can be used for changing the the amount of red color. The middle  two zeros are for the amount of green and the last two are for blue. With this you can mix the colors and make different colors.    &lt;br /&gt;
&lt;br /&gt;
Here the amount of time and steps in milliseconds is given for to make the fading go fluent. &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
In interpolate it will get the values from fadeto three times ( for every color r, g &amp;amp; b ) &lt;br /&gt;
It will give new values to c1 and c2 it will bit shift it to the right, and give it the value together with 0xff.  &lt;br /&gt;
After that it calculates difference between previous color.&lt;br /&gt;
&lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
Void fadeto receives the information from int main for example: (5, RED, GREEN). &lt;br /&gt;
It will give the information to every single part of the rgb led. So in this example it would be that red will change from 80 to 00. &lt;br /&gt;
it will keep doing calculations of the steps until it reached 30(nfadesteps). &lt;br /&gt;
After that it prints out on the certain RGB led that given color values.&lt;br /&gt;
&lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After that the peak led will get white.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
&lt;br /&gt;
The for statements is the first loop that is getting used. It will count from zero till nine. Every time it counts it will get a random number and use a remainder to divide it with. The result could be a zero or an one. If it is zero the color red will be given else it would be green. After that it will directly be printed, so that i can be changed to the next number.  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
In the while statement it has to choose a random led. It does this by giving a random number and remainder it with nleds. If it then has chosen the certain led it will look if the led is red. If that is true it will say that the newcolor has to become green. Else the opposite will happen, so that the led will become red. The given values will then be sended to fadeto. ( Example: (5, RED, GREEN). After that it will save the newcolour in the previous led color. so pixels[05] would become green. &lt;br /&gt;
&lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Resetting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
Maybe you will get the experience that the ws2812 crashed and has to be resetted. When the RGB leds are still attached they will get a rainbow effect. To reset the WS2812 you have put a male-female cable on pin 5 on the horizontal connector. The male part of the connector should then hit the ground once. After that you can do the previous commands and everything should work fine again.&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812|usb ws2812 wiki]] &lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B Operator list of C]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3969</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3969"/>
		<updated>2016-01-07T14:28:23Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* The code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Working with RGB leds on the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use and other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Connecting with the WS2812 ===&lt;br /&gt;
&lt;br /&gt;
First you just have to connect the WS2812 with a micro-USB cable to your device. &lt;br /&gt;
&lt;br /&gt;
You have to use C-kermit or PuTTY or an other program, which could run the c-program. &lt;br /&gt;
&lt;br /&gt;
On a UNIX device, whebn you want to run the code from the device to the WS2812. You have to type in the terminal:&lt;br /&gt;
 /usr/bin/kermit -l /dev/ttyACM0 &lt;br /&gt;
It could be that you have to send to/from an other destination. &lt;br /&gt;
&lt;br /&gt;
It will then say C-kermit is opened. You then just have to type the letter:&lt;br /&gt;
 c&lt;br /&gt;
&lt;br /&gt;
It will tell you to turn off carrier watch with: &lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
If you don&amp;#039;t want to ask this every time you start up c. You can make a new terminal and write:&lt;br /&gt;
 nano .kermrc &lt;br /&gt;
&lt;br /&gt;
That file should only have the code:&lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
If the carrier-watch is off you have to type c again. &lt;br /&gt;
&lt;br /&gt;
Now you can finally send form an other terminal the information to the ws2812.&lt;br /&gt;
Before you send a code to the ws2812 check it with:&lt;br /&gt;
 gcc -Wall -o randomname randomname.c&lt;br /&gt;
&lt;br /&gt;
The random name should be the same.&lt;br /&gt;
After that you can send it to the ws2812 with:&lt;br /&gt;
 ./randomname &amp;gt; /dev/ttyACM1&lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*WS2812 usb controller: [http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 Shop link] | [[Usb ws2812|Wiki link]]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
On ////J7 a connector is added, also an cable from the J1 was connected on pin 15 with the second pin from J7. &lt;br /&gt;
The image further on explains itself. &lt;br /&gt;
You still have to look out, that you let the pointers point away from the usb ws2812. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I draw a Christmas tree. At the point every single RGB led were laying I put a dot with a pencil.&lt;br /&gt;
After that I cut the tree and put holes only on paper with the pencil dots. After that I used some scotch tape to bring it all together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The full c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
What the code does in short is this: When starting up it will make the the top led (the peak) white. It will then read the for statement where it goes through all the leds under the peak. Every led will randomly get the color green or red. Then the script will keep fading the colors of the leds from to the opposite color. ( red to green or green to red )    &lt;br /&gt;
&lt;br /&gt;
The parts of the script that I will give some explanation:&lt;br /&gt;
&lt;br /&gt;
Here I made a list of colors(if you also want other colors search for: color table): &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000&lt;br /&gt;
Because it&amp;#039;s RGB ( red green blue ) the first ff is making the red led go to it&amp;#039;s maximum. The middle ff is for green and the last for blue. It works in hexadecimals so you can lower or make the density higher or lower. And mix them so that you can get different colors as for example yellow.   &lt;br /&gt;
&lt;br /&gt;
Here the amount of time and steps in milliseconds is given for to make the fading go fluent. &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
Here the colors are given. void fadeto recieves the information from int main for example: (5, RED, GREEN). &lt;br /&gt;
It will give the information to every single part of the rgb led. So in this example it would be that red will change from 80 to 00. &lt;br /&gt;
&lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After that the peak led will get white.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
&lt;br /&gt;
The for statements is the first loop that is getting used. It will count from zero till nine. Every time it counts it will get a random number and use a remainder to divide it with. The result could be a zero or an one. If it is zero the color red will be given else it would be green. After that it will directly be printed, so that i can be changed to the next number.  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
In the while statement it has to choose a random led. It does this by giving a random number and remainder it with nleds. If it then has chosen the certain led it will look if the led is red. If that is true it will say that the newcolor has to become green. Else the opposite will happen, so that the led will become red. The given values will then be sended to fadeto. ( Example: (5, RED, GREEN). After that it will save the newcolour in the previous led color. so pixels[05] would become green. &lt;br /&gt;
&lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Resetting the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
Maybe you will get the experience that the ws2812 crashed and has to be resetted. When the RGB leds are still attached they will get a rainbow effect. To reset the WS2812 you have put a male-female cable on pin 5 on the horizontal connector. The male part of the connector should then hit the ground once. After that you can do the previous commands and everything should work fine again.&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812|usb ws2812 wiki]] &lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B Operator list of C]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3968</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3968"/>
		<updated>2016-01-07T14:10:04Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* Useful links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Working with RGB leds on the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use and other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Connecting with the WS2812 ===&lt;br /&gt;
&lt;br /&gt;
First you just have to connect the WS2812 with a micro-USB cable to your device. &lt;br /&gt;
&lt;br /&gt;
You have to use C-kermit or PuTTY or an other program, which could run the c-program. &lt;br /&gt;
&lt;br /&gt;
On a UNIX device, whebn you want to run the code from the device to the WS2812. You have to type in the terminal:&lt;br /&gt;
 /usr/bin/kermit -l /dev/ttyACM0 &lt;br /&gt;
It could be that you have to send to/from an other destination. &lt;br /&gt;
&lt;br /&gt;
It will then say C-kermit is opened. You then just have to type the letter:&lt;br /&gt;
 c&lt;br /&gt;
&lt;br /&gt;
It will tell you to turn off carrier watch with: &lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
If you don&amp;#039;t want to ask this every time you start up c. You can make a new terminal and write:&lt;br /&gt;
 nano .kermrc &lt;br /&gt;
&lt;br /&gt;
That file should only have the code:&lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
If the carrier-watch is off you have to type c again. &lt;br /&gt;
&lt;br /&gt;
Now you can finally send form an other terminal the information to the ws2812.&lt;br /&gt;
Before you send a code to the ws2812 check it with:&lt;br /&gt;
 gcc -Wall -o randomname randomname.c&lt;br /&gt;
&lt;br /&gt;
The random name should be the same.&lt;br /&gt;
After that you can send it to the ws2812 with:&lt;br /&gt;
 ./randomname &amp;gt; /dev/ttyACM1&lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*WS2812 usb controller: [http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 Shop link] | [[Usb ws2812|Wiki link]]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
On ////J7 a connector is added, also an cable from the J1 was connected on pin 15 with the second pin from J7. &lt;br /&gt;
The image further on explains itself. &lt;br /&gt;
You still have to look out, that you let the pointers point away from the usb ws2812. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I draw a Christmas tree. At the point every single RGB led were laying I put a dot with a pencil.&lt;br /&gt;
After that I cut the tree and put holes only on paper with the pencil dots. After that I used some scotch tape to bring it all together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The full c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
What the code does in short is this: When starting up it will make the the top led (the peak) white. It will then read the for statement where it goes through all the leds under the peak. Every led will randomly get the color green or red. Then the script will keep fading the colors of the leds from to the opposite color. ( red to green or green to red )    &lt;br /&gt;
&lt;br /&gt;
The parts of the script that I will give some explanation:&lt;br /&gt;
&lt;br /&gt;
Here I made a list of colors(if you also want other colors search for: color table): &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000&lt;br /&gt;
Because it&amp;#039;s RGB ( red green blue ) the first ff is making the red led go to it&amp;#039;s maximum. The middle ff is for green and the last for blue. It works in hexadecimals so you can lower or make the density higher or lower. And mix them so that you can get different colors as for example yellow.   &lt;br /&gt;
&lt;br /&gt;
Here the amount of time and steps in milliseconds is given for to make the fading go fluent. &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
Here the colors are given. void fadeto recieves the information from int main for example: (5, RED, GREEN). &lt;br /&gt;
It will give the information to every single part of the rgb led. So in this example it would be that red will change from 80 to 00. &lt;br /&gt;
&lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After that the peak led will get white.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
&lt;br /&gt;
The for statements is the first loop that is getting used. It will count from zero till nine. Every time it counts it will get a random number and use a remainder to divide it with. The result could be a zero or an one. If it is zero the color red will be given else it would be green. After that it will directly be printed, so that i can be changed to the next number.  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
In the while statement it has to choose a random led. It does this by giving a random number and remainder it with nleds. If it then has chosen the certain led it will look if the led is red. If that is true it will say that the newcolor has to become green. Else the opposite will happen, so that the led will become red. The given values will then be sended to fadeto. ( Example: (5, RED, GREEN). After that it will save the newcolour in the previous led color. so pixels[05] would become green. &lt;br /&gt;
&lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812|usb ws2812 wiki]] &lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;br /&gt;
*[https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B Operator list of C]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3967</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3967"/>
		<updated>2016-01-07T12:41:06Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* Working with RGB leds on the WS2812 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Working with RGB leds on the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use and other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Connecting with the WS2812 ===&lt;br /&gt;
&lt;br /&gt;
First you just have to connect the WS2812 with a micro-USB cable to your device. &lt;br /&gt;
&lt;br /&gt;
You have to use C-kermit or PuTTY or an other program, which could run the c-program. &lt;br /&gt;
&lt;br /&gt;
On a UNIX device, whebn you want to run the code from the device to the WS2812. You have to type in the terminal:&lt;br /&gt;
 /usr/bin/kermit -l /dev/ttyACM0 &lt;br /&gt;
It could be that you have to send to/from an other destination. &lt;br /&gt;
&lt;br /&gt;
It will then say C-kermit is opened. You then just have to type the letter:&lt;br /&gt;
 c&lt;br /&gt;
&lt;br /&gt;
It will tell you to turn off carrier watch with: &lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
If you don&amp;#039;t want to ask this every time you start up c. You can make a new terminal and write:&lt;br /&gt;
 nano .kermrc &lt;br /&gt;
&lt;br /&gt;
That file should only have the code:&lt;br /&gt;
 SET CARRIER-WATCH OFF&lt;br /&gt;
&lt;br /&gt;
If the carrier-watch is off you have to type c again. &lt;br /&gt;
&lt;br /&gt;
Now you can finally send form an other terminal the information to the ws2812.&lt;br /&gt;
Before you send a code to the ws2812 check it with:&lt;br /&gt;
 gcc -Wall -o randomname randomname.c&lt;br /&gt;
&lt;br /&gt;
The random name should be the same.&lt;br /&gt;
After that you can send it to the ws2812 with:&lt;br /&gt;
 ./randomname &amp;gt; /dev/ttyACM1&lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*WS2812 usb controller: [http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 Shop link] | [[Usb ws2812|Wiki link]]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
On ////J7 a connector is added, also an cable from the J1 was connected on pin 15 with the second pin from J7. &lt;br /&gt;
The image further on explains itself. &lt;br /&gt;
You still have to look out, that you let the pointers point away from the usb ws2812. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I draw a Christmas tree. At the point every single RGB led were laying I put a dot with a pencil.&lt;br /&gt;
After that I cut the tree and put holes only on paper with the pencil dots. After that I used some scotch tape to bring it all together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The full c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
What the code does in short is this: When starting up it will make the the top led (the peak) white. It will then read the for statement where it goes through all the leds under the peak. Every led will randomly get the color green or red. Then the script will keep fading the colors of the leds from to the opposite color. ( red to green or green to red )    &lt;br /&gt;
&lt;br /&gt;
The parts of the script that I will give some explanation:&lt;br /&gt;
&lt;br /&gt;
Here I made a list of colors(if you also want other colors search for: color table): &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000&lt;br /&gt;
Because it&amp;#039;s RGB ( red green blue ) the first ff is making the red led go to it&amp;#039;s maximum. The middle ff is for green and the last for blue. It works in hexadecimals so you can lower or make the density higher or lower. And mix them so that you can get different colors as for example yellow.   &lt;br /&gt;
&lt;br /&gt;
Here the amount of time and steps in milliseconds is given for to make the fading go fluent. &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
Here the colors are given. void fadeto recieves the information from int main for example: (5, RED, GREEN). &lt;br /&gt;
It will give the information to every single part of the rgb led. So in this example it would be that red will change from 80 to 00. &lt;br /&gt;
&lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After that the peak led will get white.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
&lt;br /&gt;
The for statements is the first loop that is getting used. It will count from zero till nine. Every time it counts it will get a random number and use a remainder to divide it with. The result could be a zero or an one. If it is zero the color red will be given else it would be green. After that it will directly be printed, so that i can be changed to the next number.  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
In the while statement it has to choose a random led. It does this by giving a random number and remainder it with nleds. If it then has chosen the certain led it will look if the led is red. If that is true it will say that the newcolor has to become green. Else the opposite will happen, so that the led will become red. The given values will then be sended to fadeto. ( Example: (5, RED, GREEN). After that it will save the newcolour in the previous led color. so pixels[05] would become green. &lt;br /&gt;
&lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812|usb ws2812 wiki]] &lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3966</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3966"/>
		<updated>2016-01-07T11:59:05Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* The code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Working with RGB leds on the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use and other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*WS2812 usb controller: [http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 Shop link] | [[Usb ws2812|Wiki link]]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
On ////J7 a connector is added, also an cable from the J1 was connected on pin 15 with the second pin from J7. &lt;br /&gt;
The image further on explains itself. &lt;br /&gt;
You still have to look out, that you let the pointers point away from the usb ws2812. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I draw a Christmas tree. At the point every single RGB led were laying I put a dot with a pencil.&lt;br /&gt;
After that I cut the tree and put holes only on paper with the pencil dots. After that I used some scotch tape to bring it all together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The full c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
What the code does in short is this: When starting up it will make the the top led (the peak) white. It will then read the for statement where it goes through all the leds under the peak. Every led will randomly get the color green or red. Then the script will keep fading the colors of the leds from to the opposite color. ( red to green or green to red )    &lt;br /&gt;
&lt;br /&gt;
The parts of the script that I will give some explanation:&lt;br /&gt;
&lt;br /&gt;
Here I made a list of colors(if you also want other colors search for: color table): &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000&lt;br /&gt;
Because it&amp;#039;s RGB ( red green blue ) the first ff is making the red led go to it&amp;#039;s maximum. The middle ff is for green and the last for blue. It works in hexadecimals so you can lower or make the density higher or lower. And mix them so that you can get different colors as for example yellow.   &lt;br /&gt;
&lt;br /&gt;
Here the amount of time and steps in milliseconds is given for to make the fading go fluent. &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
Here the colors are given. void fadeto recieves the information from int main for example: (5, RED, GREEN). &lt;br /&gt;
It will give the information to every single part of the rgb led. So in this example it would be that red will change from 80 to 00. &lt;br /&gt;
&lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After that the peak led will get white.&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
&lt;br /&gt;
The for statements is the first loop that is getting used. It will count from zero till nine. Every time it counts it will get a random number and use a remainder to divide it with. The result could be a zero or an one. If it is zero the color red will be given else it would be green. After that it will directly be printed, so that i can be changed to the next number.  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
In the while statement it has to choose a random led. It does this by giving a random number and remainder it with nleds. If it then has chosen the certain led it will look if the led is red. If that is true it will say that the newcolor has to become green. Else the opposite will happen, so that the led will become red. The given values will then be sended to fadeto. ( Example: (5, RED, GREEN). After that it will save the newcolour in the previous led color. so pixels[05] would become green. &lt;br /&gt;
&lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812|usb ws2812 wiki]] &lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3965</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3965"/>
		<updated>2016-01-07T10:34:47Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* The code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Working with RGB leds on the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use and other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*WS2812 usb controller: [http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 Shop link] | [[Usb ws2812|Wiki link]]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
On ////J7 a connector is added, also an cable from the J1 was connected on pin 15 with the second pin from J7. &lt;br /&gt;
The image further on explains itself. &lt;br /&gt;
You still have to look out, that you let the pointers point away from the usb ws2812. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I draw a Christmas tree. At the point every single RGB led were laying I put a dot with a pencil.&lt;br /&gt;
After that I cut the tree and put holes only on paper with the pencil dots. After that I used some scotch tape to bring it all together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
What the code does in short is this: When starting up it will make the the top led (the peak) white. It will then read the for statement where it goes through all the leds under the peak. Every led will randomly get the color green or red. Then the script will keep fading the colors of the leds from to the opposite color. ( red to green or green to red )    &lt;br /&gt;
&lt;br /&gt;
The parts of the script that I will give some explanation:&lt;br /&gt;
&lt;br /&gt;
Here I made a list of colors(if you also want other colors search for: color table): &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000&lt;br /&gt;
Because it&amp;#039;s RGB ( red green blue ) the first ff is making the red led go to it&amp;#039;s maximum. The middle ff is for green and the last for blue. It works in hexadecimals so you can lower or make the density higher or lower. And mix them so that you can get different colors as for example yellow.   &lt;br /&gt;
&lt;br /&gt;
Here the amount of time and steps in miliseconds is given for to make the fading go fluent. &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812|usb ws2812 wiki]] &lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3964</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3964"/>
		<updated>2016-01-07T09:50:33Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* The code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Working with RGB leds on the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use and other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*WS2812 usb controller: [http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 Shop link] | [[Usb ws2812|Wiki link]]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
On ////J7 a connector is added, also an cable from the J1 was connected on pin 15 with the second pin from J7. &lt;br /&gt;
The image further on explains itself. &lt;br /&gt;
You still have to look out, that you let the pointers point away from the usb ws2812. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I draw a Christmas tree. At the point every single RGB led were laying I put a dot with a pencil.&lt;br /&gt;
After that I cut the tree and put holes only on paper with the pencil dots. After that I used some scotch tape to bring it all together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
What the code does in short is this: When starting up it will make the the top led (the peak) white. It will then read the for statement where it goes through all the leds under the peak. Every led will randomly get the color green or red. Then the script will keep fading the colors of the leds from to the opposite color. ( red to green or green to red )    &lt;br /&gt;
&lt;br /&gt;
The parts of the script that I will give some explanation:&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000 &lt;br /&gt;
 &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812|usb ws2812 wiki]] &lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3963</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3963"/>
		<updated>2016-01-07T09:44:57Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* RGB lighted paper Tree */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Working with RGB leds on the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use and other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*WS2812 usb controller: [http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 Shop link] | [[Usb ws2812|Wiki link]]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
On ////J7 a connector is added, also an cable from the J1 was connected on pin 15 with the second pin from J7. &lt;br /&gt;
The image further on explains itself. &lt;br /&gt;
You still have to look out, that you let the pointers point away from the usb ws2812. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I draw a Christmas tree. At the point every single RGB led were laying I put a dot with a pencil.&lt;br /&gt;
After that I cut the tree and put holes only on paper with the pencil dots. After that I used some scotch tape to bring it all together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
What the code does in short is this: When starting up it will make the the top led (the peak) white. It will then read the for statement where it goes through all the leds under the peak. Every led will randomly get the color green or red. Then the script will keep fading the colors of the leds from to the opposite color. ( red to green or green to red )    &lt;br /&gt;
The parts that I will give some explanation.&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000 &lt;br /&gt;
 &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812|usb ws2812 wiki]] &lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3962</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3962"/>
		<updated>2016-01-07T09:21:27Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* Useful links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Working with RGB leds on the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use and other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*WS2812 usb controller: [http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 Shop link] | [[Usb ws2812|Wiki link]]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
On ////J7 a connector is added, also an cable from the J1 was connected on pin 15 with the second pin from J7. &lt;br /&gt;
The image further on explains itself. &lt;br /&gt;
You still have to look out, that you let the pointers point away from the usb ws2812. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I draw a Christmas tree. At the point every single RGB led were laying I put a dot with a pencil.&lt;br /&gt;
After that I cut the tree and put holes only on paper with the pencil dots. After that I used some scotch tape to bring it all together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000 &lt;br /&gt;
 &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812|usb ws2812 wiki]] &lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3961</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3961"/>
		<updated>2016-01-07T09:12:35Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* RGB lighted paper Tree */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Working with RGB leds on the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use and other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*WS2812 usb controller: [http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 Shop link] | [[Usb ws2812|Wiki link]]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
On ////J7 a connector is added, also an cable from the J1 was connected on pin 15 with the second pin from J7. &lt;br /&gt;
The image further on explains itself. &lt;br /&gt;
You still have to look out, that you let the pointers point away from the usb ws2812. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I draw a Christmas tree. At the point every single RGB led were laying I put a dot with a pencil.&lt;br /&gt;
After that I cut the tree and put holes only on paper with the pencil dots. After that I used some scotch tape to bring it all together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000 &lt;br /&gt;
 &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812]]&lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3960</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3960"/>
		<updated>2016-01-07T09:09:00Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* RGB lighted paper Tree */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Working with RGB leds on the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use and other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
Hardware used:&lt;br /&gt;
*[http://bitwizard.nl/shop/index.php?route=product/product&amp;amp;product_id=161 WS2812 usb controller]&lt;br /&gt;
*RGB led strip&lt;br /&gt;
*Equipment wire&lt;br /&gt;
&lt;br /&gt;
Software used on my linux pc:&lt;br /&gt;
*C-kermit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
On ////J7 a connector is added, also an cable from the J1 was connected on pin 15 with the second pin from J7. &lt;br /&gt;
The image further on explains itself. &lt;br /&gt;
You still have to look out, that you let the pointers point away from the usb ws2812. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I draw a Christmas tree. At the point every single RGB led were laying I put a dot with a pencil.&lt;br /&gt;
After that I cut the tree and put holes only on paper with the pencil dots. After that I used some scotch tape to bring it all together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000 &lt;br /&gt;
 &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812]]&lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3959</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3959"/>
		<updated>2016-01-06T17:43:13Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Working with RGB leds on the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use and other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
The RGB leds:&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
On ////J7 a connector is added, also an cable from the J1 was connected on pin 15 with the second pin from J7. &lt;br /&gt;
The image further on explains itself. &lt;br /&gt;
You still have to look out, that you let the pointers point away from the usb ws2812. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I draw a Christmas tree. At the point every single RGB led were laying I put a dot with a pencil.&lt;br /&gt;
After that I cut the tree and put holes only on paper with the pencil dots. After that I used some scotch tape to bring it all together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000 &lt;br /&gt;
 &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812]]&lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3958</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3958"/>
		<updated>2016-01-06T17:27:13Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* RGB lighted paper Tree */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Working with RGB leds on the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use and other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
=== Making the construction ===&lt;br /&gt;
&lt;br /&gt;
Paper tree:&lt;br /&gt;
The paper tree is made by folding a green paper. On the folded green paper I put my RGB led connection. Around the RGB led I draw a Christmas tree. At the point every single RGB led were laying I put a dot with a pencil.&lt;br /&gt;
After that I cut the tree and put holes only on paper with the pencil dots. After that I used some scotch tape to bring it all together. The final result:&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
You can of course go all crazy with the tree by adding glitters and stuff like that.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== The code ===&lt;br /&gt;
&lt;br /&gt;
The c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000 &lt;br /&gt;
 &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812]]&lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
	<entry>
		<id>https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3957</id>
		<title>Blog 24</title>
		<link rel="alternate" type="text/html" href="https://bitwizard.nl/wiki/index.php?title=Blog_24&amp;diff=3957"/>
		<updated>2016-01-06T16:52:54Z</updated>

		<summary type="html">&lt;p&gt;Cartridge1987: /* RGB lighted paper Tree */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Working with RGB leds on the WS2812 ==&lt;br /&gt;
&lt;br /&gt;
For Linux/Raspberry: &lt;br /&gt;
 apt-get install ckermit&lt;br /&gt;
&lt;br /&gt;
If you use and other device, or want to know more:&lt;br /&gt;
 [http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
&lt;br /&gt;
For Windows users it&amp;#039;s optional to use:&lt;br /&gt;
 [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
&lt;br /&gt;
== RGB lighted paper Tree ==&lt;br /&gt;
&lt;br /&gt;
The c-program RGBTree.c can be downloaded: [http://bitwizard.nl/source/ here].&lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;unistd.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 #define WHITE  0xffffff&lt;br /&gt;
 #define YELLOW 0xffff00&lt;br /&gt;
 #define RED    0x800000&lt;br /&gt;
 #define GREEN  0x008000&lt;br /&gt;
 #define BLUE   0x0000ff&lt;br /&gt;
 #define BLACK  0x000000 &lt;br /&gt;
 &lt;br /&gt;
 int nfadesteps = 30;&lt;br /&gt;
 int delayms = 30; &lt;br /&gt;
 &lt;br /&gt;
 int interpolate (int c1, int c2, int shift, int pos, int end)&lt;br /&gt;
 {&lt;br /&gt;
   c1 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c2 &amp;gt;&amp;gt;= shift;&lt;br /&gt;
   c1 &amp;amp;= 0xff;&lt;br /&gt;
   c2 &amp;amp;= 0xff;&lt;br /&gt;
 &lt;br /&gt;
   return c1 * (end-pos) / end + c2 * pos / end;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void fadeto (int pixnum, int col1, int col2)&lt;br /&gt;
 {&lt;br /&gt;
    int i; &lt;br /&gt;
    int r, g, b; &lt;br /&gt;
 &lt;br /&gt;
    for (i=0;i &amp;lt;= nfadesteps;i++) {&lt;br /&gt;
       r = interpolate (col1, col2, 16, i, nfadesteps);&lt;br /&gt;
       g = interpolate (col1, col2,  8, i, nfadesteps);&lt;br /&gt;
       b = interpolate (col1, col2,  0, i, nfadesteps);&lt;br /&gt;
       printf (&amp;quot;pix %d %06x\n&amp;quot;, pixnum, &lt;br /&gt;
 	 (r &amp;lt;&amp;lt; 16) | (g &amp;lt;&amp;lt; 8) | (b &amp;lt;&amp;lt; 0)); &lt;br /&gt;
 &lt;br /&gt;
       usleep (delayms*1000);&lt;br /&gt;
    }&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 int main (int argc, char **argv)&lt;br /&gt;
 {&lt;br /&gt;
   int nleds = 10;&lt;br /&gt;
   int *pixels;&lt;br /&gt;
   int pixnum, newcolor;&lt;br /&gt;
   int i;&lt;br /&gt;
   &lt;br /&gt;
   if (argc &amp;gt; 1) &lt;br /&gt;
     nleds = atoi (argv[1]);&lt;br /&gt;
 &lt;br /&gt;
   pixels = calloc (nleds, sizeof(int));&lt;br /&gt;
   &lt;br /&gt;
   printf (&amp;quot;pix %d %06x\n&amp;quot;, nleds, WHITE);  &lt;br /&gt;
 &lt;br /&gt;
   for (i=0;i &amp;lt; nleds;i++){  &lt;br /&gt;
     if (random () % 2 == 0)&lt;br /&gt;
        pixels[i] = RED;&lt;br /&gt;
     else&lt;br /&gt;
        pixels[i] = GREEN;&lt;br /&gt;
     printf (&amp;quot;pix %d %06x\n&amp;quot;, i, pixels[i]);  &lt;br /&gt;
   }&lt;br /&gt;
 &lt;br /&gt;
   while (1) {&lt;br /&gt;
      pixnum = random () % nleds; &lt;br /&gt;
      if (pixels[pixnum] == RED) &lt;br /&gt;
 	newcolor = GREEN;&lt;br /&gt;
      else &lt;br /&gt;
        newcolor = RED; &lt;br /&gt;
      fadeto (pixnum, pixels[pixnum], newcolor);&lt;br /&gt;
      pixels[pixnum] = newcolor;&lt;br /&gt;
   }&lt;br /&gt;
   exit (0);&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RGBTree1.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RGBTree2.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:RGBThree.jpg|none|400px]]&lt;br /&gt;
&lt;br /&gt;
== Useful links ==&lt;br /&gt;
&lt;br /&gt;
*[[usb ws2812]]&lt;br /&gt;
*[http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html PuTTY] &lt;br /&gt;
*[http://www.kermitproject.org/ck90.html C-Kermit]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckscripts.html#top C-Kermit tutorial]&lt;br /&gt;
*[http://www.columbia.edu/kermit/ckututor.html C-Kermit manual page and tutorial]&lt;/div&gt;</summary>
		<author><name>Cartridge1987</name></author>
	</entry>
</feed>