Go Down

Topic: Waveform output on Due (Read 484 times) previous topic - next topic

braveneuroworlds

Hello all,

I'm trying to output a custom waveform from my Arduino Due but am having some issues. I'm trying to do something fairly simple but the Simple Waveform Generator isn't very intuitive and seems to be missing some code (unless I'm really mistaken).

I only want to output a single waveform so I'm trying to avoid dealing with libraries and I don't need to adjust the frequency.

When I try and run the example code given in the tutorial linked above, it says that DAC0 wasn't declared in the scope. This even happens when I attempt to declare it.

Can someone give me some insight on how to actually use the DAC0 and DAC1 pins? Thanks!

MorganS

Just use analogWrite...
Code: [Select]
  pinMode(DAC0, OUTPUT);
  analogWriteResolution(12);
  analogWrite(DAC0, a);[/a]
If it's complaining that DAC0 isn't defined then double-check you have the correct board selected on the Tools menu.

Note the pinMode isn't strictly necessary as analogWrite checks that anyway.
"The problem is in the code you didn't post."

Go Up