Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

Problem with analogRead()

$
0
0

Hello,

 

I have the MSP-EXP430FR5969 Wolverine Launchpad (Rev 1.6) and I'm trying to read the voltage output of a LM35 temperature sensor. I went on and used adafruit's code and adapted it to the launchpad. However, I'm not getting the correct voltage values. I verified the sensor is working as I used a multimeter to measure the voltage and it is working.

 

Here's a snippet of the code

 

static uint8_t analogInPin = A7 ;
int sensorValue = 0;       
int voltage = 0;        
int temp = 0;
 
.
.
.
.
.

 

sensorValue = analogRead(analogInPin);

voltage=sensorValue*(3600/1023.0);
  temp=(voltage-500)/10.0;
  // print the results to the serial monitor:
  Serial.print("Voltage = " );                       
  Serial.print(voltage);
  Serial.print("mV \t"); 
   
  Serial.print("Temp = ");  
  Serial.print(temp);
  Serial.print("C \n"); 
 
 
All I'm getting in the serial monitor is 929mV 41 C , but the room temperature isn't 41C and the multimeter shows around 281.7mV
I even tried changing pins and it still doesn't work. Did I just fry the board?
 
Thanks a lot

Viewing all articles
Browse latest Browse all 2077

Trending Articles