New to NEO PIXEL - help please.

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
hiduino
 
Posts: 862
Joined: Sat Sep 01, 2012 7:05 pm

Re: New to NEO PIXEL - help please.

Post by hiduino »

You can try something like this in you setup().

Code: Select all

void setup() {
  strip.begin();
  strip.setBrightness(40);
  strip.show();
}

User avatar
ElectronicOz
 
Posts: 74
Joined: Fri Jun 20, 2014 7:13 pm

Re: New to NEO PIXEL - help please.

Post by ElectronicOz »

I was more wanting it to be used IN the sketch rather than for "setting up".

So I can "fade up" (or down) the LEDs at certain times.

User avatar
hiduino
 
Posts: 862
Joined: Sat Sep 01, 2012 7:05 pm

Re: New to NEO PIXEL - help please.

Post by hiduino »

Same thing, just use strip.setBrightness(value); in you sketch before strip.show();.

User avatar
adafruit_support_bill
 
Posts: 88086
Joined: Sat Feb 07, 2009 10:11 am

Re: New to NEO PIXEL - help please.

Post by adafruit_support_bill »

So I can "fade up" (or down) the LEDs at certain times.
setBrightness is good for 'fading down'. However, it is lossy, so it is not very good at 'fading up' due to the lost information.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: New to NEO PIXEL - help please.

Post by adafruit_support_rick »

strip.setBrightness(n), where n is a value between 0 (off) and 255 (brightest).

This applies a global multiplier to all the pixel values you set. For instance, this will set half-brightness white:

Code: Select all

  strip.setBrightness(127);
  strip.setPixelColor(1, 255, 255, 255);
  strip.show();
setBrightness will also adjust the brightness of pixels already set, but the result won't be displayed until the next time you call show()

User avatar
pburgess
 
Posts: 4161
Joined: Sun Oct 26, 2008 2:29 am

Re: New to NEO PIXEL - help please.

Post by pburgess »

strip.setBrightness(X);
Where 'X' is between 0 (off) and 255 (maximum brightness), e.g. strip.setBrightness(64) is about 1/4 brightness (technically 1/4 duty cycle, which appears more than 1/4 brightness due to gamma correction, but that's a huge explanation for another day...basically, experiment with numbers until you get the result you want).

This was intended for use in setup() for defining the strip brightness throughout the lifetime of the sketch. Some folks use it as an animation effect in itself, which I really don't recommend (another lengthy explanation, but basically has to do with changing brightness mid-sketch being 'lossy' as it's currently written).

User avatar
Ronfinlay
 
Posts: 31
Joined: Tue Jan 10, 2017 1:06 am

Re: New to NEO PIXEL - help please.

Post by Ronfinlay »

Great discussion and nice to see people helping each other.

I am very new to this. Opened my starter kit today ! Found sample code to make LEDs turn on and off in response to a pushbutton, then my 8 LED RBGW pixel stick. But I can't find a demo code for my 12 and 24 neo pixel rings. I just want to get them running, and then follow the code to learn the syntax. There are so many smart people out there. Blows me away. I tried looking in LEARN on adafruit's website, but did not find what I was looking for. Anxious to light these items. Thanks.

User avatar
Ronfinlay
 
Posts: 31
Joined: Tue Jan 10, 2017 1:06 am

Re: New to NEO PIXEL - help please.

Post by Ronfinlay »

Oh. Just realized. I'm stuck with this error, too.

Arduino: 1.8.1 (Mac OS X), Board: "Arduino/Genuino Uno"

Ron_s_24_LED_Ring:19: error: 'strip' does not name a type
strip.setPixelColor(0, 0, 0, 0, 127);
^
Ron_s_24_LED_Ring:21: error: 'strip' does not name a type
strip.show();
^
exit status 1
'strip' does not name a type

It seems to not be happy with strip.show(); , which I understood to be what starts pushing data out. No idea what do do. Thanks.

User avatar
Ronfinlay
 
Posts: 31
Joined: Tue Jan 10, 2017 1:06 am

Re: New to NEO PIXEL - help please.

Post by Ronfinlay »

Hi fellow Arduino BANNED. I found the problem. Earlier up in the code, I had some instructions in the wrong order, either side of set up. Now it compiles, but, no LEDs do anything. Not sure. I've seen online demos of LEDs making circles, changing colours, and so on. That's all I'm looking for for now - just to get something happening. Thanks if you can share a link or code.

User avatar
jim_lee
 
Posts: 709
Joined: Thu May 24, 2012 8:24 pm

