Noob programing error

Hello I have had my Arduino for a few weeks now and this is the first time I have done more then change a few variables in a sketch.

I am trying to get an LED to light up dependent on the temperature in the hopes of using the Arduino to regulate the temp of a few things in the future when I have more experience.

Anyway the error message I am getting at this point is “else without a previous if” here is the code I have at this point. I am just using the basic temp code from the playground for a start.

#include <math.h>
int yellowPin= 11;
int val= 0;
double Thermister(int RawADC) {
double Temp;
Temp = log(((10240000/RawADC) - 10000));
Temp = 1 / (0.001129148 + (0.000234125 * Temp) + (0.0000000876741 * Temp * Temp * Temp));
Temp = Temp - 273.15; // Convert Kelvin to Celcius
Temp = (Temp * 9.0)/ 5.0 + 32.0; // Convert Celcius to Fahrenheit
return Temp;
}

void setup() {
Serial.begin(115200);
pinMode (yellowPin, OUTPUT);
}

void loop() {
Serial.println(int(Thermister(analogRead(0)))); // display Fahrenheit
delay(1000);

val = (int(Thermister(analogRead(0))));

if (val > 80); {
digitalWrite(yellowPin, HIGH);
}else {
digitalWrite(yellowPin, LOW);
}

}

I worked my way through several previous errors but this one is running me round in a circle because I don’t have any idea why it’s not seeing my IF.

Thanks

//end wall of text

You have a misplaced semi-colon in your if (remove it) - its effectively breaking the line for the compiler, thus the error; BTW - go back to your post, highlight it, and click the # button in the editor to format the code for the forum.

Thanks cr0sh for both tips, the sooner I do something useful the sooner my girlfriend will stop bugging me about having the Arduino hooked to the laptop all the time :)

Thanks cr0sh for both tips, the sooner I do something useful the sooner my girlfriend will stop bugging me about having the Arduino hooked to the laptop all the time

You only have one computer to -share-? Really?

:o

There's only been one point in my life where I only had one computer, and that was when I had my first computer when I was 10 or 11 (TRS-80 Color Computer 2, BTW - yeah, I'm a little old). Later I got a Color Computer 3, then a laptop before graduating high school and coming to Phoenix.

Since then I've acquired computers and motherboards left and right, sometimes free, sometimes from the trash, sometimes paid for. Tons of older and newer laptops, too. A couple of Amigas. Heck, there's even an Altair 8800 sitting in my shop waiting for me to restore it to working condition.

I think its time for you to get another computer.

:)

Heck, there's even an Altair 8800 sitting in my shop waiting for me to restore it to working condition.

So, shouldn't take too long to scribble a TCP/IP stack and a browser for it then.

Only one laptop, my desktop uses the tv for a monitor now and the other desktop is a pile. :( I wish I could write and load sketches from the pda since I don't really use that anymore for work.