Test Rig
Our test rig is built on the principals of a pendulum. The independent variable is location at which the ball hits the bat. The variable is changed by moving the fixed point of the pendulum vertically. We change this rather than the length of the string because the force that the ball hits the bat with is directly proportional to the length of the pendulum string, and we need the force to be constant.
CREO Parametric Files
Pendulum
Arduino Uno Code
How to 3D Print Anything
Arduino Uno Code
// This code is in the public domain.
// these constants describe the pins. They won't change:
const int groundpin = 4; // analog input pin 4 -- ground
const int powerpin = 5; // analog input pin 5 -- voltage
const int xpin = A0; // x-axis of the accelerometer
const int ypin = A1; // y-axis
const int zpin = A2; // z-axis (only on 3-axis models)
int var = 0; // initialize the counter to zero
void setup()
{
Serial.begin(9600); // initialize the serial communications
// Provide ground and power by using the analog inputs as normal
// digital pins. This makes it possible to directly connect the
// breakout board to the Arduino. If you use the normal 5V and
// GND pins on the Arduino, you can remove these lines.
}
void loop()
{
while(var < 300)
{
Serial.print(analogRead(xpin)); // print the sensor values
Serial.print("\t"); // print a tab between values
Serial.print(analogRead(ypin));
Serial.print("\t");
Serial.print(analogRead(zpin));
Serial.println(); delay(1); // delay 1 millisecond (.001 seconds) before next reading
var++; //increase the counter by 1
}
}
{
Serial.print(analogRead(xpin)); // print the sensor values
Serial.print("\t"); // print a tab between values
Serial.print(analogRead(ypin));
Serial.print("\t");
Serial.print(analogRead(zpin));
Serial.println(); delay(1); // delay 1 millisecond (.001 seconds) before next reading
var++; //increase the counter by 1
}
}
How to 3D Print Anything