User Tools

Site Tools


tutorials:make:ledbelt: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:make:ledbelt:index.html [2011/10/31 18:24]
ladyada [Step 4. Connect to the LED strip]
tutorials:make:ledbelt:index.html [2016/01/28 18:05] (current)
Line 44: Line 44:
  
 ==== Step 1. Plug in and Install driver ​ ==== ==== Step 1. Plug in and Install driver ​ ====
- 
  
 We'll start out easy, by plugging in the atmega32u4 board and installing the driver. For mac and linux users, you can skip this step! If you're using windows, however, you'll need to do this: We'll start out easy, by plugging in the atmega32u4 board and installing the driver. For mac and linux users, you can skip this step! If you're using windows, however, you'll need to do this:
  
-{{:tutorials:​make:​ledbelt:​leonardoinf.zip|Download the INF driver ​by right-click saving this file and saving it to the Desktop}} then uncompress the folder+ 
 +[[http://​www.adafruit.com/​datasheets/​atmega32u4cdc.inf|Download the **inf** ​by right-click saving this file and saving it to the Desktop]] 
  
 Then plug a mini-B cable into the board and you should see the LED light up on it and you'll be asked to install the driver. ​ Then plug a mini-B cable into the board and you should see the LED light up on it and you'll be asked to install the driver. ​
Line 71: Line 72:
  
 {{  http://​www.ladyada.net/​images/​arduino/​devicemanager.jpg?​nolink&​470x520 ​ |}} {{  http://​www.ladyada.net/​images/​arduino/​devicemanager.jpg?​nolink&​470x520 ​ |}}
- 
-If you are using a Mac, click **cancel** when it tries to install it as a modem! 
- 
-{{ :​tutorials:​make:​ledbelt:​screenshot.png?​ |}} 
  
  
Line 165: Line 162:
  
  
 +We'll have to install a version of the Arduino IDE called Teensyduino and our LED strip library, so we can program the controller chip. 
  
-We'll have to install the Arduino IDE and modify it so that we can use it with this chip.[[http://​ladyada.net/​products/​atmega32u4breakout/​#​using_teensyduinoTo do this, please visit our detailed instruction page on installing teensyduino ​and modifying it so it works with the 32u4 board.]]+**[[http://www.ladyada.net/​products/​atmega32u4breakout/​teensyduinov21b.zip|If you're running Windows, you can just download ​this ready-to-go zip package. Uncompress it and inside will be an Arduino IDE ]]**
  
  
-Once you've installed the softwarecome back here+**[[http://​www.adafruit.com/​downloads/​teensyduino_v21.dmg|If ​you're running Mac OS Xyou can just download this ready-to-go dmg packageUncompress it and inside will be an Arduino IDE]]**
  
