Cloud and Lightning Code

Do you have a question on how to do something.
Ask in here.

Posts: 188
Joined: Fri Dec 30, 2011 6:57 am
PostPosted: Sun Sep 21, 2014 4:51 am
Has anyone had any luck modifying this code to work on the dimmer expansion module yet?

I'm getting ready to redo my entire coding for my tank upgrade and was hoping to incorporate clouds/lightning.
User avatar
Posts: 5362
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Sun Sep 21, 2014 6:31 am
Not yet
User avatar
Posts: 1426
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City
PostPosted: Sun Sep 21, 2014 6:39 am
Is there a way to write values directly to the dimming expansion? That's key. Otherwise it won't be fast enough for the right effect.

--Colin

Posts: 12327
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Sun Sep 21, 2014 7:27 am
Actually the wired dimming has a fast enough connection. The wireless one is the one that doesn't.
Roberto.

Posts: 188
Joined: Fri Dec 30, 2011 6:57 am
PostPosted: Sun Sep 21, 2014 8:28 am
Lee, is that because you haven't had time to try or because you ran into issues/errors that still need to be worked out? If it's simply a matter of changing just the PMWValue variables, maybe I'll try to take a stab at it.

In fact, I'll take a look at it now and see if I can figure it out. I'll report back here if I get it working.

I have wired connection dimmer expansion, so I should be good to go.
User avatar
Posts: 1426
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City
PostPosted: Sun Sep 21, 2014 8:52 am
The obstacle is here, in the analogWrite statement. That bypasses the RA libraries to write directly to the daylight pin. It's the only way to get fast enough flashes.

Code: Select all
 int a=random(1,5);    // Pick a number of consecutive flashes from 1 to 4. 
          for (int i=0; i<a; i++)
          {
            analogWrite(daylightPWMPin,random(DaylightPWMValue*2.55,255));    // Flash on
            int randy=random(20,80);    // Random number for a delay
            if (randy>71) randy=((randy-70)/2)*100;    // Small chance of a longer delay
            delay(randy);                // Wait from 20 to 69 ms, or 100-400 ms
            analogWrite(daylightPWMPin,DaylightPWMValue*2.55);      // Flash off
            delay(random(30,50));                // Wait from 30 to 49 ms
            wdt_reset();
          }


If you want to convert it, you'd need to find an equivalent way to write to the expansion module.

--Colin

Posts: 5
Joined: Fri Feb 28, 2014 9:11 am
PostPosted: Mon Mar 23, 2015 8:23 pm
Sorry if this is a dumb question. Can i use this code to add lightning and cloud to my main white and actinic channels with the output from the relay box dimming ports, and then use the channels 0-3 on dimming expansion (using 4-5 for dc pumps) with the wizard generated code for the my other colored leds, green red uv and 2700k white? i have a diy led with steves led drivers and 6 different color leds over my 180 currently controlled by a typhoon. or would it not get the same effect because the other channels won't have the effect. I was hoping this might work because the main number of leds is white and actinic leds. i didnt realize when i ordered the dimming module and plus upgrade last week that the custom lighting codes had not been written for dimming module because the design had changed. I have very high hopes with the dimming module and just want to use my leds to their full potential! or is the code getting close to be finished for the new dimming module?
User avatar
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL
PostPosted: Tue Mar 24, 2015 5:45 am
From what I understand this code only works on the relay dimming channels, it hasn't be ported over to the dimming hub yet. So I will work on your white and actinic lights only.
The dimming channel 1-3 will be normal dimming only.

Posts: 12327
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Tue Mar 24, 2015 5:59 am
Colin has already ported and made it even better when used with the dimming module.
Let's have him pitch in
Roberto.
User avatar
Posts: 1426
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City
PostPosted: Tue Mar 24, 2015 6:04 am
It's ported to the RANet Dimming Expansion, but that code could be adapted. The issue noted a few posts above has been solved. It's just a matter of putting it all together.

I don't have a standard dimming expansion, so there may be some trial and error. I'll see if I can come up with something over the next week or so.

--Colin
PreviousNext

Return to How do I code ...

Who is online

Users browsing this forum: No registered users and 1 guest

cron