All pastes #100377 Raw Edit

Something

public text v1 · immutable
#100377 ·published 2006-07-26 02:37 UTC
rendered paste body
void Send_RC_Packet(void)

{
	
	// Initialize packet
	packet[0]	=	"\0";
	

	// Get the current number of left encoder

	// clicks

	left_encoder_clicks	=	Left_Encoder_Count();

	

	// Get the current number of right encoder

	// clicks

	right_encoder_clicks =	Right_Encoder_Count();

	

	// Send two starting bits, to tell the receiving uC

	// that a data packet is coming.

	strcat(packet, 0x00);
	strcat(packet, 0x00);

	

	// Left encoder value

	strcat(packet, left_encoder_clicks);

	

	// Right encoder value

	strcat(packet, right_encoder_clicks);
	
	// Heading
	strcat(packet, current_heading);
	

	// Ending bit, to tell the receiving uC that data

	// transmission is over.

	strcat(packet, 0xFF);
	
	// Send packet
	print(packet);

}