|Topic Review (Newest First)|
|09-27-2015 06:31 PM|
The rtc.now() function used in that version of the DS1307 library returns the time as a complex type called DateTime. This means minutes, seconds etc can be accessed directly as seen in the UpdateLights method.
The DS3232 library's get() method returns time in a type that is called time_t, and must be treated slightly differently. See http://playground.arduino.cc/Code/Time for some good examples. You will need a slight rewrite of the UpdateLights method to match this way of accessing seconds/minutes/hours, but not much should need changing otherwise!
Sent from my D6603 using Tapatalk
|09-27-2015 09:52 AM|
Different RTC library
Thanks for sharing such a great code with us. I ve tried it and it works great on my test build, wich has DS1307 rtc attached to it. But for my tank I use DS3232 rtc, becose its more accurate and doesent miss minutes after longer periods of time. It needs different RTC library than the one used in your code. I changed your code a litle, but it doesent work, becose i dont undestand what rtc.now() funciton actualy outputs, at least I think thats wrong. I attached my code and library to this post and ask you if you could take a look what I ve done wrong.
|02-03-2014 06:16 PM|
I'll let you know what I find.
I'm at the Arduino forum as I don't know wether to increase or decrease the frequency of the pins.
Changing is pretty straight forward.
Truthfully, I've had nothing but issues ever since I changed out the Sainsmart clone for an actual Arduino.
Who would have thought?
|02-03-2014 06:08 PM|
|02-03-2014 04:58 PM|
Ok, so I'm seriously confused now. I've been fiddling around, and I just can't get it to stop the jerky step up.
I don't understand why it's fine once, and then reverts back to stepping?
I've tried several different things: only using two channel, and I even went back to the old original sketch that I knew worked...I have video to prove it.
Now I'm down to blaming hardware as it is the only thing different since originally starting.
I went from a Sainsmart Mega to an actual Arduino Mega, and from LEDsee drivers to Meanwell LDDs.
I'm starting to question the PWM frequency of the Arduino board.
Do you think adjusting these would help?
|02-02-2014 02:34 AM|
|sketch804||Gonna follow this one!|
|01-29-2014 05:50 PM|
Oh well, new plan:
You initialize it just like the example with AddPoint() and set some generic times and intensities, let's call it InitializeLights(). The actual values don't matter, they will be overwritten anyway.
You then make a second function to set the actual values using SetPoint(), let's call it UpdateLights(). Since the channels are already set up elsewhere you only have to set the points this time, the channel creation with pins and such is not necessary. Example:
int channelNo = 0; Channels[channelNo].SetPoint(0, 8, 0, 0); Channels[channelNo].SetPoint(1, 8, 30, 255); Channels[channelNo].SetPoint(2, 20, 0, 255); Channels[channelNo].SetPoint(3, 20, 30, 0); channelNo = 1; // ... etc ...
|01-29-2014 05:02 PM|
I must be doing something wrong? It won't initialize with .SetPoint().
Using the example sketch I added 8 channels each channel has 4 periods.
It works fine with AddPoint().
I changed all periods to .SetPoint(), indexed each period 0 to 4, and then added variables risehour, risemin, color_max. With the exception of the first and last period where the intensity equals 0.
I then declared each variable with a value.
int RBlue_max =255
int rise hour = 8
And it failed to initialize. I then changed all the set points back to whole numbers to test, and it again failed to initialize using .SetPoint()
I'm missing something?? Any suggestions?
|01-28-2014 06:30 PM|
And another thing. The example uses the same fade mode as the old one, where PWM is increased in a linear fashion (fademode_linear). But due to the way we perceive light this does not look linear at all. The alternative mode (fademode_exponential) attempts to compensate for this. The fademode is chosen for each channel during initialization.
|01-28-2014 05:07 PM|
Ok. I had no issues getting the new sketch up and running as written with 7 channels on 4 periods(points).
No Steps!!! Just even smooth linear increasing!
Now the tricky part...the integration.
Just a couple of questions just to be clear.
So, something like this
Channels[channelNo].SetPoint(1, 8, 0, 0); Channels[channelNo].SetPoint(2, 8, 30, 255); Channels[channelNo].SetPoint(3, 20, 0, 255); Channels[channelNo].SetPoint(4, 20, 30, 0);
" Since you will be calling InitializeChannels several times"
Anything I need to change to call this function?
Ok. I see where it is initialized in setup().
I think I can just call that at my enter buttons on the LCD as well, so it is only called when a change is made?
|01-28-2014 08:06 AM|
|benjaf||I committed a small fix, you could not add points with their float intensity (0-1) as everything was treated like an int (0-255).|
|01-28-2014 05:39 AM|
Well the good thing is you don't really need to bother with most of the stuff in the .h and .cpp files. I think the most significant change is that you have to think of the light intensity as a chart with lines connecting a bunch of points.
Regarding the whole variable thing. Since you will be calling InitializeChannels several times you need to use SetPoint() rather than AddPoint(). The only real difference is that you need to include the point number:
Channels[channelNo].SetPoint(#, 8, 0, 0);
|01-27-2014 10:40 PM|
Lol!! Hi buddy.
Ok. So, I'm looking over the new sketch. I'm sure I will get used to it, but it is still kind of greek to me.
Before I start trying to integrate this new sketch, and since you already know what I'm trying to accomplish, do you foresee any issues I may have?
Like using variables instead of whole numbers...stuff like that.
|01-23-2014 12:45 AM|
I think you might be right about the code...actually I have no doubt you wouldn't steer me wrong.
Comfort...is pretty much the reason I haven't looked into changing to your new code.
I never had an issue with your original code. I understand it well, and then I put in all that effort to integrate the touch screen. I'm stubborn and was going to make work come hell or high water!
Honestly, I haven't even seen the new version with he exception of the snippets that have been posted.
I'll check it out...so be prepared!
Thanks for all the help mate!
|01-22-2014 06:00 PM|
I am slightly concerned that the whole schedule reading is simply too wasteful when you have that many channels. The new version should be somewhat better, but I certainly understand that you don't really want to replace it
|This thread has more than 15 replies. Click here to review the whole thread.|