This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
|
digispark:tutorials:digiled [2014/11/19 16:22] bigluc |
digispark:tutorials:digiled [2014/12/28 21:38] kermed [Assembly:] |
||
|---|---|---|---|
| Line 2: | Line 2: | ||
| =====Product Description:===== | =====Product Description:===== | ||
| - | [[https://s3.amazonaws.com/digispark/images/m/digiled.jpg|{{https://s3.amazonaws.com/digispark/images/t/digiled.jpg}}]][[https://s3.amazonaws.com/digispark/images/m/digiled.jpg|{{https://s3.amazonaws.com/digispark/images/t/digiled.jpg}}]] | + | [[https://s3.amazonaws.com/digispark/images/m/digiled1.jpg|{{https://s3.amazonaws.com/digispark/images/t/digiled1.jpg}}]][[https://s3.amazonaws.com/digispark/images/m/digiled5.jpg|{{https://s3.amazonaws.com/digispark/images/t/digiled5.jpg}}]] |
| Line 34: | Line 34: | ||
| Empty kit bag (or if using a raw PCB, aquire parts) and verify contents. | Empty kit bag (or if using a raw PCB, aquire parts) and verify contents. | ||
| - | [[https://s3.amazonaws.com/digispark/images/m/digiled.jpg|{{https://s3.amazonaws.com/digispark/images/t/digiled.jpg}}]] | + | [[https://s3.amazonaws.com/digispark/images/m/digiled1.jpg|{{https://s3.amazonaws.com/digispark/images/t/digiled1.jpg}}]] |
| - | When inserting the LED into the board ensure the two longer leasd of the LED goes through the holes marked data out and ground (see photo) - this ensures you have the LED oriented properly. Solder the LED leads and clip off the excess. | + | When inserting the LED into the board ensure the two longer leads of the LED goes through the holes marked data out and ground (see photo) - this ensures you have the LED oriented properly. Solder the LED leads and clip off the excess. |
| - | [[https://s3.amazonaws.com/digispark/images/m/digiled.jpg|{{https://s3.amazonaws.com/digispark/images/t/digiled.jpg}}]] | + | [[https://s3.amazonaws.com/digispark/images/m/digiled2.jpg|{{https://s3.amazonaws.com/digispark/images/t/digiled2.jpg}}]] |
| + | |||
| + | [[https://s3.amazonaws.com/digispark/images/m/digiled3.jpg|{{https://s3.amazonaws.com/digispark/images/t/digiled3.jpg}}]] | ||
| Insert the capacitor on the top of the board (as shown), solder leads on bottom. Orientation of the capacitor does not matter. | Insert the capacitor on the top of the board (as shown), solder leads on bottom. Orientation of the capacitor does not matter. | ||
| - | [[https://s3.amazonaws.com/digispark/images/m/digiled.jpg|{{https://s3.amazonaws.com/digispark/images/t/digiled.jpg}}]] | + | [[https://s3.amazonaws.com/digispark/images/m/digiled4.jpg|{{https://s3.amazonaws.com/digispark/images/t/digiled4.jpg}}]] |
| Cut a length of male headers 6 pins long and one 3 pins long. Insert into corresponding positions (on the bottom of the board) and solder each pin. | Cut a length of male headers 6 pins long and one 3 pins long. Insert into corresponding positions (on the bottom of the board) and solder each pin. | ||
| Line 52: | Line 54: | ||
| - | When inserting the LED into the board ensure the two longer leasd of the LED goes through the holes marked data out and ground (see photo) - this ensures you have the LED oriented properly. Solder the LED leads and clip off the excess. | + | When inserting the LED into the board ensure the two longer leads of the LED goes through the holes marked data out and ground (see photo) - this ensures you have the LED oriented properly. Solder the LED leads and clip off the excess. |
| - | [[https://s3.amazonaws.com/digispark/images/m/digiled.jpg|{{https://s3.amazonaws.com/digispark/images/t/digiled.jpg}}]] | + | [[https://s3.amazonaws.com/digispark/images/m/digiled5.jpg|{{https://s3.amazonaws.com/digispark/images/t/digiled5.jpg}}]] |
| Your DigiLED shield is complete! | Your DigiLED shield is complete! | ||
| - | **Note:** On the back of the shield there is a solder patch to activate pin 5 instead of pin 1 as the digital input. | + | **Note:** On the back of the shield there is a solder patch to activate pin 5 instead of pin 1 as the digital input. If you are not using the DigiLED as a shield onto the DigiSpark Pro and planning on running it at a distance, you only need to connect the specified digital pin (Pin 1) and bottom 3 pins (5V, GND, VIN). You do not need to connect all 6 pins on the right-hand side of the shield. |
| + | =====Chaining:===== | ||
| + | When chaining multiple DigiLED's together, you only need to connect 3 points as a daisy chain using VCC, DO>DI and GND. For example, LED #1 would need the top 3 pins VCC, DO (out) and GND to connect to DigiLED #2's VCC, DI (in) and GND near the bottom of the board. If you added LED #3 you would need to connect DigiLED #2's top three pins to the lower-mid pins on DigiLED #3 and so-on and so forth. After DigiLED 1, the side pins and 5V, GND, VIN should not be connected. | ||
| =====Programming:===== | =====Programming:===== | ||
| Line 68: | Line 72: | ||
| Download and install the NeoPixel library: https://github.com/adafruit/Adafruit_NeoPixel | Download and install the NeoPixel library: https://github.com/adafruit/Adafruit_NeoPixel | ||
| - | Set the Pin to 1, Number of LEDs to 1 (unless you have chained more on), and format to NEO_RGB | + | Set the Pin to 1, Number of LEDs to 1 (unless you have chained more on), and format to NEO_RGB + NEO_KHZ800 |
| + | |||
| + | If you have a single DigiLED, the following code sample will make it continuously cycle through white, cyan, violet, yellow, red, green and blue. | ||
| + | |||
| + | <code arduino> | ||
| + | // Based on NeoPixel Ring simple sketch (c) 2013 Shae Erisson | ||
| + | // released under the GPLv3 license | ||
| + | #include <Adafruit_NeoPixel.h> | ||
| + | |||
| + | // Which pin on the Digispark is connected to the DigiLED? | ||
| + | #define PIN 1 | ||
| + | |||
| + | // How many DigiLEDs are attached to the Digispark? | ||
| + | #define NUMPIXELS 1 | ||
| + | |||
| + | // When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals. | ||
| + | // For the WS2812B type through hole LED used by the DigiLED, NEO_RGB + NEO_KHZ800 is the correct data format | ||
| + | Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_RGB + NEO_KHZ800); | ||
| + | |||
| + | int delayval = 500; // delay for half a second | ||
| + | |||
| + | void setup() | ||
| + | { | ||
| + | pixels.begin(); // This initializes the NeoPixel library. | ||
| + | pixels.show(); // Initialize all pixels to 'off' | ||
| + | } | ||
| + | |||
| + | void loop() | ||
| + | { | ||
| + | // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255 | ||
| + | // in Red,Green,Blue order | ||
| + | |||
| + | pixels.setPixelColor(0, pixels.Color(255, 255, 255)); //white | ||
| + | pixels.show(); // This sends the updated pixel color to the hardware. | ||
| + | delay(delayval); // Delay for a period of time (in milliseconds). | ||
| + | |||
| + | pixels.setPixelColor(0, pixels.Color(0, 255, 255)); //cyan | ||
| + | pixels.show(); | ||
| + | delay(delayval); | ||
| + | |||
| + | pixels.setPixelColor(0, pixels.Color(255, 0, 255)); //violet | ||
| + | pixels.show(); | ||
| + | delay(delayval); | ||
| + | |||
| + | pixels.setPixelColor(0, pixels.Color(255, 255, 0)); //yellow | ||
| + | pixels.show(); | ||
| + | delay(delayval); | ||
| + | |||
| + | pixels.setPixelColor(0, pixels.Color(255, 0, 0)); //red | ||
| + | pixels.show(); | ||
| + | delay(delayval); | ||
| + | |||
| + | pixels.setPixelColor(0, pixels.Color(0, 255, 0)); //green | ||
| + | pixels.show(); | ||
| + | delay(delayval); | ||
| + | |||
| + | pixels.setPixelColor(0, pixels.Color(0, 0, 255)); //blue | ||
| + | pixels.show(); | ||
| + | delay(delayval); | ||
| + | } | ||
| + | </code> | ||
| + | |||
| + | If you have more than one DigiLED daisy-chained, the following code will make all the DigiLEDs light up green. You need to change the NUMPIXELS variable to the number of DigiLEDs you have chained together. | ||
| <code arduino> | <code arduino> | ||