Loop While!

For general Flowcode discussion that does not belong in the other sections.
Bijumon
Posts: 23
http://meble-kuchenne.info.pl
Joined: Fri Dec 30, 2022 11:44 am
Has thanked: 1 time
Been thanked: 6 times

Re: Loop While!

Post by Bijumon »

Hi Viktor and Jorgen

Regarding your suggestion of safety, I've added a maximum movement timer.
This timer will automatically stop the motor after a fixed duration
(e.g., 10 seconds, which can be adjusted to any desired length).
Over-current sensing could also be considered to protect the motor from a mechanical jam or in case of limit switch failure.
I attempted to put the microcontroller to sleep when not in use but couldn't find a direct option for this functionality in Flowcode.
However, I've added an LED flasher to serve as a sleep/wake indicator.
Please suggest if there is anything more safety features should consider.
Note that I did this as a hobby and have only tested it via Flowcode simulation, not on actual hardware.

Bijumon
Attachments
DecisionTest.fcfx
(30.92 KiB) Downloaded 11 times

jgu1
Posts: 833
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 724 times
Been thanked: 186 times

Re: Loop While!

Post by jgu1 »

Hi Bijumon!

:lol: :lol: I have in same moment added in your examble the same with a timer. I also add a foto beam, so if a car or others should park in the arrea where the port is, then the port can´t go down and not crash the car :D

I will again have a look on your program, meanwhile you can check mine, any correction is welcome :lol:

Jorgen
Attachments
DecisionTestTimer (1).fcfx
(35.03 KiB) Downloaded 13 times

Bijumon
Posts: 23
Joined: Fri Dec 30, 2022 11:44 am
Has thanked: 1 time
Been thanked: 6 times

Re: Loop While!

Post by Bijumon »

Hi Jorgen

I've Checked your recent modifications and have a couple of suggestions regarding the timer functionality and obstacle detection.
The timer is now counting correctly, but instead of calling stop macro upon reaching the set time, it's currently only turning on an LED.
My suggestion is to call the 'stop' macro when the set time is reached. This macro will stop the motor and reset the timer (my last update includes this).
also noticed an issue with the current obstacle detection logic, it only prevents the initial downward movement.
It will not prevent or stop the system if an object is detected after the downward movement has already started.
so my suggestion is Do not allow any movement (up or down) if any presence of object is detected at the start,
and If an object is detected during a downward movement, the system must immediately stop and move back up until it reaches the Up end stop.

Please confirm if you are comfortable with these proposed changes to the timer and obstacle detection logic.
If so, I will proceed with adding the improved obstacle detection feature based on my last update.

Bijumon

jgu1
Posts: 833
Joined: Thu Dec 03, 2020 8:25 pm
Location: Denmark
Has thanked: 724 times
Been thanked: 186 times

Re: Loop While!

Post by jgu1 »

Hi again!

I've thought of it like this. Let's assume the gate is half open and there's a car is parked under the gate, then the gate must not be able to go down onto the roof of the car, but that doesn't matter, it can go up until it reaches the end stop upwards. Yes, I know I can stop the motor in SW by switch output off.

The timer turns on one output, but with this I activate the reset of the arduino with a transistor, then I'm 100% sure that all outputs will be turned off.
I have tryed to use the reset by software if I use in a C block void(* resetFunc) (void) = 0; But it doesn´t work.

Hope you see my idea and it work ;) ;)

Jorgen

Bijumon
Posts: 23
Joined: Fri Dec 30, 2022 11:44 am
Has thanked: 1 time
Been thanked: 6 times

Re: Loop While!

Post by Bijumon »

Hi Jorgen

I hope this will be ok for you.
Please note that the reset function doesn't work correctly in the Flowcode simulation; instead, it causes the operation in the loop to freeze after the reset timer overflows. Therefore, you'll need to test this on the actual hardware.
Attachments
DecisionTest.fcfx
(31.55 KiB) Downloaded 9 times

Post Reply