Okay, I got Danny Havenith’s water torture animation ported to FastLED.

fastled-showtell
gplus
(Dougal Campbell) #1

Okay, I got Danny Havenith’s water torture animation ported to FastLED. Source code is on Gitub:

(Marc Miller) #2

Nice job! I tip my hat to your code skills.

(Dougal Campbell) #3

You are too kind – I am not a C++ programmer! I cribbed most of the basic skeleton from ?somewhere? when I did my blinky eyes project for Halloween 2015. Then I figured out how to do the Dependency Injection style of passing an external LED controller reference in by doing a lot of Googling.

I re-used that basic structure for this. I couldn’t figure out how to get a reference to the configured CFastLED object, so I settled for the CLEDController reference returned from addLeds(). And I was really rusty on pointers and references, but eventually hit the right combination of ‘*’, ‘&’, ‘.’, and ‘->’. :smiley:

I’m sure there’s stuff in my code that would make an experienced C++ coder say “WTF” more than a few times. Most of my work is in PHP and JavaScript, and the loose typing has made me a bit lazy!

(Dougal Campbell) #4

One thing I do like about coding the animations as a separate class with an ‘animate()’ method called from ‘loop()’ is that it makes it possible to run multiple animations simultaneously, and layer effects on top (in many cases).

(Dougal Campbell) #5

I’ve updated the code to allow each instance to have a custom color. You can also set the ‘gravity’ value individually now. I’ve update the demo .ino to demonstrate two droplets running at the same time, one blue, and the second one orange and with lower gravity.

Note, I also realized that the strip I’m testing with uses GRB color order, so the demo file reflects that, as well. So adjust accordingly for your own chipset.

(Cristian Martinez) #6

I think my ws2812bs are GRB

(Marc Miller) #7

@dougal Excellent updates.

(manny miller) #8

Hi, great conversion. when trying it, it drips up the strip. which adjustment do i need to make to make it drip the other direction. thanks in advance.

(Cristian Martinez) #9

Good observation. Following

(Dougal Campbell) #10

@manny_miller With my WS2811 strip, the drip starts at the “data-in” side, and falls away from there. What kind of LEDs are you using?

But I was already thinking about how to add an option to reverse the direction. So watch this space. :wink:

(manny miller) #11

im using ws281b. i do have a version using the neopixel library, but i doesnt have the realism. The nice bounce at the end :slight_smile:

(Cristian Martinez) #12

Yeah that bounce is what makes it look like water. The strip ill be using is much shorter so fingers crossed it works as expected. Ill be posting it here when done :slight_smile:

(Dougal Campbell) #13

@manny_miller Weird. So are you saying that you get drips starting at the far end of the strip, away from the data-in pixel where the controller connects? Or is your positioning just such that your controller is at the bottom, and your strip goes upwards from there?

(manny miller) #14

@dougal I’m using the ws2812b strip. I have it on a stand with connections at the bottom and it drips up the strip. So yes it’s drips away from the connection end.

(Cristian Martinez) #15

Odd behaviour

(Dougal Campbell) #16

@manny_miller Ah, okay. I thought maybe it was pushing the pixels out weirdly. Anyhow, I started working on a method for animating in the other direction.

(Dougal Campbell) #17

Okay, I finally got the reverse direction working, and the Github repo is updated. Sorry it took so long, but our household has been busy the past few days. I should probably make a new video…

(Cristian Martinez) #18

Ok awesome. For some reason on my ws2812bs it shows mostly green. Is this normal?

(Marc Miller) #19

@Cristian_Martinez Do you need to change the RGB color order in setup?

(Cristian Martinez) #20

I probably do. Ima try that when i get home. Im just glad i was able to rig up and Arduino uno as an ISP programmer because none of my ISP programmers will read my attiny85s :’(