I am trying to provide a one second (LOW) output pulse, each time the input returns to normal state.
State Input Output
Normal LOW HIGH
State change HIGH HIGH
Normal LOW LOW (for 1 second)
Repeat
Any help would be grateful.
Brian K
State Input Output
Normal LOW HIGH
State change HIGH HIGH
Normal LOW LOW (for 1 second)
Repeat
Any help would be grateful.
Brian K
C:
//BMK
//Wheel Test Code
//11/24/2019
int sensorPin = 0; // select the input pin for the photocell
int ledPin = 11; // select the pin for the LED
int sensorValue = 0; // variable to store the value coming from the sensor
void setup() {
// declare the ledPin as an OUTPUT:
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
// read the value from the sensor:
sensorValue = analogRead(sensorPin);
Serial.print("Digital reading = ");
Serial.println(sensorValue); // the raw analog reading
// turn the ledPin on
if (sensorValue < 700){
digitalWrite(ledPin, LOW);
}else{
digitalWrite(ledPin,HIGH);
}
// stop the program for <sensorValue> milliseconds:
delay(10);
}
Last edited by a moderator: