Esempio n. 1
0
// Looks for any of the red buoy, green buoy, or force field emitted by the home base
// If the Create is in explore mode, remember and display the zone of the victim
// If the Create is in return mode, play a song and display victim found ('V'), and clear victim zone
void lookForVictim()
{
	ser_putch(142);
	ser_putch(17);
	char victim = ser_getch();
		
	if(victim > 241 && victim != 255)
	{
		if(goingHome)
		{
			__delay_ms(1000);
			play_iCreate_song(3);
			__delay_ms(500);
			victimZone = 0;
			lcd_set_cursor(0x09);
			lcd_write_data('V');
			xVictim = xCoord;
			yVictim = yCoord;
		}
		else
		{
			xVictim = xCoord;
			yVictim = yCoord;
			victimZone = getVictimZone(xCoord, yCoord);
			lcd_set_cursor(0x08);
			lcd_write_1_digit_bcd(victimZone);
		}
	}
}
Esempio n. 2
0
void ser_puthex(unsigned char v)
{
	unsigned char c;

	c = v >> 4;
	if (c>9) {
		ser_putch('A'-10+c);
	} else {
		ser_putch('0'+c);
	}

	c = v & 0x0F;
	if (c>9) {
		ser_putch('A'-10+c);
	} else {
		ser_putch('0'+c);
	}
}
Esempio n. 3
0
void ser_puts2(unsigned char * s)
{
	while(*s)
		ser_putch(*s++);
}
Esempio n. 4
0
void ser_puts(const unsigned char * s)
{
	while(*s)
		ser_putch(*s++);
}
Esempio n. 5
0
void initIRobot()
{
	__delay_ms(100);
	ser_putch(128);
	ser_putch(132);
}
Esempio n. 6
0
void play_iCreate_song(unsigned char song)
{
	ser_putch(141);
	ser_putch(song);
}