As the title says... Chat on...

User avatar
By waspinator
#7919 Hi,

I'm trying to do an IFTTT type of thing where the ESP would set a pin high if another pin goes high.

In an arduino I could use polling and have the following:

Code: Select allvoid loop()
{
  val = digitalRead(in_pin); 
  if (val) {
    digitalWrite(out_pin, HIGH);
  }
}


or I could also use an interrupt and have:

Code: Select allvoid setup()
{
  attachInterrupt(in_pin, setHigh, RISING);
}

void loop()
{
}

void setHigh()
{
  digitalWrite(out_pin, HIGH);
}



Could I / how would I poll an input or set it up with an interrupt?

I'm brand new to Lua and the ESP, so I may be thinking about this the wrong way around.

Thanks