jxmot/ESP8266-RCWL0516

invert led on-off

Closed this issue · 4 comments

Dear James,

I tried to figure it out, how to invert when is the led on an when it's off, without luck.
So I want to led turn on when movement is detected, and turn on when de device is not detesting movements.
On ESP01 is everíthing working just fine with your code.

Please help.

Thanks in advance

jxmot commented

Hello,

I apologize for not getting back to you sooner.... The problem isn't with the ESP-01. The issue is due to a bug in my code. As it turns out the ESP-01 and some other 8266 variants do not have an "on board" LED that can be toggled. When this project was originally developed I used a NodeMCU type, and it has an on board LED.

I plan on fixing the code issue, but until there here's what you can do to disable the LED code -

comment out lines: 98, 100, 118, 128, 137, and 163

That should cover you for polled and interrupt modes.

However, if you want to toggle an LED you could use a different I/O pin. If so then you would need to change all occurrences of "LED_BUILTIN" to the pin of your choice(lines 98, 100,147, and 163). And you may have to swap the definitions for LED_BUILTIN_ON and LED_BUILTIN_OFF. But that will depend on how you hook up the LED to the ESP-01.

Please note that LED_BUILTIN is defined in the Arduino header files.

Regards,
jim

jxmot commented

Yes, I just rechecked them and commenting out those lines should disable any calls to operate the LED.

I also rechecked the lines for changing the LED to a different pin. They appear to be correct as well.

I haven't tested the changes on target because I'm planning on modifying the code to be conditionally compiled for the appropriate target. At this time I do not have an estimate to when that will occur.

jxmot commented

Closed due to inactivity on this issue.