-OK welcome back! Now you will install the '​library'​ for the Digital LED strip. [[https://​github.com/​adafruit/​HL1606-LED-Strip|Visit our github repository]] and click on the **Downloads** button in the top right corner to download a zip of the library and examples. Uncompress the folder and rename it **HL1606strip** make sure that inside that folder is the cpp and .h files. Then copy it to your arduinosketchfolder/​libraries folder. [[http://​www.ladyada.net/​library/​arduino/​libraries.html|See our tutorial for more details. ]] 
  
 +Download and install whichever matches your setup. Uncompress it onto your desktop or where ever you want to store the IDE folder. This will take a while so we'll wait here for you.
  
-Restart ​the Arduino softwareYou should see new **example ​**folder ​called ​**HL1606strip** and inside, an example called ​**basicPatterns**. Start a new sketch and paste in the following (**its very similar ​to the example code called basicPatterns but the pins are different so use this code below not the example**!)+OK welcome back! Now you will install ​the '​library'​ for the Digital LED strip[[https://​github.com/​adafruit/​LPD8806|Visit our github repository]] and click on the **Downloads** button in the middle of the screen to download ​zip of the library and examples. Uncompress the folder and rename it **LPD8806** make sure that inside that folder ​is the **.cpp** and **.h** filesThen copy it to your **arduinosketchfolder**/​libraries folder. You may have to create ​the **arduinosketchfolder**/​libraries if it doesn'​t exist yet.  [[http://​www.ladyada.net/​library/​arduino/​libraries.html|See our tutorial for more details. ]] 
  
-<code C> 
-/* 
-This is the most basic demonstration code of using HL1606-based digital LED strips. ​ 
-The HL1606 chips are not very '​smart'​ and do not have built in PWM control. (Although 
-there is a fading ability, its not that useful) 
  
-We have a few examples of using the setLEDcolor() ​and writeStrip() command that will  +Restart ​the downloaded Arduino software. You should see a new **example** folder called **LPD8806** ​and inside, an example called **LEDbeltKit**. Open up the LEDbeltKit example.
-allow changing ​the strip around+
  
-public domain +Be sure to select ​**Atmega32u4 breakout** in the **Board** menu. Also select the Serial Port that is made when you plug in the Atmega32u4 board to USB.
-*/+
  
  
-// HL1606strip is an adaptation of LEDstrip from  http://​code.google.com/​p/​ledstrip/​ +{{ products/atmega32u4breakout/selectatmega32u4.gif? |}}
-#include "​HL1606strip.h"+
  
-// for the LED belt, these are the pins used +{{ :​tutorials:​make:​ledbelt:​leocom.gif?​ |}}
-#define STRIP_D 2 +
-#define STRIP_C 1 +
-#define STRIP_L 3+
  
-// Pin S is not really used in this demo since it doesnt use the built in PWM fade +To upload ​the LEDbeltKit sketch, simply have the board plugged ​in, click the Upload button ​in the IDE and press the **RESET** button on the breakout board
-// The last argument is the number of LEDs in the strip. Each chip has 2 LEDs, and the number +
-// of chips/LEDs per meter varies so make sure to count them! if you have the wrong number +
-// the strip will act a little strangely, with the end pixels not showing up the way you like +
-HL1606strip strip = HL1606strip(STRIP_D,​ STRIP_L, STRIP_C, 32);+
  
 +<class notewarning>​
 +Don't forget to press the reset button on the blue 32u4 PCB right after clicking upload to launch the bootloader and get it ready for programming!
 +</​class>​
  
-void setup(void) { 
-  // nothing to do! 
-} 
  
-void loop(void) {  
-   // first argument is the color, second is the delay in milliseconds between commands 
-    
-   // test all the LED colors with a wipe 
-   ​colorWipe(RED,​ 40); 
-   ​colorWipe(YELLOW,​ 40); 
-   ​colorWipe(GREEN,​ 40); 
-   ​colorWipe(TEAL,​ 40); 
-   ​colorWipe(BLUE,​ 40); 
-   ​colorWipe(VIOLET,​ 40); 
-   ​colorWipe(WHITE,​ 40); 
-   ​colorWipe(BLACK,​ 40); 
  
-   // then a chase +{{ :​tutorials:​make:​ledbelt:​leoupload.gif?​ |}}
-   ​chaseSingle(RED,​ 40); +
-   ​chaseSingle(YELLOW,​ 40); +
-   ​chaseSingle(GREEN,​ 40); +
-   ​chaseSingle(TEAL,​ 40); +
-   ​chaseSingle(VIOLET,​ 40); +
-   ​chaseSingle(WHITE,​ 40); +
-    +
-   // a colorcycle party! +
-   ​rainbowParty(60);​ +
-}+
  
- +Once you've uploaded you should see the LED belt perform the blinky test! It will look a little similar to this:
- +
-/​**********************************************/​ +
- +
-// scroll a rainbow! +
-void rainbowParty(uint8_t wait) { +
-  uint8_t i, j; +
- +
-  for (i=0; i< strip.numLEDs();​ i+=6) { +
-    // initialize strip with '​rainbow'​ of colors +
-    strip.setLEDcolor(i,​ RED); +
-    strip.setLEDcolor(i+1,​ YELLOW); +
-    strip.setLEDcolor(i+2,​ GREEN); +
-    strip.setLEDcolor(i+3,​ TEAL); +
-    strip.setLEDcolor(i+4,​ BLUE); +
-    strip.setLEDcolor(i+5,​ VIOLET); +
- +
-  } +
-  strip.writeStrip(); ​   +
-   +
-  for (j=0; j < strip.numLEDs();​ j++) { +
- +
-    // now set every LED to the *next* LED color (cycling) +
-    uint8_t savedcolor = strip.getLEDcolor(0);​ +
-    for (i=1; i < strip.numLEDs();​ i++) { +
-      strip.setLEDcolor(i-1,​ strip.getLEDcolor(i)); ​ // move the color back one. +
-    } +
-    // cycle the first LED back to the last one +
-    strip.setLEDcolor(strip.numLEDs()-1,​ savedcolor);​ +
-    strip.writeStrip();​ +
-    delay(wait);​ +
-  } +
-+
- +
- +
-// turn everything off (fill with BLACK) +
-void stripOff(void) { +
-  // turn all LEDs off! +
-  for (uint8_t i=0; i < strip.numLEDs();​ i++) { +
-      strip.setLEDcolor(i,​ BLACK); +
-  } +
-  strip.writeStrip(); ​   +
-+
- +
-// have one LED '​chase'​ around the strip +
-void chaseSingle(uint8_t color, uint8_t wait) { +
-  uint8_t i; +
-   +
-  // turn everything off +
-  for (i=0; i< strip.numLEDs();​ i++) { +
-    strip.setLEDcolor(i,​ BLACK); +
-  } +
- +
-  for (i=0; i < strip.numLEDs();​ i++) { +
-    strip.setLEDcolor(i,​ color); +
-    if (i != 0) { +
-      // make the LED right before this one OFF +
-      strip.setLEDcolor(i-1,​ BLACK); +
-    } +
-    strip.writeStrip();​ +
-    delay(wait); ​  +
-  } +
-  // turn off the last LED before leaving +
-  strip.setLEDcolor(strip.numLEDs() - 1, BLACK); +
-+
- +
-// fill the entire strip, with a delay between each pixel for a '​wipe'​ effect +
-void colorWipe(uint8_t color, uint8_t wait) { +
-  uint8_t i; +
-   +
-  for (i=0; i < strip.numLEDs();​ i++) { +
-      strip.setLEDcolor(i,​ color); +
-      strip.writeStrip(); ​   +
-      delay(wait);​ +
-  } +
-+
-</​code>​ +
- +
-Be sure to select the Atmega32u4 board in the **Board** menu. Also select the Serial Port that is made when you plug in the Atmega32u4 board to USB and press the reset button.  +
- +
- +
- +
-{{ http://​www.ladyada.net/​images/​ledbelt/​selectatmega32u4.gif?​nolink&​621x414 |}} +
- +
- +
- +
-If you've already uploaded something to the board, you might have to press the reset button to enter the bootloader (the green led will be pulsing), then check the Serial Port menu again to see the serial port appear. +
- +
-To upload, press the reset button, you will see the green LED '​pulse'​ in and out like its breathing. As soon as you see this happening, press the **Upload** button in the IDE +
- +
- +
-If uploading goes well, you should see the following:​ +
- +
- +
- +
-{{ http://​www.ladyada.net/​images/​ledbelt/​uploaded.gif?​nolink&​605x273 |}} +
- +
- +
-If you see something like **"​buffered memory access not supported. Maybe it isn't a butterfly/​AVR109 but a AVR910 device?"​** That means you did not upload during the bootloader time (10 seconds or so). Press the Boot/Reset button on the atmega32u4 and try again! +
- +
-Once you've uploaded you should see the LED belt perform the blinky test!+
  
  
Line 458: Line 319:
 Now we'll wrap it up by protecting the cable that goes to the end of the strip Now we'll wrap it up by protecting the cable that goes to the end of the strip
  
-Slide the large heatshrink onto the end of the LED strip+Cut the large piece of heat shrink so you have two ~2" pieces. ​Slide one piece of the large heatshrink onto the end of the LED strip
  
 [[http://​www.ladyada.net/​images/​ledbelt/​bigslide.jpg|{{ ​ http://​www.ladyada.net/​images/​ledbelt/​bigslide_t.jpg?​nolink&​500x342 ​ |}}]] [[http://​www.ladyada.net/​images/​ledbelt/​bigslide.jpg|{{ ​ http://​www.ladyada.net/​images/​ledbelt/​bigslide_t.jpg?​nolink&​500x342 ​ |}}]]
Line 473: Line 334:
  
 [[http://​www.ladyada.net/​images/​ledbelt/​zipclip.jpg|{{ ​ http://​www.ladyada.net/​images/​ledbelt/​zipclip_t.jpg?​nolink&​500x318 ​ |}}]] [[http://​www.ladyada.net/​images/​ledbelt/​zipclip.jpg|{{ ​ http://​www.ladyada.net/​images/​ledbelt/​zipclip_t.jpg?​nolink&​500x318 ​ |}}]]
 +
 +You can then use the other piece of heatshrink on the other end of the belt, to protect it.
  
 That's it! Now the project is done. You can keep the battery pack and microcontroller board in your pocket and wrap the belt around you That's it! Now the project is done. You can keep the battery pack and microcontroller board in your pocket and wrap the belt around you
/home/ladyada/public_html/wiki/data/attic/tutorials/make/ledbelt/index.html.1320085484.txt.gz · Last modified: 2016/01/28 18:05 (external edit)