nassir-malik / IOT-AC-Light-Dimmer-With-Alexa

IOT-Light-Dimmer
72 stars 61 forks source link

zero values #2

Open spfmoby opened 5 years ago

spfmoby commented 5 years ago

I'm a beginner with arduino stuff, but when I try your "part1" script, One thing I noticed is that you can't turn off the light if you set a zero ('0') value. It is possible to replace ">0" by ">=0" in the main loop(), it works, but then it is impossible to set the light back on. What Am I missing ?

Thanks in advance

nassir-malik commented 5 years ago

What type of relay are you using? I see issues with active low 5v relays.

-Thanks

Nassir

On Sun, Apr 28, 2019 at 10:22 AM spfmoby notifications@github.com wrote:

I'm a beginner with arduino stuff, but when I try your "part1" script, One thing I noticed is that you can't turn off the light if you set a zero ('0') value. It is possible to replace ">0" by ">=0" in the main loop(), it works, but then it is impossible to set the light back on. What Am I missing ?

Thanks in advance

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/nassir-malik/IOT-AC-Light-Dimmer-With-Alexa/issues/2, or mute the thread https://github.com/notifications/unsubscribe-auth/AC6UKGPJQNBN4XSJA7PPB6TPSW6LZANCNFSM4HI6XPDA .

spfmoby commented 5 years ago

I use the Robotdyn 2 channels dimmer https://robotdyn.com/ac-light-dimmer-module-2-channel-3-3v-5v-logic-ac-50-60hz-220v-110v.html everything is working properly (values between 1 and 255).

No other relay

spfmoby commented 5 years ago

I had to do the following in the main loop :

      if (val>=0){
        tarBrightness =val;
        Serial.println(tarBrightness);
      }
      if (val>0 && state == 0){
        state = 1;
      }
rendercodeninja commented 5 years ago

Had the same issue. I was using a similar dimmer circuit of my on with the esp8266-12e. The light cant be turn back if we set targBrightness to 0 at some point. As @spfmoby suggested, the trick worked for me. But I'm not using it in the main loop. Using like this void setBrightness1(int val) { tarBrightness = val; if (val>0 && state == 0) { state = 1; } }