LMT86, stray '\342' in program

My first program was with the DS18B20, works very well. On top of that, I also purcahsed an LMT86 from Mouser Electronics. Found an old post, about someone that looks like they figured out how to program this 0.25°C Accuracy Analog Temperature sensor. The DS18B20 is nice, but costs $3 on Mouser Electronics, and is accurate to 0.5°C according to the Data sheet.

This is cheaper, and more accurate.

I’m new to the Arduino Uno programming structure and format.

I have some programming experience with programming using Android Studio IDE (Java & XML), I’ve made several VB.NET apps for Microsoft Windows using Visual Studio 2010 IDE, and did a little HTML5 & JavaScript using Notepad++.

I keep getting an error message…

LMT86_TEMP:17: error: stray ‘\342’ in program

Temperature = (426 – TempRead) / 2.14; // was 420 and 2.206

^

LMT86_TEMP:17: error: stray ‘\200’ in program

LMT86_TEMP:17: error: stray ‘\223’ in program

C:\Users\Administrator\Documents\Arduino\LMT86_TEMP\LMT86_TEMP.ino: In function ‘void loop()’:

LMT86_TEMP:17: error: expected ‘)’ before ‘TempRead’

Temperature = (426 – TempRead) / 2.14; // was 420 and 2.206

^

exit status 1
stray ‘\342’ in program

Here’s an image of the code…
Imgur


Here’s my code…

int LMT86Pin = A0;
int TempRead = 0;
float voltage = 0;
float Temperature = 0;

void setup()
{
  Serial.begin(9600);
  Serial.println("LMT86 test!");
  Serial.println("Testing the Temperature Sensor");
}

void loop()
{
  TempRead = analogRead(LMT86Pin);
  Serial.print("TempRead = ");
  Serial.println(TempRead);
  Temperature = (426 – TempRead) / 2.14; // was 420 and 2.206
  Serial.print("The temperature is ");
  Serial.print(int(Temperature));
  Serial.println("C");
  Temperature = (Temperature * 9.0 / 5.0) + 32;
  Serial.print("The temperature is ");
  Serial.print(int(Temperature));
  Serial.println("F");
  delay(5000);
}

Your code is polluted with unicode characters, probably because they passed through Microsoft Word or some other program that does dumb shit like that. Thats not a minus sign between 426 and TempRead, it's some kind of weird dash that looks just like a minus sign.

DrAzzy: Your code is polluted with unicode characters, probably because they passed through Microsoft Word or some other program that does dumb shit like that. Thats not a minus sign between 426 and TempRead, it's some kind of weird dash that looks just like a minus sign.

Yup, your right. I figured it out about 15 minutes ago. Testing it against a digital meat thermometer. It's accurate and matches the digital meat thermometer to the tenth of a degree. I also added 10.9 to the Fahrenheit variable. Idk why adding 10.9 to it works, but it's working now.

I figured I'd try to solve it myself, seeing that I didn't get a quick enough reply. I also checked on Google to see if there were any answers, basically the same exact thing you said, so that's what I did.

It was the minus symbol, which is where I was running into problems. Once I fixed it, It compiled, and then I uploaded it to my Arduino.

So I simplified the code a bit, and this is what the code looks like now.

int LMT86 = A0;
int A0_Read = 0;
float voltage = 0;
float Temperature = 0;

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  A0_Read = analogRead(LMT86);
  Serial.print("A0 : ");
  Serial.println(A0_Read);
  Temperature = (426 - A0_Read) / 2.14;
  Temperature = (Temperature * 9.0 / 5.0) + 42.9;
  Serial.print(Temperature, 1);
  Serial.println(" F");
  delay(6000);
}

Original post can be found Here (Dated : January 17th 2016)

Credit goes to GBUSHTA for the code. Not too much help for this chip on the forums. It's more accurate than the DS18B20 by 0.25°C (0.45°F).

But again, from the looks of it, it's spot on. Unless the digital meat thermometer is using the same chip.. idk.

Thanks for trying to help.

So here's my code, and some video footage I did for the the LMT86 from Texas Instruments.

int LMT86 = A0;
int A0_Read = 0;
float voltage = 0;
float Temperature = 0;

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  A0_Read = analogRead(LMT86);
  Serial.print("A0 : ");
  Serial.println(A0_Read);
  Temperature = (426 - A0_Read) / 2.14;
  Temperature = (Temperature * 9.0 / 5.0) + 42.9; //Added 10.9
  Serial.print(Temperature, 1);
  Serial.println(" F");
  delay(6000);
}

Some Pictures.. |500x342 |500x291

Image 01 : http://i.imgur.com/MziVp7D.jpg Image 02 : http://i.imgur.com/NqAATar.jpg

Here's the video showing it working in real time : https://www.youtube.com/watch?v=jGyW-hHGDzQ

Thanks for the help.

Hi, Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code. It will be formatted in a scrolling window that makes it easier to read.

You can go back and edit your messages to put the tags around your code.

Thanks.. Tom.. :)