Support

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

3-Color Dynamic LED Switch

Post any examples or modules that you want to share here

3-Color Dynamic LED Switch

Postby pwesynthmaker » Sat Mar 26, 2022 2:46 pm

My 'almost-all-my-very-own ruby code' .fsm schematic.
A LED switch with 3-colored 'dynamic' text and 'float' value input/output.
.
Download Link:
https://invntefx.com/ssl/_invntefxfston ... rubysw.zip

Here is the Ruby Code:

==========

# ledsw32pxmultilbl ruby code

def draw v

# Calculate the rect to draw the text inside
# Rectangle width & height = relative to font size w/word wrap
# + led diam
rect1 = [0,-3.5,v.width,v.height]
rect2 = [0,0.75,v.width,v.height]
rect3 = [0,4,v.width,v.height]

# Setup font1 and alignment
font1 = Font.new "Arial",1.75,"bold"
sf1 = StringFormat.new
sf1.setAlignment "center"
sf1.setLineAlignment "center"

# Draw the label
v.drawString @label1,font1,sf1,rect1,(Brush.new @color1)


# Setup font2 and alignment
font2 = Font.new "Arial",1.75,"bold"
sf2 = StringFormat.new
sf2.setAlignment "center"
sf2.setLineAlignment "center"

# Draw the label
v.drawString @label2,font2,sf2,rect2,(Brush.new @color2)


# Setup font3 and alignment
font3 = Font.new "Arial",1.75,"bold"
sf3 = StringFormat.new
sf3.setAlignment "center"
sf3.setLineAlignment "center"

# Draw the label
v.drawString @label3,font3,sf3,rect3,(Brush.new @color3)

end

def event i,v
redraw 0
end

==========
Attachments
3colorubysw.jpg
3colorubysw.jpg (35.47 KiB) Viewed 5466 times
https://www.invntefx.com/ssl/_invntefxf ... fstone.htm
Inventor eFX Technology FlowStone WebPage

https://www.invntefx.com/
Inventor eFX Technology
LOGIN
Username: viewer
Password: A#1viewer
User avatar
pwesynthmaker
 
Posts: 71
Joined: Fri Feb 12, 2016 7:18 pm

Return to User Examples

Who is online

Users browsing this forum: Google [Bot] and 12 guests