Long input signal to a short output signal

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
grboonstra
Posts: 6
Joined: Wed Feb 08, 2017 8:10 am
Contact:

Long input signal to a short output signal

Post by grboonstra »

Dear programmers,

How can i program 4 switches, with only on active but this input has a long "1" input and i would have a short output to a led/relay.
summary: 4 input switches to 4 output leds/relays. Only when ex. input 1 is high for a long period then i would that output 1 is high for a short while ( ex. 1 second)

How can i do this? (without a flashing led or clicking relay)

thank you in advance! :)

Rene Boonstra

chipfryer27
Valued Contributor
Valued Contributor
Posts: 659
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 184 times
Been thanked: 203 times
Contact:

Re: Long input signal to a short output signal

Post by chipfryer27 »

Hi

Not quite sure I understand exactly what you are trying to do, but if I am correct in understanding you have/want:-

4 x input switches
When any one of these is activated to exceed a preset time (e.g. x-milliseconds), a corresponding LED/Relay will activate for another preset time (e.g. y-milliseconds).

Is this correct?

If so that is easily done and there are many ways to do so depending on your chosen microcontroller. First thing is to define your "input" time, the length of time the switch must be active before we do anything else. Then define your "output" time, the length of time your LED/Relay will be active for. Without knowing full details of your circuit and what your intentions are it is difficult to say what the best way to achieve this would be.

Things to consider may include having the inputs going to Interrupt On Change (IOC) pins on the microcontroller and have the interrupt handling routine check how long the switch has been active for and go from there. Alternatively you may just want a very simple routine testing the inputs and waiting for a switch to activate. Upon activation it branches, waits the predefined "input" time, tests again and if still active then processes the output.

I hope this may be of some small help.
Regards

grboonstra
Posts: 6
Joined: Wed Feb 08, 2017 8:10 am
Contact:

Re: Long input signal to a short output signal

Post by grboonstra »

Dear chipfryer27,

No i want when a switch is pressed continuously 5 minutes, 1 hour , --- then the output must be activated for 1 second. When a other switch is pressed the that output must be 1 sec. and so on.

chipfryer27
Valued Contributor
Valued Contributor
Posts: 659
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 184 times
Been thanked: 203 times
Contact:

Re: Long input signal to a short output signal

Post by chipfryer27 »

Hi

That is pretty much what I described.

You want to detect when a switch is pressed continuously. How are you defining continuous? Surely it must be active for a time exceeding some value? You said five minutes or one hour. How do you differentiate between such? Is it considered inactive if pressed for only four minutes an fifty-nine seconds? What about seven minutes or fifty eight minutes?

Define a minimum value that the switch has to be pressed for.
Test for switch status
If active start a loop count/timer
If still active after your time is met then perform whatever output you want.

Regards

Post Reply