Hardware SPI on Pro Trinket for Dotstars

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Snarltoof
 
Posts: 19
Joined: Sun Apr 26, 2015 10:59 am

Hardware SPI on Pro Trinket for Dotstars

Post by Snarltoof »

Hi there -- I notice a couple of mentions about using Hardware SPI for controlling LED Strips, and in the Genesis Poi code, there's a comment, "Ideally you use hardware SPI as it's much faster, though limited to specific pins."

Which pins should I be using to control Dotstar LED strips using a pro trinket? I've standardized in my projects on using pin 3 for a button switch because it's an "interrupt," pin 4 for the data pin, and pin 5 for the clock pin.

Is there a better practice for assigning pins to the LED strip?

Thanks!

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: Hardware SPI on Pro Trinket for Dotstars

Post by adafruit_support_rick »

Have a look at the strandtest example. It shows how to use either software or hardware SPI to control the strip:

Code: Select all

// Here's how to control the LEDs from any two pins:
#define DATAPIN    4
#define CLOCKPIN   5
Adafruit_DotStar strip = Adafruit_DotStar(NUMPIXELS, DATAPIN, CLOCKPIN);

// Hardware SPI is a little faster, but must be wired to specific pins
// (Arduino Uno = pin 11 for data, 13 for clock, other boards are different).
//Adafruit_DotStar strip = Adafruit_DotStar(NUMPIXELS);
So, comment out the first section, and uncomment the hardware spi section. Use pin 11 for data and pin 13 for clock.

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”