Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Last revisionBoth sides next revision | ||
chipkit_ledboard [2015/03/10 20:21] – [Step 5: Software] Joshua Woldstad | chipkit_ledboard [2015/03/10 20:22] – [Step 5: Software] Joshua Woldstad | ||
---|---|---|---|
Line 100: | Line 100: | ||
{{: | {{: | ||
- | In order to run the Snake program correctly, you must first install the [[https:// | + | In order to run the Snake program correctly, you must first install the [[https:// |
- | + | ||
- | We'll check out the main driving force that allows our particular 30x30 array of LEDs to run as planned: the PICxel library. This library is surprisingly simple and straightforward to use. | + | |
- | + | ||
- | To start out and initialize the array of all 900 LEDs we first call the construction for the PICxel class: | + | |
PICxel name_of_the_set_of_LEDs( how_many_LEDs_we_have, | PICxel name_of_the_set_of_LEDs( how_many_LEDs_we_have, | ||
Here we can provide how LEDs we are running (900), which pin the data is going to be used to connect to the data line on the LEDs (pin 3 in our case), and the desired color mode. Marshall' | Here we can provide how LEDs we are running (900), which pin the data is going to be used to connect to the data line on the LEDs (pin 3 in our case), and the desired color mode. Marshall' | ||
+ | We can get the LEDs lit up and running by first calling in our setup the name_of_the_set_of_LEDs.begin(); | ||
- | We can get the LEDs lit up and running by first calling in our setup the name_of_the_set_of_LEDs.begin(); | ||
function and then choose the settings of the LEDs and subsequently update the strip of LEDs with our new values. | function and then choose the settings of the LEDs and subsequently update the strip of LEDs with our new values. | ||
For HSV color mode, you can set the hue, saturation, and value. For those of you that might not know, these values roughly translate to the color, how " | For HSV color mode, you can set the hue, saturation, and value. For those of you that might not know, these values roughly translate to the color, how " | ||
+ | |||
This function will only set (but not yet update) the values on just one LED, so it's recommend to use a for loop to change multiple LED values. To update the LEDs so that they all show their new settings (or old if that particular LED was not updated), simply issue the following command: name_of_the_set_of_LEDs.refreshLEDs(); | This function will only set (but not yet update) the values on just one LED, so it's recommend to use a for loop to change multiple LED values. To update the LEDs so that they all show their new settings (or old if that particular LED was not updated), simply issue the following command: name_of_the_set_of_LEDs.refreshLEDs(); | ||
+ | |||
The refresheLEDs() function utilizes port manipulation and assembly code to make for a tight library so very little time is wasted in sending out the new information to the WS2812 LEDs at their designated data rate. You can check out a screen shot of the HSV demo for this library in the picture for this step. | The refresheLEDs() function utilizes port manipulation and assembly code to make for a tight library so very little time is wasted in sending out the new information to the WS2812 LEDs at their designated data rate. You can check out a screen shot of the HSV demo for this library in the picture for this step. | ||