Re: New to NEO PIXEL - help please.

Post by jim_lee »

Post you code.

-jim lee

User avatar
ElectronicOz
 
Posts: 74
Joined: Fri Jun 20, 2014 7:13 pm

Re: New to NEO PIXEL - help please.

Post by ElectronicOz »

Here folks.

As much as I was wanting to keep it MINE, hey, life is for sharing.....


If you want to make a nice little LED strip Morse Code display system.......

The circuit:
The first resistor is to allow enough current to light the LED without being too much.

The second one - between the bridge rectifier and opto-isolator is calculated from the input voltage.

The little square with the two black lines in it are pins. You put a strap on them or take it off.
This is to control if the input is "normally open" or "normally closed".


AFAIK, the code works.
(Rename the .ino.txt file to just .ino)

Just have a look at the code and find the pins to use for the INPUT, MODE and NeoPixelOUTPUT pins.

Also adjust the delay_time value and the value for now many NeoPixel LEDs you have.
The is the schematic.
The is the schematic.
Morse_Code.PNG (12.58 KiB) Viewed 477 times
Attachments
morse_code_display.ino.txt
This is the code for an arduino.
(3.49 KiB) Downloaded 133 times

User avatar
adafruit_support_bill
 
Posts: 88086
Joined: Sat Feb 07, 2009 10:11 am

Re: New to NEO PIXEL - help please.

Post by adafruit_support_bill »

Nice! Thanks for sharing.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: New to NEO PIXEL - help please.

Post by adafruit_support_rick »

Ronfinlay wrote:Hi fellow Arduino BANNED. I found the problem. Earlier up in the code, I had some instructions in the wrong order, either side of set up. Now it compiles, but, no LEDs do anything. Not sure. I've seen online demos of LEDs making circles, changing colours, and so on. That's all I'm looking for for now - just to get something happening. Thanks if you can share a link or code.
Have you tried the strandtest example that comes with the neopixel library?

To get your own code running, please post it so we can have a look.

User avatar
ElectronicOz
 
Posts: 74
Joined: Fri Jun 20, 2014 7:13 pm

Re: New to NEO PIXEL - help please.

Post by ElectronicOz »

Check too that you are using the correct frequency.

I got stuck on that for a long time.

Sorry I cant ne more specific, but I just got up and havent even had breakfast.


There is a linewhere you set up the strip. In that is a number which is the frequency. If it is the wrong one, things wont work.

Most of the examples used the wrong one, from memory.

User avatar
Ronfinlay
 
Posts: 31
Joined: Tue Jan 10, 2017 1:06 am

Re: New to NEO PIXEL - help please.

Post by Ronfinlay »

Thanks. I really appreciate your efforts, all of you out there in Arduinoland.

I got it working, sort of, in that the LEDs do come on and run a series of display patterns.

Here's what I have purchased from Adafruit (What great products and service too.) : Uno, 8 RGBW Strip, 12 RGBW ring and 24 RGBW ring and a whole bunch more stuff !!! Very exciting. This is my first entry into programming anything. A bit nervous, but, seems worth the time to learn.

I've learned the "Wait" ties up the processor so only one of my LED sets can run at one time. The other 2 get stuck if I upload a different program. I assume concatenating all 3 programs will still run them in sequence, so the same problem will arise. I read that "mills" is the way to go, as I want to connect my 8 RGBW Strip, 12 RGBW ring and 24 RGBW ring, and have them work in sync, such as respond to a push button input to select all red, all green.... 7 colours, then wipe in 7 colours plus a 7 colour chase sequence, then theater in 7 colours and a 7 colour chase sequence, so each push of the button advances to the next presentation option.

For example, if I take the strand test for 8 pixel stick, and change to and save as 12 ring, then 24 ring, and change the number of pixels from 8 to 12, to 24, the LEDs behave differently. I assumed a wipe from one end to the other (off to red), one LED at a time would produce the same look, for each form factor. It didn't, and I don't see where the code would cause this. It's odd things like this that confuse me, so I'm looking into a page about the syntax to understand each function. Slow, for sure !

Also, I have a 16 x 2 LCD to display other switch input counts, plus I'd love it to display the colour presentation mode, not that that won't be obvious soon enough.

I also need to control a 5 V relay based on an input from a switch, with a DIP switch settable delay time. I am sure Arduino UNO can do this.

I'd love to post my code, but don't see where to provide that, as I'm sure that will help you help me better. I won't post it here, because I know that's against the rules.

Guidance or a link to code on any of these items would be greatly appreciated.

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”