Пример #1
0
void BIAS_Init(void){
	TIM4_PWM_Init();
	BIAS_Config();
	BIAS_VAUX_SetValue(0);
	BIAS_SetValue(4095);
	BIAS_VBIAS_1_WriteValue(4095);
	BIAS_VBIAS_2_WriteValue(4095);
}
Пример #2
0
void Steering_Init(void) {
    STMFLASH_Read(STEERING_DATA_ADDR, (u16*)(&steering_data), sizeof(struct steering_type));
    TIM2_PWM_Init(20000,71);
    TIM3_PWM_Init(20000,71);
    TIM5_PWM_Init(20000,71);
    TIM1_PWM_Init(20000,71);
    TIM8_PWM_Init(20000,71);
    TIM4_PWM_Init(20000,71);
    if(STEERING_INIT_MARK==steering_data.mark)
        Steering_Move(steering_data.init);
    else
        Steering_Move(default_init);
}
Пример #3
0
int main(void) 
{
	int i;
	Systick_Configuration();
	LED_Configuration();
	button_Configuration();
	usart1_Configuration(9600);
	SPI_Configuration();
  TIM4_PWM_Init();
	Encoder_Configration();
	buzzer_Configuration();
	ADC_Config();
	
	//curSpeedX = 0;
	//curSpeedW = 0;
	//shortBeep(2000, 8000);
	
	while(1) {
		readSensor();
		readGyro();
		readVolMeter();
		printf("LF %d RF %d DL %d DR %d aSpeed %d angle %d voltage %d lenc %d renc %d\r\n", LFSensor, RFSensor, DLSensor, DRSensor, aSpeed, angle, voltage, getLeftEncCount(), getRightEncCount());
		displayMatrix("UCLA");
		
		setLeftPwm(100);
		setRightPwm(100);
		delay_ms(1000);
	}
	//forwardDistance(4000,0,0,true);
	//displayMatrix("Sped");
	//targetSpeedX = 100;
	//delay_ms(2000);
	
	//
	//targetSpeedX = 100;
	//delay_ms(2000);
	//printf("==============================================\n\r=======================================================\r\n");
	
	//delay_ms(1000); 
	//displayMatrix("Wat");
	//delay_ms(1000);
	//displayMatrix("STOP");
	//displayMatrix("GO");
	
	turnRightAngle(LEFT);
	
	targetSpeedW = 0;
	delay_ms(1000);
	turnRightAngle(RIGHT);
	targetSpeedW = 0;
	delay_ms(1000);
	
	displayMatrix("STOP");
	delay_ms(3000); 
	targetSpeedX = 0;
	//
	targetSpeedW = 10;
	delay_ms(1000);
	targetSpeedX = 0;
	targetSpeedW = 0;
	return 0;
}