I need help with an example.

I finally purchased an Arduino DUE, and I copied the text into a blank file as you put it on the official website ( the example of the Simple Waveform Generator) : http://arduino.cc/en/Tutorial/DueSimpleWaveformGenerator

Anyway, you get two pieces of program one called " FunctionGenerator.ino " and another " waveform.h "

I copied the two, one behind the other in the same sketch , compile and I obtain the following errors:

sketch_dec12a.ino:12:23: error: Waveforms.h: No such file or directory
sketch_dec12a.ino: In function 'void setup()':
sketch_dec12a:23: error: 'analogWriteResolution' was not declared in this scope
sketch_dec12a:24: error: 'analogReadResolution' was not declared in this scope
sketch_dec12a.ino: In function 'void loop()':
sketch_dec12a:34: error: 'maxSamplesNum' was not declared in this scope
sketch_dec12a:35: error: 't_sample' was not declared in this scope
sketch_dec12a:37: error: 'DAC0' was not declared in this scope
sketch_dec12a:37: error: 'waveformsTable' was not declared in this scope
sketch_dec12a:38: error: 'DAC1' was not declared in this scope

I know the first error has to do with the library. But I dk exactly how to fix it .
And the others with not declaring the elements, but i dk...

I need help, sorry for my English. Thanks

Duplicate posts deleted (in 2 languages).
Please do not cross post.
If a good answer does come up in the other language, please share it here, and the same the other way.

I copied the two, one behind the other in the same sketch

That's the wrong way to do it and is why the first error message is "Waveforms.h: No such file or directory".
Waveforms.h must be a separate file in the same directory as FunctionGenerator.ino

Pete

CrossRoads:
Duplicate posts deleted (in 2 languages).
Please do not cross post.
If a good answer does come up in the other language, please share it here, and the same the other way.

Sorry for the duplicate.

I will share when I could run it! Thanks.

el_supremo:

I copied the two, one behind the other in the same sketch

That's the wrong way to do it and is why the first error message is "Waveforms.h: No such file or directory".
Waveforms.h must be a separate file in the same directory as FunctionGenerator.ino

Pete

I create a folder in my desktop called "Waveform_Generator".
I create a sketch and paste the first file and I save as... "WaveformGenerator.ino" in the "Waveform_Generator" folder.
I create a sketch and paste the second file and I save as.. "Waveforms.h" in the "Waveform_Generator" folder.

It's that okey? Thank you

If you are using Windows, the usual place for the directories is "My Documents\Arduino".
The name of the directory must be exactly the same as the .ino file (without the .ino) so you should make a directory called "My Documents\Arduino\WaveformGenerator" and put the two files in there. That will make it easier to find when you start up the Arduino IDE. You should be able to open the File|Sketchbook menu and find WaveformGenerator listed in the dropdown menu.

Pete

el_supremo:
If you are using Windows, the usual place for the directories is "My Documents\Arduino".
The name of the directory must be exactly the same as the .ino file (without the .ino) so you should make a directory called "My Documents\Arduino\WaveformGenerator" and put the two files in there. That will make it easier to find when you start up the Arduino IDE. You should be able to open the File|Sketchbook menu and find WaveformGenerator listed in the dropdown menu.

Pete

I think I have done as you told me.
Now I see two tabs

Only one error message:

"WaveformGenerator.ino: 12: fatal error: Waveforms.h: No such file or directory
compilation terminated."

Waveforms is the name of the next tab. No because it does not find.

Thank you very much.

Use Windows Explorer to look at the "My Documents\Arduino\WaveformGenerator" directory. It should have two files in it, WaveformGenerator.ino and Waveforms.h
Either Waveforms.h is missing or the filename isn't spelled correctly. If you change the name of the file, or add new files to a directory, you have to close the Arduino IDE and start it up again before it will see any changes.

Pete

Note the Tutorial page hasn't been proofread, and calls the the second file
"Waveform.h" - this won't work, the filename must match exactly. Case is always
sensitive in C.

Hi,
I have actually also a problem with this example, but progressed a bit with the errors,
I see the two tabs while opening and named all ase sensitive, but receive the following errors,
FunctionGenerator.ino: In function 'void setup()':
FunctionGenerator:24: error: 'analogWriteResolution' was not declared in this scope
FunctionGenerator:25: error: 'analogReadResolution' was not declared in this scope
FunctionGenerator.ino: In function 'void loop()':
FunctionGenerator:36: error: 't_sample' was not declared in this scope
FunctionGenerator:38: error: 'DAC0' was not declared in this scope
FunctionGenerator:39: error: 'DAC1' was not declared in this scope
//
Any ideas?

Hello yariv3G,

It looks like you have set the wrong board in the IDE 1.5.X. Verify the following:
Tools->Board->Arduino Due (Programming Port).

Also...
-Be sure your Waveforms.h is located a:

...\arduino-1.5.5-r2-windows\arduino-1.5.5-r2\hardware\arduino\sam\libraries\Waveforms

And finally...
rename t_sample as sample.

Regards!

Guys,
I solved it myself. it was the IDE version I used.
But here comes another issue I do not understand.
In the lines,

  1. sample = map(analogRead(A0), 0, 4095, 0, oneHzSample);
  2. sample = constrain(t_sample, 0, oneHzSample);

When commenting(//) line 2) the Poti works accordingly
When uncommenting line 2) the Poti does not initiate a frequency change at all.
I a monitoring only DAC0

Any ideas?

Thanks in advance

You may solved this issue but I just post the answer here in case:

Line 2 should be:
sample = constrain(sample, 0, oneHzSample);

Ref.: constrain() - Arduino Reference

Hi,
I'm also new in Arduino platform but I had similar issues as you did Yariv3G. The final issue I had before I succesfully upload the code was the error: No COM1 communication. To solve it, i click Tools>Port:...>/dev/cu.usbmodem1421.
In other words, both Board and Port needed to be selected manually.
Thanks for the Q&A, I found it very useful.

Mehmet