Good Afternoon Monks,
I have a program that uses Win32-Serial and I am sending commands to a receiving decoder which is installed into a model railroad locomotive. Individually the commands work: Ring the bell, blow the horn etc. However, when each command is sent it shuts off the previous command. Below is my code and what I need to be able to do is for example: Lights On stays on even if Bell On is selected. The receiver/decoder does not store commands...it just executes what is sent.
### LIGHTS ON/OFF CODE### sub leftefzeroone { $button53->configure(-text => 'F0 - Left Lights On'); $button53->bind('<ButtonPress>', \&leftefzerotwo); my $tlightson = "<f 1108 144>"; $port->write($tlightson); $port->lookclear(); } sub leftefzerotwo { $button53->configure(-text => 'F0 - Left Lights Off'); $button53->bind('<ButtonPress>', \&leftefzeroone); my $tlightsoff = "<f 1108 128>"; $port->write($tlightsoff); $port->lookclear(); } ### BELL ON/OFF CODE### sub leftefoneone { $button54->configure(-text => 'F1 - Left Bell On'); $button54->bind('<ButtonPress>', \&leftefonetwo); my $tbellon = "<f 1108 136>"; $port->write($tbellon); $port->lookclear(); } sub leftefonetwo { $button54->configure(-text => 'F0 - Left Bell Off'); $button54->bind('<ButtonPress>', \&leftefoneone); my $tbelloff = "<f 1108 128>"; $port->write($tbelloff); $port->lookclear(); }
As you can see from the code the number 128 is the byte number in the receiver/decoder that shuts any function ON to OFF. What I need to implement is a type of IF EXISTS statement. I'm lost as to where to begin on that. I can do simple IF FILE EXISTS type of routines. Thanks in advance!
In reply to Saving Options by PilotinControl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |