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


3 Replies

iceng (author)2015-05-27
KentB2 (author)2015-05-27

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);
digitalWrite(relayPin, HIGH);


Select as Best AnswerUndo Best Answer

mpilchfamily (author)2015-05-27

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

Select as Best AnswerUndo Best Answer