Esempio n. 1
0
void CombinedMotorWidget::velChanged(double vel)
{
	ui->velocityStop->setEnabled(qAbs(vel) > 0.5);
	move_at_velocity(ui->motors->currentIndex(), vel);
#ifdef A_KOVAN
	publish();
#endif
}
/*
 * Class:     Motor
 * Method:    move_at_velocity
 * Signature: (II)I
 */
JNIEXPORT jint JNICALL Java_cbccore_low_Motor_move_1at_1velocity(JNIEnv* env, jobject obj, jint port, jint speed)
{
#ifdef CBC
    return move_at_velocity(port, speed);
#else
    printf("Java_cbccore_low_Motor_move_1at_1velocity stub\n");
    return -1;
#endif
}
Esempio n. 3
0
void moveTowardsLight() {
	int lightValueRight = analog10(6);
	int lightValueLeft = analog10(7);

	int rightVelocity = scale * (0 - lightValueLeft + 1000);
	int leftVelocity = scale * (0 - lightValueRight + 1000);

	rightVelocity = (rightVelocity < 0) ? 0 : rightVelocity; //Min of 0 velocity
	leftVelocity = (leftVelocity < 0) ? 0 : leftVelocity; //Min of 0 velocity

	rightVelocity = (rightVelocity > 1000) ? 1000 : rightVelocity; //max of 1000 velocity
	leftVelocity = (leftVelocity > 1000) ? 1000 : leftVelocity; //max of 1000 velocity

	move_at_velocity(0, rightVelocity); // Right wheel
	move_at_velocity(3, leftVelocity); // Left wheel

	printf("Right vel: %d Left vel: %d\n",rightVelocity,leftVelocity);
}
Esempio n. 4
0
int main() 
{	
	while(1)
	{
		int isPressed = digital(15);
		
		if(isPressed == 1)
		{
			move_at_velocity(0,-600);
			move_at_velocity(3,0);
			msleep(3000);
			move_at_velocity(0,-400);
			move_at_velocity(3,-400);
			msleep(3000);
			move_at_velocity(0,0);
			move_at_velocity(3,-500);
			msleep(3000);

			
		} else {
			moveTowardsLight();
		}	

	}
	return;
	
}
Esempio n. 5
0
int mav(int motor, int velocity)
{
	return move_at_velocity(motor, velocity);
}