Dimmer 2 Version
Dimmer 2 Version
* Subscribe: http://www.youtube.com/c/ELECTRONOOBS
* Tutorial: http://www.ELECTRONOOBS.com/eng_circuitos_tut20.php
* Thank you
*/
int detectado = 0;
int valor=0;
int last_CH1_state = 0;
void setup() {
/*
* The chips used on the Arduino board (the ATmega8 and ATmega168)
have three ports:
-D (digital pins 0 to 7)
//All Arduino (Atmega) digital pins are inputs when you begin...
*/
void loop() {
//Read the value of the pot and map it from 10 to 10.000 us. AC
frequency is 50Hz, so period is 20ms. We want to control the power
valor = map(analogRead(A0),0,1024,7200,10);
if (detectado)
{
digitalWrite(3,HIGH);
delayMicroseconds(100);
digitalWrite(3,LOW);
detectado=0;
//----------------------------------------------
ISR(PCINT0_vect){