Shop OBEX P1 Docs P2 Docs Learn Events
IR Remote Data Entry - Complexities with Hex, PocketWatch — Parallax Forums

IR Remote Data Entry - Complexities with Hex, PocketWatch

John KauffmanJohn Kauffman Posts: 653
edited 2004-11-23 18:30 in BASIC Stamp
The IR remote (from TV/VCR) is a cheap way to enter data into the code of a running STAMP as covered in the new Boe-Bot IR Control book. But there are a couple of problems that came up when I tried to use the IR control to set the time of a Pocket Watch B (PW) module used to time stamp events in a project. The pocket watch is only powered by the STAMP, so loses its time setting when STAMP is turned off between uses. The current time can be set by modifying variables in the code, but I wanted to use the IR remote to enter the data at run time.

I have no problem with hardware and software to receive and send to DEBUG the decimal value of the button pressed on the remote.
·
The PW uses a hex value for time data ( 17:30 is entered as $11,$1E). So it is frequently necessary to push two remote controller buttons (like 1,7) to enter the desired value such as for the hour of the example above. The IR remote transmits one dec number and I did not see code in the book to handle more then one keypunch from·the remote.
·
The overall objective is to use the IR remote to get the time values into the PW. My approach is to:
1- Receive the first number and store it in a variable Digit1.
2 - Receive the second number into a second variable Digit2.
3 - Concatenate Digit2 onto the end of Digit1
4 – Convert Digit1 to hex.
Of course, I am open to any other approaches to the task.
·
Here are the problems I have encountered:
·
For step three I have not found a way to concatenate (append) a values onto another variable.
·
For step 4 I have not been able to convert a decimal value to HEX. The frustration is that DEBUG ·HEX· MYVAR does a brilliant job, but I can’t figure out a way to do that conversion with output to a variable instead of the DEBUG screen. I have researched the conversion problem and have found samples to do conversion by brute force in code, but I’m hoping there is a BasicSTAMP function or work-around.
··
·
Much Thanks.
·
·
Sign In or Register to comment.