Go Down

Topic: LED sine wave via analog pin (Read 662 times) previous topic - next topic

MichBFreeman

I'm trying to generate a sine wave on an LED. I've found plenty of examples using PWM to generate a sine wave on a digital pin, but I need one generated via an analog pin. Any help would be greatly appreciated!

fungus


I'm trying to generate a sine wave on an LED. I've found plenty of examples using PWM to generate a sine wave on a digital pin, but I need one generated via an analog pin. Any help would be greatly appreciated!


Arduino has no analog outputs. The analog pins are input-only. PWM is the only way to do this.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

MichBFreeman

Oh, well that's good to know. Sorry if that was a pretty basic question, I'm very new to all this. Thanks for the help, though!

CrossRoads

There is no analog output pin - the best you can do is fake it via a PWM pin.
Or, get an external DAC such MCP4821 or MCP4921
http://www.digikey.com/product-detail/en/MCP4921-E%2FP/MCP4921-E%2FP-ND/716280 external reference voltage
http://www.digikey.com/product-detail/en/MCP4821-E%2FP/MCP4821-E%2FP-ND/951462 internal reference voltage
Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

P18F4550

6 Led's, 60 degrees out of phase, showing only the top half of the sine wave, it would'nt be hard to show the negative side using bi colour leds


Go Up