blh64:
welcome to the forums. If you post your code inside code tags, you get this
// constant variables
const int magsensAPin = 2; // Magnet sensor A receiving pin
const int magsensBPin = 3; // Magnet Sensor B receiving Pin
const int magsensCPin = 4; // Magnet Sensor C receiving Pin
const int pswitchPin = 8; // Pressure switch on and off pin
const int solenoidPin = 6; // solenoid on and off pin
int PowerLEDPin = 7; // Powerd LED
//changing variables
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(magsensAPin, INPUT_PULLUP); // magsens pin 2 A is receiving
pinMode(magsensBPin, INPUT_PULLUP); // magsens pin 3 B is receiving
pinMode(magsensCPin, INPUT_PULLUP); // magsens pin 4 C is receiving
pinMode(pswitchPin, INPUT_PULLUP); // Lets pin receive signals
// outputs
pinMode(solenoidPin, OUTPUT); // solonoid is outputting
pinMode(PowerLEDPin, OUTPUT);
}
void loop() {
// Lock in
// if pressed, button state is high:
if (digitalRead(pswitchPin) == HIGH) {
delay(3000);
// turn solenoid on
digitalWrite(solenoidPin, HIGH);
} else {
// turn solonoid off:
digitalWrite(solenoidPin, LOW);
}
if (digitalRead(magsensAPin) == LOW and digitalRead(magsensBPin) == LOW and digitalRead(magsensCPin) == LOW) {
// withdraws arm
digitalWrite(solenoidPin, LOW);
delay(3000);
} else {
}
}
//Flashing LED LOOP
//digitalWrite(PowerLEDPin, HIGH);
//delay(1000);
//digitalWrite(PowerLEDPin, LOW);
//delay(1000);
With your inputs wires as INPUT_PULLUP, pressing == LOW, not pressing == HIGH
AHH ok, sorry about that. and what do you mean by "With your inputs wires as INPUT_PULLUP, pressing == LOW, not pressing == HIGH
[/quote]