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 unsigned long time; // for debugging/indicating delay
bool triggered; // logic: trigered, yes or no bool triggered; // logic: trigered, yes or no
int pwmPin = 11; //define output pin, Meergranen output pin is 11
void setup() { void setup() {
Serial.begin(9600); // debugging (see if trigger is registered) Serial.begin(9600); // debugging (see if trigger is registered)
pinMode(pwmPin,OUTPUT);
} }
void loop() { void loop() {
@ -27,8 +29,9 @@ void loop() {
// DO SOMETHING ON NORMAL TRIGGER HERE // DO SOMETHING ON NORMAL TRIGGER HERE
Serial.println("I hear a trigger!"); Serial.println("I hear a trigger!");
Serial.println("-----------------"); //print pretty line 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)) 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: // DO SOMETHING ON DELAYED TRIGGER HERE:
Serial.println("delayed trigger with"); // print some info about the delayed trigger Serial.println("delayed trigger with"); // print some info about the delayed trigger
Serial.print(" "); Serial.print(" ");

Loading…
Cancel
Save