Pages: [1]   Go Down
Author Topic: LED sine wave via analog pin  (Read 596 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Valencia, Spain
Offline Offline
Faraday Member
**
Karma: 146
Posts: 5490
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 535
Posts: 27048
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

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.

0
Offline Offline
Sr. Member
****
Karma: 7
Posts: 476
what?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

Pages: [1]   Go Up
Jump to: