working trigger delay

master
Mark van den Heuvel 5 years ago
parent 61aec7e28a
commit ebb0104723

@ -13,9 +13,11 @@
unsigned long time; // for debugging/indicating delay
bool triggered; // logic: trigered, yes or no
int pwmPin = 11; //define output pin, Meergranen output pin is 11
void setup() {
Serial.begin(9600); // debugging (see if trigger is registered)
pinMode(pwmPin,OUTPUT);
}
void loop() {
@ -27,8 +29,9 @@ void loop() {
// DO SOMETHING ON NORMAL TRIGGER HERE
Serial.println("I hear a trigger!");
Serial.println("-----------------"); //print pretty line
digitalWrite(pwmPin, LOW); //set output pin to LOW (0v)
delay(analogRead(A2)); // DLEAY THE INCOMING TRIGGER (wait for amount set by analog 2 (first potentiometer on meergranen))
digitalWrite(pwmPin, HIGH); //set output pin to HIGH (5v)
// DO SOMETHING ON DELAYED TRIGGER HERE:
Serial.println("delayed trigger with"); // print some info about the delayed trigger
Serial.print(" ");

Loading…
Cancel
Save