If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Last Switch(Ruby)
19 posts
• Page 1 of 2 • 1, 2
Last Switch(Ruby)
Had lots of silly attempts at this over last few weeks...
have stripped it down to this....
I want it to behave just like the standard "green" Last Switch.
Seems to work right...but it's a real important part...and I've stuffed it up a few times now...
so I want to make sure...before i stick a few hundred in my schematic..
Can anyone see a problem with this code....??
Is there a better way...?
have stripped it down to this....
- Code: Select all
def event i,v
if i==0 then
output 0,@firstsignal
end
if i==1 then
output 0,@secondsignal
end
end
I want it to behave just like the standard "green" Last Switch.
Seems to work right...but it's a real important part...and I've stuffed it up a few times now...
so I want to make sure...before i stick a few hundred in my schematic..
Can anyone see a problem with this code....??
Is there a better way...?
BV MUSIC SYDNEY AUSTRALIA..Songwriting and Software development
Headquartershttps://www.bvmusicsydneyaustralia.com/
Spotifyhttps://open.spotify.com/artist/7JO8QM40mVmHb7pAwKPJi0
Donatationhttps://www.paypal.com/donate/?hosted_button_id=HEUR8R7K8GZ4L
Headquartershttps://www.bvmusicsydneyaustralia.com/
Spotifyhttps://open.spotify.com/artist/7JO8QM40mVmHb7pAwKPJi0
Donatationhttps://www.paypal.com/donate/?hosted_button_id=HEUR8R7K8GZ4L
- billv
- Posts: 1157
- Joined: Tue Aug 31, 2010 3:34 pm
- Location: Australia
Re: Last Switch(Ruby)
I think the inputs will sum MyCo?
Bill, I have done exactly the same thing,
I think it works fine.
Cheers
Bill, I have done exactly the same thing,
I think it works fine.
Cheers
-
nix - Posts: 817
- Joined: Tue Jul 13, 2010 10:51 am
Re: Last Switch(Ruby)
Great.....thanks guys.
BV MUSIC SYDNEY AUSTRALIA..Songwriting and Software development
Headquartershttps://www.bvmusicsydneyaustralia.com/
Spotifyhttps://open.spotify.com/artist/7JO8QM40mVmHb7pAwKPJi0
Donatationhttps://www.paypal.com/donate/?hosted_button_id=HEUR8R7K8GZ4L
Headquartershttps://www.bvmusicsydneyaustralia.com/
Spotifyhttps://open.spotify.com/artist/7JO8QM40mVmHb7pAwKPJi0
Donatationhttps://www.paypal.com/donate/?hosted_button_id=HEUR8R7K8GZ4L
- billv
- Posts: 1157
- Joined: Tue Aug 31, 2010 3:34 pm
- Location: Australia
Re: Last Switch(Ruby)
Works great Myco....
I thought the inputs would needed to be declared individually....
I had no idea i could get away with that..
Cheers
I thought the inputs would needed to be declared individually....
I had no idea i could get away with that..
Cheers
BV MUSIC SYDNEY AUSTRALIA..Songwriting and Software development
Headquartershttps://www.bvmusicsydneyaustralia.com/
Spotifyhttps://open.spotify.com/artist/7JO8QM40mVmHb7pAwKPJi0
Donatationhttps://www.paypal.com/donate/?hosted_button_id=HEUR8R7K8GZ4L
Headquartershttps://www.bvmusicsydneyaustralia.com/
Spotifyhttps://open.spotify.com/artist/7JO8QM40mVmHb7pAwKPJi0
Donatationhttps://www.paypal.com/donate/?hosted_button_id=HEUR8R7K8GZ4L
- billv
- Posts: 1157
- Joined: Tue Aug 31, 2010 3:34 pm
- Location: Australia
Re: Last Switch(Ruby)
oh ok sorry-
I don't know what i was thinking there
That's neat as MyCO, will use it too
I don't know what i was thinking there
That's neat as MyCO, will use it too
-
nix - Posts: 817
- Joined: Tue Jul 13, 2010 10:51 am
Re: Last Switch(Ruby)
Ahhh ... for the 'slow' learner crowd ... apparently me
I tried a very simple input [ 0 or 1], along with inputs for the the 2 variables ... I could not get this to work consistently
This seems that this should be a simple choice and path through the code ... If 'this' ... this, if 'that' .... that.
How I'm screwing this up is ridiculous .... I'm embarrassed, but can someone shed light on this please
Thanks.
I tried a very simple input [ 0 or 1], along with inputs for the the 2 variables ... I could not get this to work consistently
This seems that this should be a simple choice and path through the code ... If 'this' ... this, if 'that' .... that.
How I'm screwing this up is ridiculous .... I'm embarrassed, but can someone shed light on this please
Thanks.
- RJHollins
- Posts: 1571
- Joined: Thu Mar 08, 2012 7:58 pm
Re: Last Switch(Ruby)
Here are 3 variations, 2 of Bill's and the MyCo one.
I think the problem u had was not naming the inputs.
np with asking- it's how I finally cottoned onto this program a little
-
nix - Posts: 817
- Joined: Tue Jul 13, 2010 10:51 am
Re: Last Switch(Ruby)
Thanks Nix !!
It was the 'Trigger'
I had mine similar to your 2nd example ... BUT ... I also had a 3rd INPUT variable (i).
Obviously, still struggling to get a handle on the basics of RUBY. I'm hitting those posted RUBY sites to get familiar. My only programming 'experience' was using GFABasic on the ATARI ST back in the 80's.
When I looked at this "Last Switch', I saw an input [i], and 2 result variables. So on the left side of the RUBY box, I had 3 string inputs [labeled] ... i, firstsignal, secondsignal. I thought changing i from 0 to 1 would toggle the output through the IFTHENELSE routine.
Still don;t understand why this didn't work ... also [now] not sure what the 'DEF event i,v' is really doing. I thought this was telling RUBY to watch for 'i' and output to 'v'.
ahhh ... soooo much more to learn.
It was the 'Trigger'
I had mine similar to your 2nd example ... BUT ... I also had a 3rd INPUT variable (i).
Obviously, still struggling to get a handle on the basics of RUBY. I'm hitting those posted RUBY sites to get familiar. My only programming 'experience' was using GFABasic on the ATARI ST back in the 80's.
When I looked at this "Last Switch', I saw an input [i], and 2 result variables. So on the left side of the RUBY box, I had 3 string inputs [labeled] ... i, firstsignal, secondsignal. I thought changing i from 0 to 1 would toggle the output through the IFTHENELSE routine.
Still don;t understand why this didn't work ... also [now] not sure what the 'DEF event i,v' is really doing. I thought this was telling RUBY to watch for 'i' and output to 'v'.
ahhh ... soooo much more to learn.
- RJHollins
- Posts: 1571
- Joined: Thu Mar 08, 2012 7:58 pm
19 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: Google [Bot] and 74 guests