Pages: [1]   Go Down
Author Topic: with error expected unqualified-id before'if'  (Read 2824 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13085
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
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) {
« Last Edit: April 12, 2010, 11:35:16 pm by bcook » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 2
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: