MATLAB CODE:
...
figure; hold on; grid on
plot(theta2, DCdotdot);
title ('Linear Acceleration of DC')
xlabel('Theta 2 (deg)');
ylabel('A_D_C (mm/s^2)');
ARDUINO CODE
void setup() {
//Setup Channel A
pinMode(8, OUTPUT); //Initiates Motor Channel A pin
pinMode(7, OUTPUT); //Initiates Brake Channel A pin
}
void loop(){
//forward @ full speed
digitalWrite(8, HIGH); //Establishes forward direction of Channel A
digitalWrite(7, LOW); //Disengage the Brake for Channel A
analogWrite(9, 100); //Spins the motor on Channel A at full speed
delay(5000);
digitalWrite(7, HIGH); //Eengage the Brake for Channel A
delay(1000);
digitalWrite(7, HIGH); //Eengage the Brake for Channel A
delay(1000);
}