Hi everyone a newbee programming question, why do i get errors trying to compile with my if statement the error in the ardunio complier is " expected initializer before 'if'"
the 'smode' variable is delared at the top of my code with pin assiginments and stuff as a global variable
#include <avr/pgmspace.h>
#define bl_inc 10
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is plugged into port 3 on the Arduino
#define ONE_WIRE_BUS 3
#define TEMPERATURE_PRECISION 9
// mills() delay
unsigned long timer1 = 0;
///
int motorPin = 11;//pwm fan control
const int vent1Pin = 8;//Summer damper
const int vent2Pin = 9; //roof damper
const int vent3Pin = 7;//heat transfer
int smode = 0;
then at the top of my loop code i try to test the 'smode' variable with a simple if else statement.
void loop()
if (smode == 0)
{
digitalWrite(9, HIGH);
}
else{
digitalWrite(9,LOW);
}
can someone please point out my syntax error because i read the code as i have assigned the variable 'smode' to '0' up at the top of my code as a global variable then in the loop the if statement should be comparing if 'smode' is still '0' then it can do stuff? but i cant compile with the if statement because of the complier error.
sketch_dec08a:120: error: expected initializer before 'if'
sketch_dec08a:124: error: expected unqualified-id before 'else'
this the lines with my if statement that contains the error
cheers for your help