Hi,
When I compile the code, it says,
"analogWriteResolution was not declared in this scope"
What is the problem? I'm attaching the code and the library which I compiled.
-Thushara Rathnayake
FunctionGenerator.ino (1.55 KB)
Waveforms.h (3.59 KB)
Hi,
When I compile the code, it says,
"analogWriteResolution was not declared in this scope"
What is the problem? I'm attaching the code and the library which I compiled.
-Thushara Rathnayake
FunctionGenerator.ino (1.55 KB)
Waveforms.h (3.59 KB)
Did you tell the Arduino IDE that you have a Due?
In the future...
To post code and/or error messages:
Before posting again, you should read the three locked topics at the top of the Programming Questions forum, and any links to which these posts point.
If your project involves wiring, please provide a schematic and/or a wiring diagram and/or a clear photograph of the wiring.
Good Luck!
Did you remember to select the DUE board before compiling?
I can upload the blink sketch successfully but when I try with the FunctionGenerator_Due.ino the following error comes. I haven't found a library zip file so I have copied and pasted the library code to a new tab and has named it "waveform.h"
Arduino: 1.6.12 (Windows 8.1), Board: "Arduino Due (Programming Port)"
In file included from C:\Users\User\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\cores\arduino/Arduino.h:44:0,
from sketch\FunctionGenerator_Due.ino.ino.cpp:1:
C:\Users\User\Documents\Arduino\FunctionGenerator_Due\FunctionGenerator_Due.ino\FunctionGenerator_Due.ino.ino: In function 'void loop()':
FunctionGenerator_Due.ino:37: error: 't_sample' was not declared in this scope
sample = constrain(t_sample, 0, oneHzSample);
^
C:\Users\User\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.11\cores\arduino/wiring_constants.h:74:35: note: in definition of macro 'constrain'
#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))
^
exit status 1
't_sample' was not declared in this scope
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
waveform.h (3.66 KB)
Perhaps
sample = map(analogRead(A0), 0, 4095, 0, oneHzSample);
sample = constrain(t_sample, 0, oneHzSample);
is supposed to be
sample = map(analogRead(A0), 0, 4095, 0, oneHzSample);
sample = constrain(sample, 0, oneHzSample);
?
Otherwise, what did you mean by t_sample ?