creating code for a square wave output and sine wave output

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 :slight_smile:
You can build a four or five bit DAC easily with an R-2R resistor ladder (useful Google search term)

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

rcarduino.blogspot.com

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
http://www.instructables.com/file/F6DPG7PGZMIUHMJ