Oct. 11th, 2015 12:59 am
elsewhence: (invent the universe)
[personal profile] elsewhence

we threw the sketch away, but maybe the LOGO! program we used to simulate whether it would work slightly conveys how messy it was.

the task was basically just this: build an alarm. if you switch it on, a green LED lights up to show that it is operational. if you then open the window (represented by another switch),  a red LED turns on and a piezo buzzer goes off. there's also way to reset the whole thing. this is one is already a bit more complex, with features like "green LED turns off when red one turns on", "can't switch the alarm on while the window is open", "if you close the window after the alarm has gone off it'll still keep doing its thing until you reset" and "can't reset while the window is open". the only problem i didn't get to resolve is that if you switch the alarm on while the window is open nothing happens, but if you then close the window, it immediately becomes operational. that doesn't really make much sense, it should remain switched off. who knows whether i'll fix it now though, it was just a way to keep us busy for a couple of hours. though i am curious whether it would work if translated into an actual circuit...

Date: 2015-10-11 02:06 pm (UTC)
From: [identity profile] silveradept.livejournal.com
The actual circuit would turn itself on when you closed the window, too, I suspect, because closing the window completes the circuit that the alarm needs to come on-line and simultaneously puts the system in a state where the alarm can come on-on-line. If you wanted the behavior you expected, you'd need to have the system set up such that it required a manual activation somewhere.

Date: 2015-10-11 04:51 pm (UTC)
From: [identity profile] katflace.livejournal.com
yeah, i was never expecting that maybe it would magically work the way it should if it was turned into an actual circuit. just wondering whether it would correctly behave the same way it does as a program. i mean, there's no reason it shouldn't, logic gates and flip-flops are logic gates and flip-flops (and actually flip-flops are logic gates too), it would just be cool to see in action...

maybe i'd need to throw in another flip-flop that holds the information of whether the "on" switch has been flipped and can only be set while the window is closed, which then passes that one on to the one that holds the information of whether the whole thing actually is on. i don't know. i'll probably just forget about it.