336Views3Replies

Author Options:

Arduino crash sensor single pulse? Answered

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 :)

Tags:Arduino

Discussions

0
None
iceng

3 years ago

Get a new NE555.

0
None
KentB2

3 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);

}

0
None
mpilchfamily

3 years ago

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