Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. unsigned char AC_LOAD = 4;
  2. unsigned char dimming = 3;
  3. unsigned char i = 55;
  4.  
  5. void setup() {
  6. // put your setup code here, to run once:
  7. pinMode(AC_LOAD, OUTPUT);
  8. pinMode(3, INPUT_PULLUP);
  9. attachInterrupt(digitalPinToInterrupt(3), zero_cross_int, RISING);
  10.  
  11. }
  12.  
  13. void zero_cross_int() {
  14. int dimtime = (100 * i);
  15. delayMicroseconds(dimtime);
  16. digitalWrite(AC_LOAD, HIGH);
  17. delayMicroseconds(10);
  18. digitalWrite(AC_LOAD, LOW);
  19. EIFR = 1; EIFR = 2;
  20. }
  21.  
  22. void loop() {
  23. // put your main code here, to run repeatedly:
  24.  
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement