title: error: expected unqualified-id before '{' token in Arduino
body: <p>I'm having trouble with compiling my code for two I2C sensors. I keep getting the error: <code>expected unqualified-id before '{' token</code>.</p>
  
  <p>Below is the code I am trying to solve:</p>
  
  <pre><code>#include &lt;i2cmaster.h&gt;
  #include "Wire.h"    // imports the wire library for talking over I2C 
  
  int led = 13;
  //before void setup
  #define SENSOR_ADDR_OFF_OFF  (0x4B)
  #define SENSOR_ADDR_OFF_ON   (0x4A)
  #define SENSOR_ADDR_ON_OFF   (0x49)
  #define SENSOR_ADDR_ON_ON    (0x4m8)
  
  // Set the sensor address here
  const uint8_t sensorAddr = SENSOR_ADDR_OFF_OFF;
  //void setup begins here
  void setup()
  {
  // Start the serial port for output
  Serial.begin(9600);
  
  pinMode(led, OUTPUT);
  
    // Join the I2C bus as master
    Wire.begin();
  
  // Set up the ADC on the sensor (reset everything)
  
  
  i2c_init(); //Initialise the i2c bus
  PORTC = (1 &lt;&lt; PORTC4) | (1 &lt;&lt; PORTC5);//enable pullups
  
  }
  //void loop begins here
  void loop(){
  int dev = 0x5A&lt;&lt;1;
  int data_low = 0;
  int data_high = 0;
  int pec = 0;
  
  i2c_start_wait(dev+I2C_WRITE);
  i2c_write(0x07);
  
  // read
  i2c_rep_start(dev+I2C_READ);
  data_low = i2c_readAck(); //Read 1 byte and then send ack
  data_high = i2c_readAck(); //Read 1 byte and then send ack
  pec = i2c_readNak();
  i2c_stop();
  
  //This converts high and low bytes together and processes temperature, MSB              is   a error bit and is ignored for temps
  double tempFactor = 0.02; // 0.02 degrees per LSB (measurement resolution of the MLX90614)
  double tempData = 0x0000; // zero out the data
  int frac; // data past the decimal point
  
  // This masks off the error bit of the high byte, then moves it left 8 bits and adds the low byte.
  tempData = (double)(((data_high &amp; 0x007F) &lt;&lt; 8) + data_low);
  tempData = (tempData * tempFactor)-0.01;
  
  float celcius = tempData - 273.15;
  float fahrenheit = (celcius*1.8) + 32;
  
  Serial.print("Celcius: ");
  Serial.println(celcius);
  
  Serial.print("Fahrenheit: ");
  Serial.println(fahrenheit);
  }
  uint8_t left;
  uint8_t right;
  
  {
  if ((ReadByte(sensorAddr, 0x0, &amp;left) == 0) &amp;&amp;
     (ReadByte(sensorAddr, 0x1, &amp;right) == 0))
  {
     // Use a threshold (value from 0-255) to determine if sensor detected a     dark
    // or light surface; the threshold should be modified according to the
    // environment on which the sensor will be used
  {    
  Serial.print("Left: ");
  Serial.println(left);
  }{
  Serial.print("Right: ");
  Serial.println(right);
  }}  
  delay(1000);
  }
  
  // Read a byte on the i2c interface
  int ReadByte(uint8_t addr, uint8_t reg, uint8_t *data)
  {
  // Do an i2c write to set the register that we want to read from
  Wire.beginTransmission(addr);
  Wire.write(reg);
  Wire.endTransmission();
  
  //Read a byte from the device
  Wire.requestFrom(addr, (uint8_t)1);
  if (Wire.available())
  {
    *data = Wire.read();
  }
  else
  {
    // Read nothing back
    return -1;
  }
  
  return 0;
  }
  
  // Write a byte on the i2c interface
  void WriteByte(uint8_t addr, uint8_t reg, byte data)
  }
  {
  // Begin the write sequence
  Wire.beginTransmission(addr);
  
  // First byte is to set the register pointer
  Wire.write(reg);
  
  // Write the data byte
  Wire.write(data);
  
  // End the write sequence; bytes are actually transmitted now
  Wire.endTransmission();
  }
  }    
  </code></pre>