예제 #1
0
파일: test.c 프로젝트: sriharshaq/DTMF-Bot
void testMotor(void)
{
char c;
Serialflush();
Serialprint("Motor Test\n");
while(1)
{
if(uartNewLineFlag == 1)
{
	Serialprint("LF received\n");
c = uartReadBuffer[0];
Serialflush();
switch(c)
{
case 'a': motorForward();
Serialprint("Motor FW\n");
          break;
case 'b': motorBackward();
Serialprint("Motor BW\n");
          break;
case 'c': motorLeft();
Serialprint("Motor Left\n");
          break;
case 'd': motorRight();
Serialprint("Motor Right\n");
          break;
case 'e': motorStop();
Serialprint("Motor Stop\n");
          break;		  
}
}
}
}
예제 #2
0
파일: testuart.c 프로젝트: zunaadmin/PIC
/*** Function    : main
**   Parameters  : None
**   Return      : int
**   Description : It is the entry point of program
**/
int main(void)
{
SetOsc(OSC_FREQ);             // Set Oscillator Freq
Serialbegin(BAUD_RATE);       // Set Baud Rate
Serialflush();                // Clear the buffers
Serialprint("uart test\n\r"); // Print a string
setSerialinterrupt();         // Enable Serial Interrupt
while(1)
{
 while(uartNewLineCount<NEW_LINE_THRESHOLD); // Wait until new line count reaches threshold
 Serialprint(uartReadBuffer);                // Print the uart read buffer
 Serialflush();                              // Flush the buffer
}
}
예제 #3
0
파일: test.c 프로젝트: sriharshaq/DTMF-Bot
void uartISRTest(void)
{
	while(1)
	{
		if(uartNewLineFlag == 1)
		{
			Serialprint((char*)uartReadBuffer);
			Serialflush();
		}
	}
}
예제 #4
0
/**
 * Empty the buffer of tx and rx instead waiting for outgoing completed.
 */
void Serial_::flush(void)
{
	Serialflush(dev);
}