Error 1 Error compiling for board Arduino Uno

i try to upload or verify my code but it keeps coming back with this message can someone help me please
here is my code:

int ledpin = 8;
int buzzerpin = 9;
int tiltpin = 10;

void setup() {
pinMode(ledpin, OUTPUT);
pinMode(buzzerpin, OUTPUT);
pinMode(tiltpin, INPUT_PULLUP);
digitalWrite(ledpin, LOW);
digitalWrite(buzzerpin, LOW);
}

void loop() {
if(digitalRead(tiltpin) = HIGH)
{
digitalWrite(ledpin, HIGH);
digitalWrite(buzzerpin, HIGH);

}
}

Please follow the advice given in the link below when posting code , use code tags and post the code here to make it easier to read and copy for examination

It helps considerably if you post the full error message, also in code tags

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





















C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Bob2\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Bob2\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Bob2\Documents\Arduino\libraries -fqbn=arduino:avr:nano:cpu=atmega328 -vid-pid=1A86_7523 -ide-version=10813 -build-path C:\Users\Bob2\AppData\Local\Temp\arduino_build_105997 -warnings=all -build-cache C:\Users\Bob2\AppData\Local\Temp\arduino_cache_873119 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\Bob2\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Users\Bob2\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avr-gcc.path=C:\Users\Bob2\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\Bob2\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.arduinoOTA.path=C:\Users\Bob2\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\Bob2\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -verbose C:\Users\Bob2\AppData\Local\Temp\arduino_modified_sketch_210752\sketch_aug02a.ino

C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Bob2\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Bob2\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Bob2\Documents\Arduino\libraries -fqbn=arduino:avr:nano:cpu=atmega328 -vid-pid=1A86_7523 -ide-version=10813 -build-path C:\Users\Bob2\AppData\Local\Temp\arduino_build_105997 -warnings=all -build-cache C:\Users\Bob2\AppData\Local\Temp\arduino_cache_873119 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Users\Bob2\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avrdude-6.3.0-arduino17.path=C:\Users\Bob2\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17 -prefs=runtime.tools.avr-gcc.path=C:\Users\Bob2\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.avr-gcc-7.3.0-atmel3.6.1-arduino7.path=C:\Users\Bob2\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\7.3.0-atmel3.6.1-arduino7 -prefs=runtime.tools.arduinoOTA.path=C:\Users\Bob2\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -prefs=runtime.tools.arduinoOTA-1.3.0.path=C:\Users\Bob2\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.3.0 -verbose C:\Users\Bob2\AppData\Local\Temp\arduino_modified_sketch_210752\sketch_aug02a.ino

Using board 'nano' from platform in folder: C:\Users\Bob2\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.3

Using core 'arduino' from platform in folder: C:\Users\Bob2\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.3

Detecting libraries used...

"C:\\Users\\Bob2\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR "-IC:\\Users\\Bob2\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.3\\cores\\arduino" "-IC:\\Users\\Bob2\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.3\\variants\\eightanaloginputs" "C:\\Users\\Bob2\\AppData\\Local\\Temp\\arduino_build_105997\\sketch\\sketch_aug02a.ino.cpp" -o nul -DARDUINO_LIB_DISCOVERY_PHASE

Generating function prototypes...

"C:\\Users\\Bob2\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR "-IC:\\Users\\Bob2\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.3\\cores\\arduino" "-IC:\\Users\\Bob2\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.3\\variants\\eightanaloginputs" "C:\\Users\\Bob2\\AppData\\Local\\Temp\\arduino_build_105997\\sketch\\sketch_aug02a.ino.cpp" -o "C:\\Users\\Bob2\\AppData\\Local\\Temp\\arduino_build_105997\\preproc\\ctags_target_for_gcc_minus_e.cpp" -DARDUINO_LIB_DISCOVERY_PHASE

"C:\\Users\\Bob2\\AppData\\Local\\Arduino15\\packages\\builtin\\tools\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\Bob2\\AppData\\Local\\Temp\\arduino_build_105997\\preproc\\ctags_target_for_gcc_minus_e.cpp"

Compiling sketch...

"C:\\Users\\Bob2\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\avr-gcc\\7.3.0-atmel3.6.1-arduino7/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR "-IC:\\Users\\Bob2\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.3\\cores\\arduino" "-IC:\\Users\\Bob2\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\avr\\1.8.3\\variants\\eightanaloginputs" "C:\\Users\\Bob2\\AppData\\Local\\Temp\\arduino_build_105997\\sketch\\sketch_aug02a.ino.cpp" -o "C:\\Users\\Bob2\\AppData\\Local\\Temp\\arduino_build_105997\\sketch\\sketch_aug02a.ino.cpp.o"

In file included from C:\Users\Bob2\AppData\Local\Temp\arduino_build_105997\sketch\sketch_aug02a.ino.cpp:1:0:

C:\Users\Bob2\AppData\Local\Temp\arduino_modified_sketch_210752\sketch_aug02a.ino: In function 'void loop()':

C:\Users\Bob2\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.3\cores\arduino/Arduino.h:40:14: error: lvalue required as left operand of assignment

 #define HIGH 0x1

              ^

C:\Users\Bob2\AppData\Local\Temp\arduino_modified_sketch_210752\sketch_aug02a.ino:16:30: note: in expansion of macro 'HIGH'

   if (digitalRead(tiltpin) = HIGH)

                              ^~~~

exit status 1

Error compiling for board Arduino Nano.

= is for assignment
== is for comparrison

here is the whole error message

In file included from sketch/tiltswitch.ino.cpp:1:0:
/home/goodwinjon08/Arduino/tiltswitch/tiltswitch.ino: In function 'void loop()':
/opt/arduino-1.8.15/hardware/arduino/avr/cores/arduino/Arduino.h:40:14: error: lvalue required as left operand of assignment
 #define HIGH 0x1
              ^
/home/goodwinjon08/Arduino/tiltswitch/tiltswitch.ino:18:30: note: in expansion of macro 'HIGH'
   if (digitalRead(tiltpin) = HIGH)
                              ^~~~
exit status 1
Error compiling for board Arduino Uno.

thanks so much i read the little bit at the bottom about the = and i relised my mistake i couldnt find anywhere to help becuase it waas such a simple mistake thanks so much

You would be surprised how often we see it here. (Or how often we do it ourselves).