I need help with my code it has gave me this error:'error expected unqualified-id before 'if'' dont know what
s wrong. Plz help.
Thank you!
int ledpin1 = 3;
int ledpin2 = 4;
int relaypin = 2;
long previousMillis_1 = 0;
long ledpin_interval = 1000;
long previousMillis_2 = 300;
long relay_interval = 10000;
int count = 0;
int tempc = 0;
int tempmv = 0;
int tempF = 0;
//input
int lm19pin = 0;
void setup() {
pinMode(ledpin1, OUTPUT); // initialize the digital pin as an output
pinMode(ledpin2, OUTPUT);
pinMode(relaypin, OUTPUT); // initialize the digital pin as an output
pinMode(lm19pin, INPUT); // initialize the digital pin as an intput
Serial.begin(2400); // set up serial output
}
void loop() {
if (millis() - previousMillis_1 > ledpin_interval) {
previousMillis_1 = millis();
digitalWrite(ledpin1,HIGH); //set the led high
digitalWrite(ledpin1, HIGH); //set the led high
digitalWrite(ledpin2, LOW); //set the led off
}
else{
digitalWrite(ledpin1, HIGH);
digitalWrite(ledpin2, HIGH);
}
}
if (millis() - previousMillis_2 > relaypin_interval) {
previousMillis_2 = millis();
if (digitalWrite(relaypin, LOW)){
digitalWrite(ledpin1,HIGH);
count++;
}
else{
digitalWrite(ledpin, LOW);
}
}
// lm19_val=analogRead(lm19Pin); //read value of center leg of LM19 on source
// tempmV = lm19_val; //output voltage of LM19, 10mV = 1 Degree Celcius
//tempF=(5*tempmV*100/1024); //mV converted to farenheit
//tempc=((tempf-32)*5/9); //farenheit to celsius
Serial.print("$GPUMD1,");
// Serial.print(count,tempc);
}
:o