0% found this document useful (0 votes)
3 views1 page

Code

Uploaded by

rfid035
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Code

Uploaded by

rfid035
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

/*

* Created: mer ago 22 2018


* Modified by: Usman [electronicstree.com] 10-DEC-2023
* Potentiometer Control
*/

int AC_LOAD = 3;
int potentiometerPin = A0;
int dimming = 0;

void setup() {
pinMode(AC_LOAD, OUTPUT);
attachInterrupt(0, zero_crosss_int, RISING);
}

void zero_crosss_int() {
int dimtime = (75 * dimming);
delayMicroseconds(dimtime);
digitalWrite(AC_LOAD, HIGH);
delayMicroseconds(10);
digitalWrite(AC_LOAD, LOW);
}

void loop() {
dimming = map(analogRead(potentiometerPin), 0, 1023, 5, 128);
}

You might also like