Pages: [1]   Go Down
Author Topic: AnalogRead  (Read 834 times)
0 Members and 1 Guest are viewing this topic.
Rome
Offline Offline
Full Member
***
Karma: 2
Posts: 176
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Reference says that AnalogRead returns int value. Unit value represents 4.9 mV, so if I want mV value i use:
float millivolt = analogRead(A1) * 4.9;

Is that true also with Arduino Due?

I'm trying to read TMP36 temperature sensor value, but I can not get the right value. The code is:

   float temp = analogRead(A1) * 4.9;
   temp = (temp - 500) / 10;
Logged

OpenDomotica ...la domotica con Arduino - www.opendomotica.it

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 618
Posts: 33945
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is that true also with Arduino Due?
No.
This is because the Due has a 3V3 reference voltage not a 5V one. So each step will be 3.3 / 1024 = 3.22mV
Logged

Pages: [1]   Go Up
Jump to: