Pages: [1]   Go Down
Author Topic: Ardunio DUE & LM35  (Read 741 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi can't get Ardunio DUE & LM35 to work for me. Works great on MEGA-ADK board.
I get 91 Analog read & 41 degree C for first reading
then ZERO for all other readings

int potPin = 0;                             //input read pin for LM35 is Analog Pin 0
void setup()
{
  Serial.begin(9600);
}

void loop ()                             
{
  int aRead = 0;
  aRead = analogRead(potPin);

  Serial.print("Analog = ");
  Serial.print(aRead);
 
  float tempC = (((aRead * 5000) / 1024.0) ) / 10.0 ;
 
  Serial.print("     Temp = ");
  Serial.println(tempC);
  delay(3000);
}
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 121
Posts: 8437
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

float tempC = (((aRead * 5000) / 1024.0) ) / 10.0 ;

I haven't used the Due yet but it's a 3v3 system, so wouldn't that value be 3300?

______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Offline Offline
Newbie
*
Karma: 1
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

From Adafruit TMP36 tutorial:
Voltage at pin in milliVolts = (reading from ADC) * (3300/1024)
This formula converts the number 0-1023 from the ADC into 0-3300mV (= 3.3V)
Logged

Pages: [1]   Go Up
Jump to: