void CFoosballDlg::OnTimer(UINT_PTR nIDEvent)
{
	char Count[32];
	UpdateData(TRUE);				// get tthe latest m_PositionSelection value
	GetEncoderCount(m_PositionSelection, MOVE_MOTOR, Count);
	SetDlgItemText(IDC_STATIC_MOVE_COUNT, CA2W(Count));
	GetEncoderCount(m_PositionSelection, KICK_MOTOR, Count);
	SetDlgItemText(IDC_STATIC_KICK_COUNT, CA2W(Count));
	__super::OnTimer(nIDEvent);
}
void calculateCanon(void)
{				
	if(!canonLocked())
	{
		lockSensors();
		
		canon_left_position = GetEncoderCount(LEFT_ENCODER);//mean_function((signed long*) &left_encoder_data.buffer, left_encoder_data.num_values);
		canon_right_position = GetEncoderCount(RIGHT_ENCODER);//mean_function((signed long*) &right_encoder_data.buffer, right_encoder_data.num_values);
		canon_steering_position = mean_function((signed long*) &steering_pot_data.buffer, steering_pot_data.num_values);
		canon_hokuyo_position = mean_function((signed long*) &hokuyo_pot_data.buffer, hokuyo_pot_data.num_values);
		
		//TODO: Calculate velocities
		unlockSensors();
	}	
}
Exemple #3
0
void encoderDemo(void) {
	UARTprintf("Press:\nany key-read encoder values\n");
	UARTprintf("any key after read begins-quit\n");
	
	{
		signed long encoder0, encoder1, counter = 0;
		PresetEncoderCounts(0, 0);

		while(!keyWasPressed()) {	  
			encoder0 = GetEncoderCount(ENCODER_0);	 
			encoder1 = GetEncoderCount(ENCODER_1);
			GetEncoderCounts(&encoder0, &encoder1);
			UARTprintf("enc0:%d  enc1:%d      \r",encoder0,encoder1);
			counter++;
		}
	}

	UARTprintf("\n");
}