How to pause output but not time keeping ?
lockadoc
Posts: 115
I'm making an eight channel·light timer program, in one clog the output will be timed, but when an input goes high an other clog will·take over the output for three minutes than return control back to clog one. how can I make clog two control the output while clog one still keeps its timming, but not change the output during that three minutes?
The main goal I'm going for in this program is an Eight channel light timer for some party lights.
···· I have a four hundred foot long chain of 120 volt lights. the controller will be in the middle with
···· four channels (red,blue,yellow,green)to the left and four to the right using 8)25amp solid state relays.All the lights will
···· come on at dusk,than at 11:00pm 2 channels will go off, at 12:00am 2 more cannels will go off, than at 1:00am
···· 2 more channel will go off. Leaving the two remaing channels on until dawn.
·Added features:
···· 1- Have some preprogrammed light displays· (something like the Experiment #7:"A Lighting Controller"
········ from the book basic stamp book StampWorks and the "Mother of all LED sequencers" from the Propeller
········ object exchange) that run for a few minutes than return to the default light timing control
····· 2- A tv remote control to change the light display ( buttons 1-9 would change the way the lights would flash)
····· 3- With the push of a button (one on the contoller box with an other on the Tv remote control)
········· all lights will go back on for one hour then return to the default timing control.
thanks BillyS
Post Edited (lockadoc) : 9/22/2009 4:01:28 AM GMT
The main goal I'm going for in this program is an Eight channel light timer for some party lights.
···· I have a four hundred foot long chain of 120 volt lights. the controller will be in the middle with
···· four channels (red,blue,yellow,green)to the left and four to the right using 8)25amp solid state relays.All the lights will
···· come on at dusk,than at 11:00pm 2 channels will go off, at 12:00am 2 more cannels will go off, than at 1:00am
···· 2 more channel will go off. Leaving the two remaing channels on until dawn.
·Added features:
···· 1- Have some preprogrammed light displays· (something like the Experiment #7:"A Lighting Controller"
········ from the book basic stamp book StampWorks and the "Mother of all LED sequencers" from the Propeller
········ object exchange) that run for a few minutes than return to the default light timing control
····· 2- A tv remote control to change the light display ( buttons 1-9 would change the way the lights would flash)
····· 3- With the push of a button (one on the contoller box with an other on the Tv remote control)
········· all lights will go back on for one hour then return to the default timing control.
thanks BillyS
Post Edited (lockadoc) : 9/22/2009 4:01:28 AM GMT
Comments
I'm unsure if I understand right. You wrote "clog" do you mean "clock" a time measuring and time displaying "machine"
or do you mean "cog" which means one of the 8 processors-cores of the propellerchip ?
The answer to your question depends on your meaning of "clog".
If you have any lines of code - even if they don't compile - create an archive using the file-archive-function of he propellertool and attach the archived code with the attachement-manager
to a posting.
best regards
Stefan
If you need 2 then eg.:
cog·1 will manage the outa(1) according to your timing scheme. It will look over ina(2) and while it is high·will keep the dira(1) in input state thus·leaving complete control over out(1) to cog1. While the out(1) becames input the cog·1 can still continue in it's timing writes to outa(1) register without afecting the phisical state of the prop pin.
cog·2 will continuously copy the ina(1) to the outa(1). While the ina(2) is low the dira(1) will be·input otherwise it will be output (for 3 minutes)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
· Propeller Object Exchange (last Publications / Updates)
Post Edited (dMajo) : 9/16/2009 4:38:03 PM GMT
Look at figure 1-2 in the prop manual
Use 1 pin for cog1, and another for cog2 and combine theme with a resistor as in the attached picture.
While the cog2 pin is an input, the cog1-pin has the control over the output level.
If cog2 needs to control the Light, set the cog2-pin as output and then you can overwrite the state of cog1
with high or low.
Andy
at dusk all 8 channels come on,than about three hours later 2 channels go off, than one hour later two more channels go off, than one more hour until two channels go off. the last two remaining channels stay on until dawn. but when an input button is pressed all 8 channels do a razzle dazzle display for three minutes
Thanks BillyS
Post Edited (lockadoc) : 9/17/2009 12:44:21 AM GMT
so now it is much clearer what you want to do.
For this you can use one single cog. In another way two cogs
The main thing is to use TWO different variables that contain the bits set or cleared.
with these two variables you make the bitwise logical operation "OR"
example
by bitwise "or-ing", if a bit in variable 1 OR in variable 2 is set, the result is: bit set
at the beginning all 8 channels on
%11111111
now in your program you have one cog running a loop that checks if 3 hours are passed: channel 1 channel 2 off
new value %00111111
since start 4 hours passed channel 3 and channel 4 off
new value %00001111
since start 5 hours passed channel 5 and channel 6 off
new value %00000011
the second cog has a loop watching the inputpin
if input pin is high
set value of variable 2 to all 8 channels on %11111111
start 3 minute timer
after three minutes set value of variable 2 to %00000000
in cog 1 inside the loop you calculate the result of the bitwise or of variable 1 and variable 2
example
that's the basic principle
if you need more help on programming this
post your first attempt of code - even if it does not compile - and ask questions whatever you like
by posting YOUR code you show the forum what you have tried and how far you did get with it.
it doesn't matter if you have just gone 0,001 inch or half the way it just shows you DID what you could do
on your own.
best regards
Stefan
Post Edited (StefanL38) : 9/17/2009 2:08:01 PM GMT
BillyS
At present I have all the hardware set up, and tested to see if they work, just they are not tied together for my needs.
If I can just be pointed to the right·direction for each question I ask ( I'm only going to ask one at a time·so i can work on it),,
I'd love to get this up and running Now. but I·don't want the answers given to me so it most likely going to take a month or two, I'm trying to teach myself how to do this.
I'm not finding this easy to do·, I do love the challenge. File Is Attached "TIMER-LIGHT"
BillyS
I took a quick look into your code.
From looking at it 3 minutes I don't understand the concept
Thanks for your support and input.
BillyS
Post Edited (lockadoc) : 9/19/2009 2:38:30 AM GMT
as long as your not running out of longs (I mean RAM) it doesn't matter.
When RAM gets short or if the development is finished comment out lines of "PUBs" that you don't need
best regards
Stefan
I'm working on making the changes you suggested, that makes it a lot easier to work it out.
BillyS
Still, you don't have to use this object for time of day, you could use it to keep track of elapsed time. When you detect dark (dusk) you call the .reset() method to clear the registers. You can then poll the .todmins() method to schedule your other events (3 hrs = 180 mins, etc.). In a loop I would call the .getsecs() method and when it's zero do the other checks. Based on what you're doing checking every thing once a second should be fine.
The only possible problem could be a reset of the program when dark, because you would never see the light-to-dark transition that kicks off the lights.
I've attached my new timer and a demo so you can see how it works.
I'm working on using all the input given so far.
BillyS
My first question Is
How do I get· the first set of lights to go off after three minutes?
I think if i see how its done I can work on·getting the rest of my timing taken care of
JonnyMacs timing program is just what I needed(·I really like the total Minutes of the day part.)
Thanks BillyS
Post Edited (lockadoc) : 9/21/2009 3:59:52 PM GMT
you mentioned you would like to find out the coding yourself.
according to this I give you some hints to work it out.
If YOU want to have more help ask whatever you like
you have to take a snapshot of the time when the lights should go on or all 8 lights are switched on
then RELATIVE to this timestamp you calculate the time that has passed in a loop
if actualtime - timestamp => 2 '(hours) or 120 minutes
actualPattern := Light1
if actualtime - timestamp => 3 '(hours) or 180 minutes
actualPattern := Light2
for easy testing change to minutes or even 5 second steps so you don't have to wait for hours until something changes
if you want me to compile your code use the archive-function of the propellertool
(main-menu file - archive - project
the zip-archive will include ALL files that are nescessary to compile the whole project
regardless of where the files are stored
best regards
Stefan
This is what I needed.You will see a big difference next time I post here.
Thanks Again
BillyS
[noparse][[/noparse]Edit] You might want to spell out your full requirements for the program (in detail) and let others have a whack at it. You seem very new, and this is a bit sophisticated. Seeing solutions from several sources will help you develop your programming skills without getting too bogged down.
Post Edited (JonnyMac) : 9/21/2009 10:04:27 PM GMT
·The main goal I'm going for in this program is an Eight channel light timer for some party lights.
···· I have a four hundred foot long chain of 120 volt lights. the controller will be in the middle with
···· four channels (red,blue,yellow,green)to the left and four to the right using 8)25amp solid state relays.All the lights will
···· come on at dusk,than at 11:00pm 2 channels will go off, at 12:00am 2 more cannels will go off, than at 1:00am
···· 2 more channel will go off. Leaving the two remaing channels on until dawn.
·Added features:
···· 1- Have some preprogrammed light displays· (something like the Experiment #7:"A Lighting Controller"
········ from the book basic stamp book StampWorks and the "Mother of all LED sequencers" from the Propeller
········ object exchange) that run for a few minutes than return to the default light timing control
····· 2- A tv remote control to change the light display ( buttons 1-9 would change the way the lights would flash)
····· 3- With the push of a button (one on the contoller box with an other on the Tv remote control)
········· all lights will go back on for one hour then return to the default timing control.
Without the input from from these forums I think I might have giving up on trying to learn programming when I first got the Boe-Bot.
Thanks to all the people that have·answered my question over the years.
Thanks From BillyS in Louisville Ky.
·
I'm quite sure you have this all perfectly clear in your head, but just ask you can't see what I'm wearing we can't see what's inside your head.
you attached a first program that contains a line
From this line of code I can guess you might want help how to code the light switching. If you post a concrete question you will get answers very quickly.
You can post a new question every hour (REALLY)
and you will get answer after answer. I really enjoy this way of posting.
There is only one thing that I (and I guess the other forum members too) don't like:
I don't like posting a 100 pages tutorial "all about programming the propeller from A to Z"
So it is up to you to post a clear statement what kind of help you want to have as next step as a CONCRETE question.
best regards
Stefan
right now I'm just trying to call a method· with out passing any parameters, and don't see
anywhere to do it from the PROPELLER EDUCATION KIT LABS:FUNDAMENTALS book
Can someone show me how its done with what I've written?
I know it must be something simple,(so simple that I will most likely will·slap my head)
when·I try to load it I get an error the object I'm trying to load I got from the object exchange.
Thanks
··· BillyS
Post Edited (lockadoc) : 9/24/2009 3:59:13 PM GMT
Post Edited (photomankc) : 9/24/2009 3:45:11 PM GMT
first of all: use the archive function of the propeller-tool to attach code
You find this function in the propeller-tool in the main-menu
under file - archive -> project...
make that tab the actual tab that contains your main subroutine
then click
file - archive -> project...
by using the archive-function ALL files were zipped together that are nescessary to compile your project
from your single file test2.spin where you refer to another *.Spin-File called "LedSequencer_asm.spin"
I can't help you because I cannot see what is INSIDE the file "LedSequencer_asm.spin" .....
You have luck as I have the file from the general installation of the propeller-tool
OK the file "LedSequencer_asm.spin"
has a method
this method does NOT fullfill the quasi-standard how methods in objects should be named
EVERY object SHOULD have a method named "Start"
you should modify the file that you have these two methods
and in your file test2.spin you refer to your object "lightshow" by
in the exact same way as you start the timer-object.
You only have to call the start-method ONCE as the start-emthods starts another cog in which the PASM-code is running in a loop itself
best regards
Stefan
I made the adjustments you stated,they did not work out for the LedSequencer.BUT I DID USE YOUR
LESSON WITH SOME OTHER OBJECTS AND THEY WORKED·and that taught me how to do it.
thank you.
I have no question this time, it would be great to use this object for my display,but for now I'll just work with displays I can make.
··· This is what happened when I tried out the new Test2 all the leds lit up but nothing happened when the button was pushed
When I ran the LedSequencer by itself·with the outputs being·16-23 only 17-22 came on, then after almost two minutes 23 came on
then·about minute later 16 came on , they (16 and 23)·did blink from then on but at avery slow rate 30-60 seconds.
Again thank-you
BillyS
Post Edited (lockadoc) : 9/25/2009 4:15:40 AM GMT