Help with scheduling program

I'm trying to automate my home, and one aspect of this is a thermostat that I am building from scratch. I'm trying to come up with a way to schedule different temps at different times. I have 24 time slots (one for each hour).
I'm trying to get my Prop to output the right value. It should read the time until it reaches 15 (3p.m.) then output the temp (70). It is outputing 33.
Help?
RoboGeek
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"I reject your reality and subsitute my own!"
Adam Savage, Mythbusters
www.parallax.com
www.goldmine-elec.com
www.expresspcb.com
www.jameco.com
I'm trying to get my Prop to output the right value. It should read the time until it reaches 15 (3p.m.) then output the temp (70). It is outputing 33.
Help?
RoboGeek
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"I reject your reality and subsitute my own!"
Adam Savage, Mythbusters
www.parallax.com
www.goldmine-elec.com
www.expresspcb.com
www.jameco.com
Comments
Also, in the if statement, you had := instead of ==.
Jim
I think you need to use BYTE[noparse][[/noparse]@sunday + idx] to get the byte at the address calculated by @sunday+idx. I think you're getting the address itself and the low byte of that address is probably 33.
[noparse][[/noparse]edit] mynet's approach should work too.[noparse][[/noparse]/edit]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The more I know, the more I know I don't know.· Is this what they call Wisdom?
Now I need help with being able to change the values.(Here's the code[noparse]:)[/noparse]
RoboGeek
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"I reject your reality and subsitute my own!"
Adam Savage, Mythbusters
www.parallax.com
www.goldmine-elec.com
www.expresspcb.com
www.jameco.com
RoboGeek
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"I reject your reality and subsitute my own!"
Adam Savage, Mythbusters
www.parallax.com
www.goldmine-elec.com
www.expresspcb.com
www.jameco.com
With deSilva's code you avoid reading the values you don't need.
Jim
RoboGeek
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"I reject your reality and subsitute my own!"
Adam Savage, Mythbusters
www.parallax.com
www.goldmine-elec.com
www.expresspcb.com
www.jameco.com
·
I think this is what you want:
I tried it with your code and it worked.
Note that I didn't optimize it to read only the times, which you could do with 'repeat idx from 0 to 46 step 2'.
I hope this helps.
Another approach would be to use one table for the hours and another table for the settings. This might make your code easier to read and understand.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The more I know, the more I know I don't know.· Is this what they call Wisdom?
RoboGeek
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"I reject your reality and subsitute my own!"
Adam Savage, Mythbusters
www.parallax.com
www.goldmine-elec.com
www.expresspcb.com
www.jameco.com
·
You don't even need the return.
In fact, you probably don't even need the subroutine [noparse]:)[/noparse]
Jim
heh that's an easy trick [noparse]:D[/noparse] The key thing to understand is that the propeller loads an exact copy of the EEPROM into ram on startup.
Part one, add an I2C object that can write to the EEPROM.
Part two, code like "writeEEPROM( @my_var, my_var)" will backup any changes. I.e. you write the value of my_var to the same location in the EEPROM that it's stored in hub-ram and the updated value magically re-appears next reset.
Marty
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Lunch cures all problems! have you had lunch?
RoboGeek
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"I reject your reality and subsitute my own!"
Adam Savage, Mythbusters
www.parallax.com
www.goldmine-elec.com
www.expresspcb.com
www.jameco.com
·
RoboGeek
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"I reject your reality and subsitute my own!"
Adam Savage, Mythbusters
www.parallax.com
www.goldmine-elec.com
www.expresspcb.com
www.jameco.com
It provides examples of reading and writing to the eeprom.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Roboeek
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"I reject your reality and subsitute my own!"
Adam Savage, Mythbusters
www.parallax.com
www.goldmine-elec.com
www.expresspcb.com
www.jameco.com
·