ronisbr / BaremetalPi.jl

Julia library to access Raspberry Pi peripherals without requiring external libraries.
Other
49 stars 5 forks source link

Add example for how to control a dotstar LED strip #6

Open yakir12 opened 2 years ago

yakir12 commented 2 years ago

How can I use the SPI API here to control a DotStar LED strip?

To control a DorStar LED strip from an RPI I'd normally connect the LED strip to an Arduino via its SPI pins, the Arduino to the PI via a USB cable, and then have the PI tell the Arduino which LED to turn on/off by writing bytes into the serial port connected to the Arduino. The script on the Arduino would typically be very simple (e.g. read available bytes, turn on said LED).

This strikes me as overly complicated: since the PI can communicate with the LED strip directly via its own SPI pins, we could just cut out the Arduino-middleman. It should also be faster since now each instruction doesn't need to first go through a serial port (at a baud-rate of 9600 we add 1 millisecond per byte!).