input polling and interrupts
Posted: Wed Jan 21, 2015 10:19 pm
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:
or I could also use an interrupt and have:
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
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 all
void loop()
{
val = digitalRead(in_pin);
if (val) {
digitalWrite(out_pin, HIGH);
}
}
or I could also use an interrupt and have:
Code: Select all
void 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