Created
September 29, 2023 09:19
-
-
Save kakopappa/b19a35476ee6086b8dcf605caf43d6da to your computer and use it in GitHub Desktop.
Dimmable Switch with RobotDyn AC Light Dimmer Module. https://help.sinric.pro/pages/tutorials/tutorials/dimmable-switch/robotdyn-ac-light-dimmer.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <RBDdimmer.h> //https://github.com/RobotDynOfficial/RBDDimmer | |
const int ZC_PIN = 0; | |
const int PWM_PIN = 2; | |
int MIN_POWER = 0; | |
int MAX_POWER = 80; | |
int POWER_STEP = 2; | |
int power = 0; | |
dimmerLamp acd(PWM_PIN, ZC_PIN); | |
void setup(){ | |
Serial.begin(115200); | |
delay(100); | |
acd.begin(NORMAL_MODE, ON); | |
} | |
void loop(){ | |
for(power=MIN_POWER;power<=MAX_POWER;power+=POWER_STEP){ | |
acd.setPower(power); | |
delay(100); | |
} | |
for(power=MAX_POWER;power>=MIN_POWER;power-=POWER_STEP){ | |
acd.setPower(power); | |
delay(100); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment