yes the 60 trigger was with the old sensor i was thinkthing of putting the new sensor somewhere else hence now 6 trigger
here is the code i have at mo:
i no there is delays in it but when they are active the hall will not be being used
i would like to put all what we have been talking about in where it says (auto mod)
#include <AH_EasyDriver.h>
//AH_EasyDriver(int RES, int DIR, int STEP, int MS1, int MS2, int SLP);
AH_EasyDriver stepper(200,2,3,4,5,6); // init w/o "enable" and "reset" functions
int tempsensor = A1;
int brack = 12;
int pump = 13;
int automanual = 11;
int overtempled = 10;
int previous = 0; // the previous reading from the analog input
bool DoneInitialization = false;
void setup() {
stepper.resetDriver(); // reset driver
stepper.enableDriver(); // enable driver
stepper.setMicrostepping(3); // 0 -> Full Step
// 1 -> 1/2 microstepping
// 2 -> 1/4 microstepping
// 3 -> 1/8 microstepping
stepper.setSpeedRPM(50); // set speed in RPM, rotations per minute
pinMode(brack , INPUT) ; // brack
pinMode(pump , OUTPUT); // hydraulis pump
pinMode(automanual , INPUT) ; // auto / manual swicth
pinMode(overtempled, OUTPUT); // over temp LED
delay(4000);
}
void loop() {
// get the sensor value
int potVal = analogRead(0);
int stpPos = map(potVal, 0, 1023, 0, 152);
// ----------------------
int val = analogRead(tempsensor); // temp sensor high
if (val <970) {
digitalWrite(pump, HIGH); // hydraulis pump high
digitalWrite(overtempled, LOW); // over temp LED
// -----------------------
if (digitalRead(brack) == LOW) { // brack swicth
if (digitalRead(automanual) == HIGH) { // auto / manual swicth
// -------------------------------------------
if (!DoneInitialization) {
stepper.sleepON(); // set Sleep mode ON
delay(10000);
DoneInitialization=true; // Initialization is done, don't run it again until it has been reset
} // ---------------------------------------------
stepper.sleepOFF(); // set Sleep mode OFF
stepper.rotate(stpPos - previous);
previous = stpPos; // remember the previous value of the sensor
}
// ---------------------------------------------
else { // -- AUTO mod -- //
//----------------//
}
}
// ---------------------------------------------------------
else { // brack swicth when HIGH
stepper.rotate(-previous);
// reset the previous value to zero
previous = 0;
}
}
// ---------------------------------------------------------
else { // temp sensor HIGH
stepper.rotate(-previous);
previous = 0; // reset the previous value to zero
DoneInitialization=false; // resetting the count
digitalWrite(overtempled, HIGH); // over temp LED
delay(1000);
stepper.sleepON(); // set Sleep mode ON
delay(10000);
digitalWrite(pump, LOW); // hydraulis pump high
delay(30000);
}
// --------------------------------------------
}