Any reason why my Tinkercad's arduino serial plotter is not updating?

858 Views Asked by At

enter image description here

The arduino should be reading different values as the signal is a sine wave. Tried using different signal frequency as well as different delay(), still shows a constant value. Any help is highly appreciated! Thanks!!

2

There are 2 best solutions below

0
On BEST ANSWER

You are not sending the actual reading of analog input. Your code should be something like

void loop(){
  int adcRead = analogRead(A2);
  Serial.println(adcRead);  
  delay(2);
}
0
On

You are printing the value of A2 while you should be reading the pin itself.

Look for analogRead() to start with and if you intend to use much higher frequencies and perhaps need more precise information then consider using an interrupt.