Go Down

Topic: with error expected unqualified-id before'if' (Read 3049 times) previous topic - next topic

tager01

I need help with my code it has gave me this error:'error expected unqualified-id before 'if'' don`t know what`s wrong. Plz help.

Thank you!


Code: [Select]

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

Coding Badly

#1
Apr 13, 2010, 06:35 am Last Edit: Apr 13, 2010, 06:35 am by bcook Reason: 1
Code: [Select]
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);
   }
[glow]  }  // <--- Remove this[/glow]


if (millis() - previousMillis_2 > relaypin_interval) {

tager01

yeah I found out about that. Thanks for the help...

Go Up