just need gear to motor to move fwd and rev to specified positions... nothing super percise.. i can individually move each but when run all together is runs the last statment and stops...
int in_1=2; // defines in_1
int in_2=3; // defines in_2
int FBVAL; // FBVAL IS ACTUAL INT
int FBPIN; // defines loaction of feed back
void setup()
{
pinMode(9,OUTPUT) ; //we have to set PWM pin as output
pinMode(in_1,OUTPUT) ; //Logic pins are also set as output
pinMode(in_2,OUTPUT) ;
int FBPIN = A0; // select the input pin for the potentiometer
int FBVAL = 0;
Serial.begin(9600);
void loop(){
//CW in_1=HIGH in_2=LOW
//CCW in_1=LOW in_2=HIGH
//cw
int FBVAL = analogRead(A0);
Serial.println(FBVAL);
analogWrite(9,255);
digitalWrite(in_1,HIGH);
digitalWrite(in_2,LOW);
if ((FBVAL)>=140) {digitalWrite (in_1,LOW);};
// would also like a delay here
analogWrite(9,200);
digitalWrite(in_1,LOW);
digitalWrite(in_2,HIGH);
if ((FBVAL)<=1) {digitalWrite (in_2,LOW);};
// would also like a delay here
analogWrite(9,100);
digitalWrite(in_1,HIGH);
digitalWrite(in_2,LOW);
if ((FBVAL)>=160) {digitalWrite (in_1,LOW);};
Serial.print( " plucky " );
}
When you add the serial print does it only print one time or many times? If it prints many times it did not just stop.