Debugin
cpetro
Posts: 3
Hello everyone.· I was wondering if I could get some help on a project I am working on.· I am into home automation and I wanted a way to tell the system who was home or not.· I decided to do this by using RFID.· The project is completed and works very well.· It works as follows:
The BS2 holds the variables for each user's home or away status.· Swipe RFID card and the Basic Stamp toggles between home and away for each user.· Sends user's name and home or away to an lcd, and also sends the appropriate command out the serial port to the automation compouter.· The automation computer also holds these variables and the software's rules use these variables to turn off the house on last one out, and turn it on when someone comes home and sets user preferences when only 1 of us is home.· I also have touchscreens around the house for control.· Since I only have 1 RFID device at 1 door if you enter through another door you have to log in through the touchscreen.
·
So I wanted the computer to update the· variables in the Basic Stamp if someone used a touchscreen instead of the RFID, so everything stays in sync.· Here is where I am stuck.· I· have used the DEBUGIN command and this works in testing, but it seems the BS waits for the DEBUGIN input until it continues on with the code which means if no one uses the touchscreen it is still waiting for input and the RFID code never gets executed.
Is there a way to have my RFID code loop and wait for a tag but simultaneously be listening for commands from the computer's serial port?· Either the BS2 can't do this or it is due to my lack of programming skills.· If I had to bet I'd pick the latter.
Thanks,
Chris
The BS2 holds the variables for each user's home or away status.· Swipe RFID card and the Basic Stamp toggles between home and away for each user.· Sends user's name and home or away to an lcd, and also sends the appropriate command out the serial port to the automation compouter.· The automation computer also holds these variables and the software's rules use these variables to turn off the house on last one out, and turn it on when someone comes home and sets user preferences when only 1 of us is home.· I also have touchscreens around the house for control.· Since I only have 1 RFID device at 1 door if you enter through another door you have to log in through the touchscreen.
·
So I wanted the computer to update the· variables in the Basic Stamp if someone used a touchscreen instead of the RFID, so everything stays in sync.· Here is where I am stuck.· I· have used the DEBUGIN command and this works in testing, but it seems the BS waits for the DEBUGIN input until it continues on with the code which means if no one uses the touchscreen it is still waiting for input and the RFID code never gets executed.
Is there a way to have my RFID code loop and wait for a tag but simultaneously be listening for commands from the computer's serial port?· Either the BS2 can't do this or it is due to my lack of programming skills.· If I had to bet I'd pick the latter.
Thanks,
Chris
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
' This is only pseudocode
Main:
DO
GOSUB check_touchscreen
GOSUB check_rfid
LOOP
END
check_rfid:
' Your RFID code goes here
RETURN ' make sure the return statemernt is here
check_touchscreen:
' Your TOUCHSCREEN code goes here
RETURN ' make sure the return statemernt is here
Use SERIN instead of DEBUGIN, and set a timeout duration for the SERIN cmd.
You can test your code using the debug terminal on PIN16, then just change your pin definition for your touchscreen.
Kevin Wood, are you K-WOOD from the Cinemar forums?· If so then, I am using this to display everything in MainLobby, through the GenericSerial plugin.· This is pretty cool.
Thanks for the help,
Chris
No, I'm not that K-WOOD. I Googled my name once and found out that it's more common than I expected.
Out of curiosity, I took a look at the Cinemar website, and it looks like some neat stuff.
Ok, I thought that you might be the sane person since you answered the automation related question.· I know a few guys over there have made automation related basic stamp projects.
Anyway, thanks for the help, much appreciated.
Take Care,
Chris