Clemson ECE 453
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Sensor Group's Function

Go down

Sensor Group's Function Empty Sensor Group's Function

Post  kschuck Tue Mar 03, 2009 7:37 pm

Code:
//checks if a keystroke has occured(keystroke from rfid reader)
//if the keystroke indicates a hit from the rfid reader,
//call COMM group's function RoverDead()
void check_hit()
{
    char c;
   
    if( kbhit() ) //if keyboard input
    {
        c = getch();
       
        switch(c)
        {
            case '{':
                //first rover hit
                RoverDead(TRUE);
                break;
               
            case '}':
                //second rover hit
                RoverDead(TRUE);
                break;
               
            default:
                break;
        }
       
    }
}
--------------------

There may need to be some new functionality for the RoverDead() function. As you can see we will be using separate keystrokes for each rover (to keep a rover from sensing its own darts) so there may need to be a way to report which rover was hit to RoverDead.

This function requires that the header files stdio.h and conio.h, which is included to run kbhit(), are included.

EDIT: Just to be clear, this is not an interrupt function, but rather a polling function. IT should be called once each time through the main loop.

kschuck

Posts : 2
Join date : 2009-01-11

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum