Video Sites NCECAYoutubeIndex not maintained
Thai w0it |
Main /
TeMP
void indexCup()
{ lcd.clear(); lcd.setBacklight(YELLOW); lcd.setCursor(0, 1); lcd.print("Top of Loop # "); lcd.print(glaze); //
digitalWrite(DIR, LOW); // just to make sure
for (int S = 0 ; S < indexClearPinSteps; S++) //this is to move the carousel enough to get the previous pin out of the sensor
{
digitalWrite(STEP, HIGH);
delayMicroseconds(350);//350 seems to be near minimum to be reliable (250 works sometimes)If it is too low the motor just buzzes.
digitalWrite(STEP, LOW);
delayMicroseconds(500);//500 seems to be near minimum to be reliable(400 works sometimes)
}
}
/*
Written to drive Louis' circuit board capacitor.
*/
#include <Stepper.h>
int LED = 13; //LED pin
const int stepsPerRevolution = 200;
// for your motor
bool bigger = 0; //button position
bool smaller = 0;
int biggerPin = 2;
int smallerPin = 3;
int currentPos = 0; //not always true, but is put to zero in setup()
// initialize the stepper library on pins 8 through 11:
Stepper stepper(stepsPerRevolution, 8, 9, 10, 11);
// number of steps the motor has taken
void setup() {
pinMode(LED, OUTPUT);
pinMode(biggerPin, INPUT_PULLUP);
pinMode(smallerPin, INPUT_PULLUP);
Serial.begin(9600);
stepper.setSpeed(20);
for (int x = 0; x < 4000; x++) {
stepper.step(-1);
delay(2);
}
digitalWrite(LED, HIGH);
delay(100);
digitalWrite(LED, LOW);
Serial.println("Position Reset to Zero");
}
void loop() {
bigger = digitalRead(biggerPin);
smaller = digitalRead(smallerPin);
if (bigger) {
stepper.step(-1);
delay(2);
}
if (smaller) {
stepper.step(1);
delay(2);
}
}
|