I am using Arduino UNO board for ADC purpose . when analog signal convert into digital signal at that time we have inbuilt function (analogRead()) . can u tell me what is logic behind this function.
how analog function read this function.... explain in detail
Hello vikram-5
Take a view to gain the knowledge.
Have a nice day and enjoy coding in C++.
Дайте миру шанс!
The controller includes an ADC that provides the digitized values.
Analog read returns a value 0-1023 that represents the voltage at the input pin. The number is relative to the reference voltage.
So if the reference voltage was 5 volts, then a 5v volt level would return 1023. 0v would return 0. 2.5v would return 512, 1.25v would return 256, etc.
The voltage at the pin should not exceed the reference voltage.
I want int d = analogRead(A0) this function logic.
what does that mean?
what is code without using analog read () function that is read input analog signal without using analogread() function
Hello
Did you read and understand the link posted in #2, didn´t you?
I do not understand your English. Try using Google Translate if English is not your first language.
I think s/he wants to know how to roll their own "myAnalogRead" rather than use the provided one?
yes sir
ok sir
I'm curious to know why you want to make your own one. What's wrong with the way it is now?
It seems to be a typical XY problem at all.
This can't be done without external circuitry.
Have a look at this explanation of ADC. How Do ADCs Work? - The Learning Circuit - YouTube
Why do you want to build one?
My take on the question is that they want to use the hardware as is, but write a function to replace analogRead() with myAnalogRead() for some reason. I'll guess it's a college assignment where the prof told them to "do an analog read from scratch in C" kind of thing, and OP wants the forum to do the work. Just a guess tho...
I wish them luck with that quest
But since Arduino is open source, the code for analogRead() is on your system already OP, so you can look at that. I can never remember the names of the files to check, but it will be in your Arduino install in plain text somewhere. Maybe someone will give the file names for you...
ok thanks
yes