So I got Adafruit things in the mail
- 1 Gemma
- 1 Lipo battery charger
- 1 500 mAh Hour Lipo battery
- Lots of crocodile clips
- 1 Photo cell
- 25m of Conductive thread (metric system Ftw)
- A small wire piezo
- 1 fast vibration switch
- 4 Neopixels
- 1 tactile on/off switch
- And 1 Usb cable
I wanted to check to make sure that everything works. A kind of Adafruit Hello World if you will.
I’ve never worked with neopixels before so I it was really important to test them to see how bright they were so I could figure out how many I would need if I want to use it as a photo light.
I plugged the charged battery into the battery connector, attached crocodile clips from the Vout pin of the gemma to the plus pin on the neopixel. I attached crocodile clips to the gemma and neopixel ground. Last, I attached crocodile clips between D1 and the input pin of the neopixel. It’s the one with the little arrow pointing in the direction of the next neopixel.
I struggled for a while to get the Gemma to work on my laptop. I have a windows 8 laptop and kept running in to the following error when I tried to upload even when in bootloader mode
avrdude: Error: Could not find USBtiny device (0x1781/0xc9f)
Turned out my timing was just off. I had to wait for the Gemma to reconnect which took about 8 seconds out of the 10 seconds that the red LED blinks and then quickly upload the sketch before the Gemma exits the bootloader. I checked online and it seems quite a few people having been having this problem and it seems to be the fault of windows 8.
I loaded up the strandtest code.
#include <Adafruit_NeoPixel.h> #define PIN 1 // Parameter 1 = number of pixels in strip // Parameter 2 = pin number (most are valid) // Parameter 3 = pixel type flags, add together as needed: // NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs) // NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers) // NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products) // NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2) Adafruit_NeoPixel strip = Adafruit_NeoPixel(4, PIN, NEO_GRB + NEO_KHZ800); void setup() { strip.begin(); strip.show(); // Initialize all pixels to 'off' } void loop() { // Some example procedures showing how to display to the pixels: colorWipe(strip.Color(255, 0, 0), 50); // Red colorWipe(strip.Color(0, 255, 0), 50); // Green colorWipe(strip.Color(0, 0, 255), 50); // Blue rainbow(20); rainbowCycle(20); } // Fill the dots one after the other with a color void colorWipe(uint32_t c, uint8_t wait) { for(uint16_t i=0; i<strip.numPixels(); i++) { strip.setPixelColor(i, c); strip.show(); delay(wait); } } void rainbow(uint8_t wait) { uint16_t i, j; for(j=0; j<256; j++) { for(i=0; i<strip.numPixels(); i++) { strip.setPixelColor(i, Wheel((i+j) & 255)); } strip.show(); delay(wait); } } // Slightly different, this makes the rainbow equally distributed throughout void rainbowCycle(uint8_t wait) { uint16_t i, j; for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel for(i=0; i< strip.numPixels(); i++) { strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255)); } strip.show(); delay(wait); } } // Input a value 0 to 255 to get a color value. // The colours are a transition r - g - b - back to r. uint32_t Wheel(byte WheelPos) { if(WheelPos < 85) { return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0); } else if(WheelPos < 170) { WheelPos -= 85; return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3); } else { WheelPos -= 170; return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3); } }
I prayed to google, and it worked!
I connected all 4 neopixels and tried to see if I could take any photos with them. I ended up chasing my cat around who was not at all interested in the bright lights.
The light really gives off a cool effect though. The different colours are all focused on different points and give an effect like you see on photos of galaxies and nebulas.
I LOVE GALAXIES AND NEBULAS
Just out of interest, I taped a bunch of old LPD6803 LEDS to my camera bag when I photographed an event over the weekend and this is what the light they gave off looked like. I want my hat to do this but be able to choose from different colour patterns when the user chooses