Example #1
0
void set_A(float speed)
{
    if (speed > 0 && speed <= 1.0f) {
		mraa_pwm_write(pwm2, speed);
		forward_A();
    }
	else if (speed < 0 && speed >= -1.0f) {
		mraa_pwm_write(pwm2, -speed);
		reverse_A();
    }
    else
    {
		mraa_pwm_write(pwm2, 0.);
        brake_A();
    }
}
Example #2
0
void straight (float speed)
{	
	if (speed >= 0 && speed <= 1.0f) {
		mraa_pwm_write(pwm1, speed);
		mraa_pwm_write(pwm2, speed);

		forward_A();
		forward_B();
	}
	
	else if (speed < 0 && speed >= -1.0f) {
		mraa_pwm_write(pwm1, -speed);
		mraa_pwm_write(pwm2, -speed);

		reverse_A();
		reverse_B();
	}

	else
		printf("Wrong speed value. Choose between -1.0 and 1.0\n");
}
void rotate_CW()
{
	printf("here");
	forward_B();
	reverse_A();
}
void rotate_CW()
{
	forward_B();
	reverse_A();
}