error compiling for board arduino/genuino uno

trying to use this code to cause an accelerometer to turn on the boards builtin led but it says error compiling to board

//Arduino 1.0+ only

#include <Wire.h>

#define CTRL_REG1 0x20
#define CTRL_REG2 0x21
#define CTRL_REG3 0x22
#define CTRL_REG4 0x23
#define CTRL_REG5 0x24

int L3G4200D_Address = 105; //I2C address of the L3G4200D

int x;
int y;
int z;

void setup(){


Serial.println(“starting up L3G4200D”);
setupL3G4200D(2000); // Configure L3G4200 - 250, 500 or 2000 deg/sec

delay(1500); //wait for the sensor to be ready

void loop(){
getGyroValues(); // This will update x, y, and z with new values


//Serial.print(" Y:");
// Serial.print(y);

// Serial.print(" Z:");
// Serial.println(z);

delay(100); //Just here to slow down the serial to make it more readable
if (analogRead(x)==0);
digitalWrite(LED_BUILTIN,LOW)==HIGH);//HIGH turns on the unlit led
void getGyroValues(){

byte xMSB = readRegister(L3G4200D_Address, 0x29);
byte xLSB = readRegister(L3G4200D_Address, 0x28);
x = ((xMSB << 8) | xLSB);

byte yMSB = readRegister(L3G4200D_Address, 0x2B);
byte yLSB = readRegister(L3G4200D_Address, 0x2A);
y = ((yMSB << 8) | yLSB);

byte zMSB = readRegister(L3G4200D_Address, 0x2D);
byte zLSB = readRegister(L3G4200D_Address, 0x2C);
z = ((zMSB << 8) | zLSB);

int setupL3G4200D(int scale){
//From Jim Lindblom of Sparkfun’s code

// Enable x, y, z and turn off power down:
writeRegister(L3G4200D_Address, CTRL_REG1, 0b00001111);

// If you’d like to adjust/use the HPF, you can edit the line below to configure CTRL_REG2:
writeRegister(L3G4200D_Address, CTRL_REG2, 0b00000000);

// Configure CTRL_REG3 to generate data ready interrupt on INT2
// No interrupts used on INT1, if you’d like to configure INT1
// or INT2 otherwise, consult the datasheet:
writeRegister(L3G4200D_Address, CTRL_REG3, 0b00001000);

// CTRL_REG4 controls the full-scale range, among other things:

if(scale == 250){
writeRegister(L3G4200D_Address, CTRL_REG4, 0b00000000);
}else if(scale == 500){
writeRegister(L3G4200D_Address, CTRL_REG4, 0b00010000);
writeRegister(L3G4200D_Address, CTRL_REG4, 0b00110000);

// CTRL_REG5 controls high-pass filtering of outputs, use it
// if you’d like:
writeRegister(L3G4200D_Address, CTRL_REG5, 0b00000000);

void writeRegister(int deviceAddress, byte address, byte val) {
Wire.beginTransmission(deviceAddress); // start transmission to device
Wire.write(address); // send register address
Wire.write(val); // send value to write
Wire.endTransmission(); // end transmission

int readRegister(int deviceAddress, byte address){

int v;
Wire.write(address); // register to read

Wire.requestFrom(deviceAddress, 1); // read a byte

while(!Wire.available()) {
// waiting

v =;
return v;

tried to google but it only brought to someone else having same error but with different codes

Please read How to use this forum - please read, specifically point #7 about posting code; next edit your post and use code tags so the smilies become what they were supposed to be.

but it says error compiling to board

It says more than that; after an error, there is a button 'copy error messages' just above the black output window; that will copy the full error to the clipboard; next you can paste it in a post so we know which error you get.

Arduino: 1.8.5 (Windows 10), Board: "Arduino Nano, ATmega328P"

In file included from sketch\sketch_sep14a.ino.cpp:1:0:

C:\Users\sterretje\AppData\Local\Temp\arduino_modified_sketch_212160\sketch_sep14a.ino: In function 'void loop()':

C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:40:14: error: invalid operands of types 'void' and 'int' to binary 'operator=='

 #define HIGH 0x1


C:\Users\sterretje\AppData\Local\Temp\arduino_modified_sketch_212160\sketch_sep14a.ino:42:32: note: in expansion of macro 'HIGH'

 digitalWrite(LED_BUILTIN,LOW)==HIGH);//HIGH turns on the unlit led


exit status 1
Error compiling for board Arduino Nano.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

What is the line in the error message supposed to do? You have one ) too may in there. If you want the LED to turn on,

digitalWrite(LED_BUILTIN,HIGH);//HIGH turns on the unlit led

Next it will compile but probably not do what you want it to do

if (analogRead(x)==0);

The semicolon at the end indicates the end of the if, so the digitalWrite following it will be executed unconditionally.