Go Down

Topic: creating code for a square wave output and sine wave output (Read 2006 times) previous topic - next topic


Feb 18, 2013, 04:18 pm Last Edit: Feb 20, 2013, 12:27 pm by basementjacks Reason: 1
hi im just wondering about finding code to create a square wave output  and a sine wave input&output for the Arduino UNO rev3. i need to measure the voltages and currents going in and out of the board with an oscilloscope and signal generator. any help would be greatly appreciated


Since the UNO has no DAC output, a sinewave is kind of tricky. You can filter the PWM output, but it might not be very clean.


I hope your lecturer isn't a member here - many are   :)
You can build a four or five bit DAC easily with an R-2R resistor ladder (useful Google search term)
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.


For generating output waveforms you should try Direct Digital Synthesis, this project uses it for the waveforms you mention and also has some useful links -


Duane B


Read this
then watch this



You can build a four or five bit DAC easily with an R-2R resistor ladder (useful Google search term) 

is there a way to do it using the circuit i already have for my project? the schematic is below

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131