serial monitor is giving wrong values. I tried it with arduino uno and arduino nano but everytime serial monitor gave wrong values
Most times the wrong baudrate.
https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966
What values does it give? Post your code.
ok thanks ı will try it with different baudrates.
ı didn't connect anything to analog pin but it gives some values like 280,281 or 340
I tried it with different baudrates but this time it didn't give a value
only some sign like h,k,:, or square
POST. YOUR. CODE.
If an analog pin is not connected then it could be any value... it's called 'floating".
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.println(analogRead(A1));
delay(100);
}
And you expected to see zero?
That's sweet.
What do you expect?
Have a read of the forum guidelines. They are posted at the top of every section. They will tell you how to post code in code tags and what information you need to supply to get the answers you need. Your answer would be in the first reply if you had done this.
You are reading the value of a floating pin (one that has no connections to give it a set value). The serial monitor is giving the correct readings which are pretty random and linked to all kinds of environmental conditions and influences. If you want the pin to return a specific value you can use an internal pull-up resistor or attach something to it that will pull it to a set value.
Look at the basic examples in the ide which will tell you also about setting pinMode etc
Example use of code tags
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.println(analogRead(A1));
delay(100);
}
The above code is working properly if the analog pins are left open. What kinds of readings do you get when you ground the analog pin? What kinds of readings do you get if you put the analog pin to Voperate of the MCU?
You've also discovered a way to create a pseudo random number generator.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.