|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Help needed with algorithm
Quote:
Roger, your first half of your post is most helpful. I will poke at them tonight when I get home. What I have is Adafruit 24-Channel 12-bit PWM LED Driver - SPI Interface - TLC5947 with individual 24 simple LEDs connected. Sin or Cos wave is not to display a wave on LED matrix, but rather control brightness of the LEDs of a row of LEDs and that where PWM controller interface come in play. I don't have NeoPixel strip yet. I will order NeoPixel or DotStar when I get my tax refund . Perhaps it is easier for what i am trying to do. We'll see. |
|
#2
|
|||
|
|||
|
Re: Help needed with algorithm
The older LED Strips work just as well, by the by. It's mostly density and how they are programmed. The one I pointed out just happened to be the high end $. The lower end cost ones work well with the Arduino family without added boards. With 24 you can get by with just power off the Arduino.
Just be extremely careful not to feed the LEDs with more volts than specified! |
|
#3
|
||||
|
||||
|
Re: Help needed with algorithm
Quote:
http://www.ebay.com/itm/371518334189 Hopefully they are programmed same way as Adafrut strips |
|
#4
|
|||
|
|||
|
Re: Help needed with algorithm
Quote:
Searching around for ws2812b I found Sparkfun's tutorial on their own WS2812 and their Breakout board, with of course code. Again, start with their libraries and their examples, and get the feel for the method before trying your own. |
|
#5
|
|||
|
|||
|
Re: Help needed with algorithm
In regards to the code
Code:
float in, out;
for (in = 0; in < pi * 2; in = in + pi/500)
{
for (int i = 0; i <= 23; i = i + 1)
{
if (in > pi * 2 * i / 24 )
{
out = ((cos((in - pi) - (i*(pi*2)/24))+1)/2) *4095;
tlc.setPWM(i, out);
tlc.write();
}
}
}
Running it thru a spreadsheet, that if (in > pi * 2 * i / 24 ) only is true for 1 of the 24 i loops, so re-sets the LED 1/24th of the time. Good practice is setting the LED each loop, even if it is off, because the LED will keep the previous number until changed. When it does set the LED, out is in a range from zero to the low 4000s. If these LEDs are typical, the range is zero (off) to 255 (full on). Plus if they are color, you have to set each Red-Green-Blue to a level -- typically something like tlc.setPWM( i, color( outR,outG,outB ) ); Find the command in the examples; I'm just guessing what it is. |
|
#6
|
||||
|
||||
|
Re: Help needed with algorithm
Quote:
I am getting tired of TLC5947, as it continues to produce some artifacts that are not in the code. I tried 3 simple loops, 1st 100%, 2nd 50% and 3rd 0% brightness. It all works as expected but at the end of second loop all LEDs blink. |
|
#7
|
||||
|
||||
|
Re: Help needed with algorithm
I am still waiting for ws2812b LEDs, but after a bit of a break and then practicing on direct PWM pins, I finally cleaned up logic enough for it to do almost what I want. Here is what I got so far:
PHP Code:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|