I'm really thinking that this is not possible in any way shape or form now. Even after reading about state machines and trying countless times to simply set a pin to HIGH for a few seconds then to LOW after.
The main issue I believe stems from this.
If you have a scale that sits idle and has a 0.0 weight reading, then you put something on the scale, in this case, a cat, the weight is >= a specified value. If that value is met, the pin that controls the + polarity of the motor should be set to HIGH for a few seconds then once expired, set back to LOW. If the weight is removed after the lid is open and the reading goes below the specified value then the pin that controls the - polarity of the motor should be set to HIGH for a few seconds then once expired, set back to LOW.
If the weight is placed back on, then the lid would open again and close if removed and on and on it goes.
The latest try I've given will turn the pin to HIGH then LOW then HIGH again, all because of the loop. I realize that spending all day yesterday and already half the day today on this, trying, uploading, failing over and over can take it's toll... Uffda indeed I say!
Still I persist.
int openMotorPin = 11;
int closeMotorPin = 10;
int lidState = LOW;
long previousMillis = 0;
long interval = 2000;
void loop() {
// LOGIC TO OPEN/CLOSE LID - USING LED AS EXAMPLE FOR NOW
lidState = digitalRead(openMotorPin); // read the pin for lid motor
unsigned long currentMillis = millis();
if(i >= 10) {
digitalWrite(LED, HIGH);
//digitalWrite(openMotorPin, HIGH);
if (currentMillis - previousMillis >= interval){
previousMillis = currentMillis;
if (lidState == LOW)
lidState = HIGH;
else
lidState = LOW;
// set the LED with the ledState of the variable:
digitalWrite(openMotorPin, lidState);
}
} else {
digitalWrite(LED, LOW);
digitalWrite(openMotorPin, LOW);
}