element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Hats Off Design Challenge
  • Challenges & Projects
  • Design Challenges
  • Hats Off Design Challenge
  • More
  • Cancel
Hats Off Design Challenge
Blog Hats Off Mardi Gras - Circle Layout, Wiring & Code (Part 5)
  • Blog
  • Forum
  • Documents
  • Files
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: fearless
  • Date Created: 21 Oct 2014 3:16 AM Date Created
  • Views 774 views
  • Likes 0 likes
  • Comments 4 comments
  • mardi_gras_hat
  • hats_off
Related
Recommended

Hats Off Mardi Gras - Circle Layout, Wiring & Code (Part 5)

fearless
fearless
21 Oct 2014

I'm finally at the point where I get to put all my NeoPixels into place and get them wired up. The only sensor that I will be using is the photocell. It's purpose is to detect the light levels and turn off the NeoPixel sequence, if the environment is too bright. I had a bit of a problem after soldering the NeoPixels into place, but with Wayne's help, we were able to overcome it.

 

Here's a video going over my discoveries and progress:

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

 

I used the Adafruit NeoPixel strip loop coding with just a few changes. Here is the final code that I will be using:

 

#include <Adafruit_NeoPixel.h>


#define PIN 0


int photocell = 1;
int photocellReading;


Adafruit_NeoPixel strip = Adafruit_NeoPixel(7, PIN, NEO_GRB + NEO_KHZ800);




void setup() {
  pinMode(photocell, INPUT);
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}


void loop() {
  //read photocell looking for unlit room
  photocellReading = analogRead(photocell);
  //lighting is dim, run the neopixels
  if(photocellReading < 300){
      colorWipe(strip.Color(255, 0, 0), 0); // Red
      delay(3000);
      colorWipe(strip.Color(0, 0, 255), 0); // Blue
      delay(3000);
      colorWipe(strip.Color(0, 255, 0), 0); // Green
      delay(3000);
      colorWipe(strip.Color(110, 0, 140), 0); // Purple
      delay(3000);
      colorWipe(strip.Color(217, 187, 1), 0); // Gold
      delay(3000);
  }else{
    //lighting is bright, shut down the neopixels
      colorWipe(strip.Color(0,0,0),0);
      delay(5000);
  }


}


// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint16_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {  
      strip.setPixelColor(i, c);
      strip.show();
      delay(wait);
  }
}

  • Sign in to reply
  • fearless
    fearless over 10 years ago in reply to Former Member

    Kandy,

    Thank you for the words of encouragement. The code I posted worked great for me, so you should be able to use it, too. This was my first exposure to electronics and I have to say that I'm totally hooked. The "hat" is all finished now, so please have a look at the videos. I hope you like it!

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • fearless
    fearless over 10 years ago in reply to DAB

    Thanks DAB. You're correct, I have been busy with the final assembly. That's why I didn't reply to you quicker. I'm happy to say that I'm done now. Let me know what you think of the final product.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Former Member
    Former Member over 10 years ago

    i am excited to see the finished product; it looks like it's going to be awesome.  i have to say it am most excited that you gave your code.  i hope to play with photo cell someday soon.  Your project is really coming together; good luck!

     

    Kandy

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • DAB
    DAB over 10 years ago

    Very good update Lori.

     

    I like the translucent covers for the neopixels.

    They really disperse the LED light over a nice area.

     

    It looks like you are about ready to do the final assembly.

    Should be an impressive display.

     

    DAB

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube