BS2P40 - Single button code entry, MP3 Module Control and X10 Module control
LuXo12
Posts: 31
in BASIC Stamp
Need help consolidating my BS2P40 code
Let me start with a brief explanation of what the attached code does, and I will follow up with what I would like to add to it.
The code I wrote allows the user to enter a sequance of numbers, using a single push buttton. The numbers that the user enters are then compared to the "security code" stored in the EEPROM, if they match and momentary and constant out put is triggered. Besides the single button that is used to enter the security code, there are 15 other buttons that are assigned dedicated tasks. Buttons connected to IN0 to IN7 control MP3 module and send on/off commands to preprogrammed devices (IN0=X10 Unit1, IN1=X10 Unit2....,etc). While buttons connected to IN8 to IN14 control MP3 Module (a high signal on IN8, will play track 9 on the MP3, IN9 will play track 10,.... etc.).
Currently the code takes up almost all of the EEPROM, which is a bit problematic as I still need to add 1 function to the code. What I would like the stamp to do is to send a command to the MP3 module and X10 unit just once even if the button remain pressed. The only time the command would get resend is if the button is pressed again.
Let me start with a brief explanation of what the attached code does, and I will follow up with what I would like to add to it.
The code I wrote allows the user to enter a sequance of numbers, using a single push buttton. The numbers that the user enters are then compared to the "security code" stored in the EEPROM, if they match and momentary and constant out put is triggered. Besides the single button that is used to enter the security code, there are 15 other buttons that are assigned dedicated tasks. Buttons connected to IN0 to IN7 control MP3 module and send on/off commands to preprogrammed devices (IN0=X10 Unit1, IN1=X10 Unit2....,etc). While buttons connected to IN8 to IN14 control MP3 Module (a high signal on IN8, will play track 9 on the MP3, IN9 will play track 10,.... etc.).
Currently the code takes up almost all of the EEPROM, which is a bit problematic as I still need to add 1 function to the code. What I would like the stamp to do is to send a command to the MP3 module and X10 unit just once even if the button remain pressed. The only time the command would get resend is if the button is pressed again.
Comments
Lastly I also noticed a flaw in my code. In my code I use the INS variable with case select statement. The INS variable is a problem because if two of my push buttons are pressed at once case values will no longer apply. I will work out this bug, and post new code later today.
Thanks Sapphire for your suggestions.