Welcome! this page is under construction! Implement a position controller to close the loop using PID. Block Diagram: Exercise 1: Print out turntable position in degrees. Read the potentiometer values and convert them to degrees using the map function. Drive Motor: #define M1_PWM 3 // this pin controls the motor speed #define M1_DIR 12 //this pin controls the motor direction void setMtr(int mtr) // mtr is -100% to 100% { if (mtr > 0) { digitalWrite(M1_DIR,HIGH); //turn forwards } else { digitalWrite(M1_DIR,LOW); //turn backwards } analogWrite(M1_PWM,map(abs(mtr),0,100,0,255)); //set motor speed } |
Turn Table >