Auto Com ?

Discuss Control Systems here
User avatar
JB_AU
Posts: 171
Joined: Tue May 21, 2013 11:01 pm

Auto Com ?

Post by JB_AU »

I am overly unkeen to learn ruby, i have good reason not to. Is there a way to make an index or an array cycle through based on a triggered event?
In my picture i have pulled a dynamic array of past & present com ports from registry for a particuar piece of hardware, i need to cycle through the array & test against the static array of available com ports, if there is a match , another module will use this value to test the hardware for acknowledgement or its presence. If the hardware exists stop cycling, if it does not keep cycling, timeout send msg "Check Hardware".
cyclic_array.png
cyclic_array.png (19.84 KiB) Viewed 179199 times
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

Albert Einstein
User avatar
MyCo
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany
Contact:

Re: Auto Com ?

Post by MyCo »

This could be done in Ruby way easier...
Attachments
port_validation.fsm
(1.83 KiB) Downloaded 4107 times
User avatar
JB_AU
Posts: 171
Joined: Tue May 21, 2013 11:01 pm

Re: Auto Com ?

Post by JB_AU »

Can't open it "Made with newer version" so what's newer than 3.0.4?
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

Albert Einstein
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: Auto Com ?

Post by tester »

Beta 3.0.5
Crashes here too.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
RZK
Posts: 23
Joined: Mon Dec 23, 2013 9:50 am

Re: Auto Com ?

Post by RZK »

same to me
User avatar
JB_AU
Posts: 171
Joined: Tue May 21, 2013 11:01 pm

Re: Auto Com ?

Post by JB_AU »

This is as far as i got ;
regq_autocom.fsm
(30.4 KiB) Downloaded 4204 times


I either need to compare arrays & find the integer that exists in both or cycle through the array when more than 1 com exists per device. Then add some indicators, simplify the resulting module.
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

Albert Einstein
User avatar
JB_AU
Posts: 171
Joined: Tue May 21, 2013 11:01 pm

Re: Auto Com ?

Post by JB_AU »

I got a little farther thanks to Trog clarifying a few things & now i have a migraine.

Please spot what is wrong?

regq_autocom.fsm
(30.52 KiB) Downloaded 4277 times
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

Albert Einstein
User avatar
MyCo
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany
Contact:

Re: Auto Com ?

Post by MyCo »

Have you tried my schematic with the new Amber release? Sorry, no time for testing at the moment, will have a look on the weekend.
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Auto Com ?

Post by trogluddite »

JB_AU wrote:Please spot what is wrong?

Hi there. the problem is with the way that the Ruby inputs are read. The error is because variables '@in1' and '@in2' are not defined.

When you read inputs, the default way is...
- The top input is always just "@in".
- To read more, you get all of the inputs as an array called "@ins" - and then read the array. e.g. @ins[0] & @ins[1]

However, a much nicer way to do it, is to use named inputs. It makes the code easier to read, and you can change the order of the inputs without having to edit the code.
If you highlight the RubyEdit primitive, then CTRL click a connector, you can type a label for the connector. (hint - use TAB to move to the next one).
A variable gets made automatically to match the label. So input "in1" becomes variable "@in1", label "comms_list" becomes variable "@comms_list" etc.
You can then read the inputs by using the new variables.

Take care with the input labels
- don't include the '@' in the connector label, Ruby adds that automatically.
- name must start with a letter.
- no spaces in the name
- only letters, numbers and '_' may be used.
- make sure the input name doesn't clash with any of the other variables in your code.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
JB_AU
Posts: 171
Joined: Tue May 21, 2013 11:01 pm

Re: Auto Com ?

Post by JB_AU »

Closer to the end now! It should work, it should???

It sometimes works , i saw it work, then it did not , then it worked & now it does not.... ever....

I am at a loss ?

My apologies for the all over the place web of links.

regq_autocom.fsm
(29.84 KiB) Downloaded 4226 times
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

Albert Einstein
Post Reply