Noob programing error
hello have had arduino few weeks , first time have done more change few variables in sketch.
trying led light dependent on temperature in hopes of using arduino regulate temp of few things in future when have more experience.
anyway error message getting @ point "else without previous if" here code have @ point. using basic temp code playground 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 celcius
temp = (temp * 9.0)/ 5.0 + 32.0; // convert celcius 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 way through several previous errors 1 running me round in circle because don't have idea why it's not seeing if.
thanks
//end wall of text
trying led light dependent on temperature in hopes of using arduino regulate temp of few things in future when have more experience.
anyway error message getting @ point "else without previous if" here code have @ point. using basic temp code playground 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 celcius
temp = (temp * 9.0)/ 5.0 + 32.0; // convert celcius 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 way through several previous errors 1 running me round in circle because don't have idea why it's not seeing if.
thanks
//end wall of text
you have misplaced semi-colon in if (remove it) - breaking line compiler, error; btw - go post, highlight it, , click # button in editor format code forum.
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Noob programing error
arduino
Comments
Post a Comment