loading

Arduino crash sensor single pulse?

I'm trying to get a crash sensor to output a single 800ms pulse when depressed and held down until it is released and repeat when depressed again, I have had this working before but cant seem to achieve it again. It either continually loops while depressed or wont output at all until it's released. Any help is greatly appreciated :)

iceng2 years ago

Get a new NE555.

KentB2 (author) 2 years ago

I'm not sure whats going on it's not reacting how i would expect it to.

Why do i have a delay before and after switch input?

Here is the basic code I'm struggling with :/

int relayPin = 13;
int inputPin = 3;
void setup() {
pinMode(relayPin, OUTPUT);
pinMode(inputPin, INPUT);
}
void loop(){
int val = digitalRead(inputPin);
if (val == HIGH)

digitalWrite(relayPin, LOW);
delay(800);
digitalWrite(relayPin, HIGH);

}

Can't help if you don't post your code.