I want control dimming light. I use moc3052 and bt139. I chose the scheme of the datasheet moc3052.
Lamp on / off works, but I do not understand how to control the brightness of the lamp. Do I understand correctly that the triac need to open the half-wave part of the missing? What do I need to make a delay before turning on the triac? I've always worked full-light glow with varying delay before turning on the triac.
int pin = 3;
void setup()
{
pinMode(pin, OUTPUT);
attachInterrupt(0, light, RISING);
}
void light()
{
delayMicroseconds(1000);
digitalWrite(pin, HIGH);
delayMicroseconds(20);
digitalWrite(pin, LOW);
}
void loop()
{
}