Hi All
Completely new to all of this, and having to pick up half completed projects. I am using the Arduino to control me motor and gecko drive 201X. I have the script written and proven, but I cannot seem to increase the speed of the motor through the pot on the gecko drive. The motor is to turn clockwise until a limit switch is triggered, and then begins to turn counter-clockwise, and so on.
Anyone out there that can review the script and advise as to where the speed or RPM's can be amended??
const int stepPin = 9;
const int dirPin = 8;
const int topPin = 4;
const int bottomPin = 5;
int topValue = 1;
int bottomValue = 0;
void setup()
{
pinMode(topPin, INPUT_PULLUP);
pinMode(bottomPin, INPUT_PULLUP);
pinMode(stepPin, OUTPUT);
pinMode(dirPin, OUTPUT);
pinMode(13, OUTPUT);
digitalWrite(dirPin, HIGH);
Serial.begin(9600);
}
void loop(){
digitalWrite(stepPin, HIGH);
delay(5);
digitalWrite(stepPin, LOW);
delay(5);
topValue = digitalRead(topPin);
bottomValue = digitalRead(bottomPin);
if((topValue == 1)&&(bottomValue == 1))
{}
else if((topValue == 1)&&(bottomValue == 0)){digitalWrite(dirPin, HIGH);}
else if((topValue == 0)&&(bottomValue == 1)){digitalWrite(dirPin, LOW);}
else{}
}