Time for additional Ethernet add-on with PWM output
- DrewPalmer04
- Posts: 818
- Joined: Tue May 29, 2012 2:12 pm
- Location: Christopher, IL
Re: Time for additional Ethernet add-on with PWM output
Yep. Time is correct. I have it syncing only once a day now too.
- DrewPalmer04
- Posts: 818
- Joined: Tue May 29, 2012 2:12 pm
- Location: Christopher, IL
Re: Time for additional Ethernet add-on with PWM output
Could the milli() in the Ethernet side of the code you provided me be using up all of my RAM?
Re: Time for additional Ethernet add-on with PWM output
millis() is a unsigned long variable size, which means it only consumes 4 bytes.
Roberto.
- DrewPalmer04
- Posts: 818
- Joined: Tue May 29, 2012 2:12 pm
- Location: Christopher, IL
Re: Time for additional Ethernet add-on with PWM output
Hmm. Any other thoughts?
Re: Time for additional Ethernet add-on with PWM output
Serial.print is your friend....
Debugging is part of coding
Debugging is part of coding
Roberto.
- DrewPalmer04
- Posts: 818
- Joined: Tue May 29, 2012 2:12 pm
- Location: Christopher, IL
Re: Time for additional Ethernet add-on with PWM output
Haha ok. I'll work on it more.
- DrewPalmer04
- Posts: 818
- Joined: Tue May 29, 2012 2:12 pm
- Location: Christopher, IL
Re: Time for additional Ethernet add-on with PWM output
Maybe you can help me talk through this. The PWM is sapzing but I have full control from the iPhone app. This would mean the issue is in the PWM part of the code?
Re: Time for additional Ethernet add-on with PWM output
Yeah, I think it is in your PWM section of your code.
Here is what I would suggest:
No more than 1 analogWrite() per channel. I see you have several instances of it.
Change the global variable (blue1,white1,blue2,white2) and apply it at the end of the loop by calling the analogWrite().
This way, you can Serial.print what you are sending and know exactly what is going on.
Here is what I would suggest:
No more than 1 analogWrite() per channel. I see you have several instances of it.
Change the global variable (blue1,white1,blue2,white2) and apply it at the end of the loop by calling the analogWrite().
This way, you can Serial.print what you are sending and know exactly what is going on.
Roberto.
- DrewPalmer04
- Posts: 818
- Joined: Tue May 29, 2012 2:12 pm
- Location: Christopher, IL
Re: Time for additional Ethernet add-on with PWM output
Thanks very much for that help
Before I had byte sec min etc. then getDS1307RTC for every section of fade in. Then fade out etc. I had it all sectioned off. But now the code is all connected by dayMinute (hour() * 60 + minute()). I think this is getting confused because its not sectioned like it was before.
Before I had byte sec min etc. then getDS1307RTC for every section of fade in. Then fade out etc. I had it all sectioned off. But now the code is all connected by dayMinute (hour() * 60 + minute()). I think this is getting confused because its not sectioned like it was before.
- DrewPalmer04
- Posts: 818
- Joined: Tue May 29, 2012 2:12 pm
- Location: Christopher, IL
Re: Time for additional Ethernet add-on with PWM output
Moonrise confirmed working. Must be in other part of code.
Fade in confirmed working.
Fade in confirmed working.
- DrewPalmer04
- Posts: 818
- Joined: Tue May 29, 2012 2:12 pm
- Location: Christopher, IL
Re: Time for additional Ethernet add-on with PWM output
Issue is in fade out...trying to narrow it down...all other modes are working perfectly.
- DrewPalmer04
- Posts: 818
- Joined: Tue May 29, 2012 2:12 pm
- Location: Christopher, IL
Re: Time for additional Ethernet add-on with PWM output
Baffled by the fade out. It looks good to me but im crossed eyed lol. Can anyone spot anything wrong in "fade out?"
- DrewPalmer04
- Posts: 818
- Joined: Tue May 29, 2012 2:12 pm
- Location: Christopher, IL
Re: Time for additional Ethernet add-on with PWM output
I believe I'll re build this using the Time library. This way it will calculate everything based on time frames instead of long formulations. I may be able to simplify the code this way and have it better partitioned in periods of time instead of a large loop. Thoughts?
Time for additional Ethernet add-on with PWM output
Sounds like a good plan.
The opposition would sound like this...
"I think i should continue banging my head against the wall and continue trying to troubleshoot the ntp, read rtc, glob of code thats been driving me crazy..."
The opposition would sound like this...
"I think i should continue banging my head against the wall and continue trying to troubleshoot the ntp, read rtc, glob of code thats been driving me crazy..."
- DrewPalmer04
- Posts: 818
- Joined: Tue May 29, 2012 2:12 pm
- Location: Christopher, IL
Re: Time for additional Ethernet add-on with PWM output
Lol I built it originally with RTC in mind which didn't utilize Time.h but now I'm using NTP. So I'm going to scrap my old code and start fresh with the Time library.
- DrewPalmer04
- Posts: 818
- Joined: Tue May 29, 2012 2:12 pm
- Location: Christopher, IL
Re: Time for additional Ethernet add-on with PWM output
I like to think that I've saved someone out there a lot of time by NOT recommending trying to hook into RA RTC. It doesn't like to be read. Lol I never tried master, slave config but save yourself time and just use NTP
Re: Time for additional Ethernet add-on with PWM output
Hum...
Both RTC and NTP routes use the same Time library....
I'm not sure why you have problems, but the dimming module shares the same RTC with RA and the dimming module can read RTC just fine.
That's how the dimming module syncs in time. It reads the RA RTC on start-up and resyncs every hour.
In either cases, why not just use the RA libraries for your ethernet board?
Or at least just copy the PWMSlope function from Globals and use it instead of trying to recreate the wheel.
Both RTC and NTP routes use the same Time library....
I'm not sure why you have problems, but the dimming module shares the same RTC with RA and the dimming module can read RTC just fine.
That's how the dimming module syncs in time. It reads the RA RTC on start-up and resyncs every hour.
In either cases, why not just use the RA libraries for your ethernet board?
Or at least just copy the PWMSlope function from Globals and use it instead of trying to recreate the wheel.
Roberto.
- DrewPalmer04
- Posts: 818
- Joined: Tue May 29, 2012 2:12 pm
- Location: Christopher, IL
Re: Time for additional Ethernet add-on with PWM output
That's a good point. I can do that IF I figure out how to read the internal memory of the controller. I know it's possible because the serial pinout allows for Tx Rx but I just don't know how to do this. The issue lies in the lack of my experience and "trying" to make a PWMslope with what knowledge I have if you could guide me in how to read the internal memory with my ethernet board I could try and make this happen
Re: Time for additional Ethernet add-on with PWM output
Why do you need internal memory?
Use hard code values:
Use hard code values:
Code: Select all
blue1=PWMSlope(10,0,21,0,0,100,60,0);
Roberto.
Re: Time for additional Ethernet add-on with PWM output
Actually, since you are using the whole range, you need this:
Code: Select all
blue1=PWMSlope(10,0,21,0,0,255,60,0);
Roberto.
- DrewPalmer04
- Posts: 818
- Joined: Tue May 29, 2012 2:12 pm
- Location: Christopher, IL
Re: Time for additional Ethernet add-on with PWM output
Ohhh hard code it. Well I'll take the blame on not thinking about that. Duh! Much appreciated Roberto
- DrewPalmer04
- Posts: 818
- Joined: Tue May 29, 2012 2:12 pm
- Location: Christopher, IL
Re: Time for additional Ethernet add-on with PWM output
When I attempt to use Globals.h for PWMSlope:
I get:
In file included from messwiththis.ino:5:
/Users/apalmer/Documents/Arduino/libraries/Globals/Globals.h:883: error: 'OneWire' does not name a type
I add OneWire.h
Get this:
core.a(new.cpp.o): In function `__cxa_guard_acquire':
/Users/apalmer/Desktop/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/new.cpp:13: multiple definition of `__cxa_guard_acquire'
Globals/Globals.cpp.o:/Users/apalmer/Documents/Arduino/libraries/Globals/Globals.cpp:209: first defined here
core.a(new.cpp.o): In function `__cxa_guard_release':
/Users/apalmer/Desktop/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/new.cpp:14: multiple definition of `__cxa_guard_release'
Globals/Globals.cpp.o:/Users/apalmer/Documents/Arduino/libraries/Globals/Globals.cpp:210: first defined here
core.a(new.cpp.o): In function `__cxa_guard_abort':
/Users/apalmer/Desktop/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/new.cpp:15: multiple definition of `__cxa_guard_abort'
Globals/Globals.cpp.o:/Users/apalmer/Documents/Arduino/libraries/Globals/Globals.cpp:211: first defined here
core.a(new.cpp.o): In function `__cxa_pure_virtual':
/Users/apalmer/Desktop/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/new.cpp:17: multiple definition of `__cxa_pure_virtual'
Globals/Globals.cpp.o:/Users/apalmer/Documents/Arduino/libraries/Globals/Globals.cpp:207: first defined here
I get:
In file included from messwiththis.ino:5:
/Users/apalmer/Documents/Arduino/libraries/Globals/Globals.h:883: error: 'OneWire' does not name a type
I add OneWire.h
Get this:
core.a(new.cpp.o): In function `__cxa_guard_acquire':
/Users/apalmer/Desktop/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/new.cpp:13: multiple definition of `__cxa_guard_acquire'
Globals/Globals.cpp.o:/Users/apalmer/Documents/Arduino/libraries/Globals/Globals.cpp:209: first defined here
core.a(new.cpp.o): In function `__cxa_guard_release':
/Users/apalmer/Desktop/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/new.cpp:14: multiple definition of `__cxa_guard_release'
Globals/Globals.cpp.o:/Users/apalmer/Documents/Arduino/libraries/Globals/Globals.cpp:210: first defined here
core.a(new.cpp.o): In function `__cxa_guard_abort':
/Users/apalmer/Desktop/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/new.cpp:15: multiple definition of `__cxa_guard_abort'
Globals/Globals.cpp.o:/Users/apalmer/Documents/Arduino/libraries/Globals/Globals.cpp:211: first defined here
core.a(new.cpp.o): In function `__cxa_pure_virtual':
/Users/apalmer/Desktop/Arduino.app/Contents/Resources/Java/hardware/arduino/cores/arduino/new.cpp:17: multiple definition of `__cxa_pure_virtual'
Globals/Globals.cpp.o:/Users/apalmer/Documents/Arduino/libraries/Globals/Globals.cpp:207: first defined here
Re: Time for additional Ethernet add-on with PWM output
You have to either use all of the RA libraries or copy the PWMSlope function into your code.
Roberto.
- DrewPalmer04
- Posts: 818
- Joined: Tue May 29, 2012 2:12 pm
- Location: Christopher, IL
Re: Time for additional Ethernet add-on with PWM output
Thanks got it...just copied the code instead of all the entire library!
- DrewPalmer04
- Posts: 818
- Joined: Tue May 29, 2012 2:12 pm
- Location: Christopher, IL
Re: Time for additional Ethernet add-on with PWM output
It's working great. I'll be the first to admit. I was reinventing the wheel. updates to
Come soon
Come soon
Time for additional Ethernet add-on with PWM output
Awesome! How many PWM ports does that board have?
- DrewPalmer04
- Posts: 818
- Joined: Tue May 29, 2012 2:12 pm
- Location: Christopher, IL
Time for additional Ethernet add-on with PWM output
Sorry, I'm electronically inept...does that mean 4 channels or 2?
- DrewPalmer04
- Posts: 818
- Joined: Tue May 29, 2012 2:12 pm
- Location: Christopher, IL
Re: Time for additional Ethernet add-on with PWM output
Four channels there are a lot of different Ethernet boards. So I supplied the link.
- DrewPalmer04
- Posts: 818
- Joined: Tue May 29, 2012 2:12 pm
- Location: Christopher, IL
Re: Time for additional Ethernet add-on with PWM output
lnevo wrote:Sorry, I'm electronically inept...does that mean 4 channels or 2?
Should have also mentioned that it's NOT boosted. Meaning anyone thinking about doing this youll only output about 5v instead of 10v for most drivers. Keep that in mind if you want 100% brightness. This, as is, will only supply roughly 50% brightness without boosting the output of the PWM pins