I was trying to get familiar with the serial plotter so that i can use it in future for debugging purpose. But when I give a sine wave of 1Volt amplitude and a DC offset of 500mV(to avoid negative voltage) and 50Hz. As a beginning i wrote the the following few lines as code.
void setup()
{
Serial.begin(115200);
}
void loop()
{
Serial.println(analogRead(A5));
delay(100);
}
Result obtained on the serial plotter is a constant voltage of 19. same was obtained on monitor too. What should be done to vie the sine wave on the plotter?
sruthisindu:
on the serial plotter is a constant voltage of 19. same was obtained on monitor too. What should be done to vie the sine wave on the plotter?
Serial plotter is a feature on Arduino available from versions 1.6.6. Real time sensor data plotting and debugging is possible using the plotter which plots the data displayed on serial monitor.
What the other forer says is that, as you delay by 100 (0.1 s), you are sampling the sin signal at the same place all the times every 5 cycles ( 5 * (1/50) = 0.1) so having the same value every time.
Try with a value not multiple of 20 (ms by cycle); 101 has to do.
@ard_newbie: I understand what you are trying to say. To save the samples as array and then use them. But as mentioned in your program, sinesize acts as sampling frequency. But how do i divide the real time sine wave's frequency as you have done for created sine wave?. I need to use the sine wave plotted for further processing. @vffgaston: Thank you for the tip.