To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.handyboardOpen lugnet.robotics.handyboard in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / Handy Board / 1915
1914  |  1916
Subject: 
Re: IR in programs
Newsgroups: 
lugnet.robotics.handyboard
Date: 
Thu, 10 Apr 1997 17:31:41 GMT
Original-From: 
Max Davies <mdavies@+nospam+cam.org>
Viewed: 
1361 times
  
Katt97@aol.com wrote:

How would I use an if/then statement if I used the onboard IR reciever?
Earlier, I downloaded a program that Max Davies wrote to determine the
different variables for my remote. In the readme file, it says that the rules
are set by a command like "IR_set_rule( (int) "LADOZdat");" where LADOZdat
stood for the Leader, Address, Data, 1, 0, !Data, !Address, and Trailer of
the IR information sent by the remote. I'm totally confused on how to program
with IR, and I would like to have three to nine different commands sent by
the remote to the Handy Board, one of which would be to start a secondary
program within that program. I'm on a rather limited time schedule (my
program must be complete by the 25th) and I'm stuck! I'd really appreciate
any help with my program. Thanks!
-Kat-
~Class of '97~

Here is a simple example of how to do 'different things' when you press
various
buttons on your remote.  If you press digits, they are displayed on the
LCD.
If you press rewind, the LCD is cleared.  When you press stop, the
program
ends.  If you press anything else, Huh? is displayed on the LCD.

Remember that all of the button and setup values used are for my RCA
remote.
First use the test.c program to determine all of the correct values for
whatever remote you have and insert them where indicated.

Regards,
/Max


void main ()
{
        /* Setup to recognize RCA remotes */

        int             zero = 0x3830;   /* Replace 0x3830 by what
TEST.C reports */
        int             nine = 0x3839;   /* Replace 0x3839 by what
TEST.C reports */
        int             rewind = 0x381d; /* Replace 0x381d by what
TEST.C reports */
        int             stop = 0x381f;   /* Replace 0x381f by what
TEST.C reports */

        int             i;
        int             button;
        char            display[50];

        IR_cfg_Lpulse = 4059 << 1;      /* Replace 4059   by what TEST.C
reports */
        IR_cfg_Lspace = 4059 << 1;      /* Replace 4059   by what TEST.C
reports */
        IR_cfg_1pulse = 615  << 1;      /* Replace 615    by what TEST.C
reports */
        IR_cfg_1space = 1845 << 1;      /* Replace 1845   by what TEST.C
reports */
        IR_cfg_0pulse = 615  << 1;      /* Replace 615    by what TEST.C
reports */
        IR_cfg_0space = 922  << 1;      /* Replace 922    by what TEST.C
reports */
        IR_cfg_Tpulse = 615  << 1;      /* Replace 615    by what TEST.C
reports */
        IR_cfg_Tspace = 615  << 1;      /* Replace 615    by what TEST.C
reports */

        IR_cfg_Asize  = 6;              /* Replace 6      by what TEST.C
reports */
        IR_cfg_Dsize  = 6;              /* Replace 6      by what TEST.C
reports */

        IR_set_rule((int) "LADadT");    /* Replace LADadT by what TEST.C
reports */

        /* Always include this line just as-is */

        IR_input_threshold = (IR_cfg_1space + IR_cfg_0space) >> 1;

display[0] = 0;

        /* Repeat until STOP is pressed on the remote */

        for (;;) {

                /* Wait for a button to be pressed on the remote */

                for (;;) {
                        button = IR_in(0);
                        if (button != 0) {
                                break;
                        }
                }
                beep();

                /* Quit if STOP was pressed */

                if (button == stop) {
                        printf("Bye!\n");

                        /* Disable IR receive interrupt routine */

                        IR_in(-1);

                        /* Quit */

                        return;
                }

                /* Display any digits that are pressed */

                if (button >= zero && button <= nine) {
                        for (i=0;; i++) {
                                if (display[i] == 0) {
                                        break;
                                }
                        }
                        display[i] = button & 0x0f | 0x30;
                        display[i+1] = 0;
                        printf("%s\n", display);
                }
                else {

                        /* Clear the display if REWIND was pressed */

                        if (button == rewind) {
                                display[0] = 0;
                                printf(" \n");
                        }
                        else {

                                /* Unknown button was pressed */

                                printf("Huh?\n");
                        }
                }
        }
}



Message is in Reply To:
  IR in programs
 
How would I use an if/then statement if I used the onboard IR reciever? Earlier, I downloaded a program that Max Davies wrote to determine the different variables for my remote. In the readme file, it says that the rules are set by a command like (...) (27 years ago, 10-Apr-97, to lugnet.robotics.handyboard)

2 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR