User Tools

Site Tools


tutorials:products:pixel36mm:index.html

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorials:products:pixel36mm:index.html [2012/01/27 18:16]
pburgess
tutorials:products:pixel36mm:index.html [2016/01/28 18:05] (current)
Line 83: Line 83:
 ==== Download ==== ==== Download ====
  
-To download the Arduino library, [[https://​github.com/​adafruit/​WS2801-Library|visit the repository on GitHub]]. +To download the Arduino library, [[https://​github.com/​adafruit/​Adafruit-WS2801-Library|visit the repository on GitHub]]. 
-Click the DOWNLOAD ZIP button near the upper left, extract the archive and then rename the uncompressed folder to ''​WS2801''​. Confirm that this folder contains the files ''​WS2801.cpp''​ and ''​WS2801.h''​ and the ''​examples''​ folder.+Click the DOWNLOAD ZIP button near the upper left, extract the archive and then rename the uncompressed folder to ''​Adafruit_WS2801''​. Confirm that this folder contains the files ''​Adafruit_WS2801.cpp''​ and ''​Adafruit_WS2801.h''​ and the ''​examples''​ folder.
  
 Place the WS2801 folder inside your Arduino ''​Libraries''​ folder. You may need to create this folder if it does not yet exist. In Windows, this would be ''​(home folder)\My Documents\Arduino\Libraries''​ and for Mac or Linux is ''​(home folder)/​Documents/​Arduino/​Libraries''​ [[http://​www.ladyada.net/​library/​arduino/​libraries.html|We also have a tutorial on library installation]]. Place the WS2801 folder inside your Arduino ''​Libraries''​ folder. You may need to create this folder if it does not yet exist. In Windows, this would be ''​(home folder)\My Documents\Arduino\Libraries''​ and for Mac or Linux is ''​(home folder)/​Documents/​Arduino/​Libraries''​ [[http://​www.ladyada.net/​library/​arduino/​libraries.html|We also have a tutorial on library installation]].
  
-After installing the WS2801 ​library, restart the Arduino IDE. You should now be able to access the sample code by navigating through menus in this order: File->​Sketchbook->​Libraries->​WS2801->​strandtest+After installing the Adafruit_WS2801 ​library, restart the Arduino IDE. You should now be able to access the sample code by navigating through menus in this order: File->​Sketchbook->​Libraries->​Adafruit_WS2801->​strandtest
  
 ==== Code! ==== ==== Code! ====
  
-Let's look through the strandtest example code. To use the library in an Arduino sketch, you'll first need to globally declare a WS2801 ​object to talk to the strip. It is invoked with three variables: the number of pixels and the data and clock pins:+Let's look through the strandtest example code. To use the library in an Arduino sketch, you'll first need to globally declare a Adafruit_WS2801 ​object to talk to the strip. It is invoked with three variables: the number of pixels and the data and clock pins:
  
 <code C> <code C>
-int dataPin = 2;+int dataPin ​ = 2;
 int clockPin = 3; int clockPin = 3;
  
 // Set the first variable to the NUMBER of pixels. 25 = 25 pixels in a row // Set the first variable to the NUMBER of pixels. 25 = 25 pixels in a row
-WS2801 ​strip = WS2801(25, dataPin, clockPin);+Adafruit_WS2801 ​strip = Adafruit_WS2801(25, dataPin, clockPin, WS2801_GRB);
 </​code>​ </​code>​
 +
 +The last parameter there, ''​WS2801_GRB'',​ is required when using these 36mm pixels (otherwise red and green will be reversed). You do NOT need this parameter if using our 12mm pixels.
  
 Next, we initialize the strip in the ''​setup()''​ procedure: Next, we initialize the strip in the ''​setup()''​ procedure:
/home/ladyada/public_html/wiki/data/attic/tutorials/products/pixel36mm/index.html.1327688215.txt.gz · Last modified: 2016/01/28 18:05 (external edit)