Arduino PWM to AC Using OpAmps
By Pistolero992000int pwmSin[] =
{127,110, 94, 78, 64, 50, 37, 26,
17, 10, 4, 1, 0, 1, 4, 10,
17, 26, 37, 50, 64, 78, 94,110,
127,144,160,176,191,204,217,228,
237,244,250,253,254,253,250,244,
237,228,217,204,191,176,160,144
};
void setup()
{
pinMode(13, OUTPUT);
pinMode(9, OUTPUT);
}
int val=0;
int sinVal;
void loop()
{
val = pwmSin[sinVal];
analogWrite(9,val);
digitalWrite(13, HIGH);
sinVal+=1;
if (sinVal==48) sinVal=0;
delay(10);
digitalWrite(13, LOW);
}