Getting errors uploading simple ISR sketch

It can’t get much simpler than this Sketch - Here is the code & the verbose dump, and a schematic. I copied the code into Arduino IDE. It compiled, but will not run.

const byte LED = 12;
const byte BUTTON = 2;

// Interrupt Service Routine (ISR)
void switchPressed ()
{
if (digitalRead (BUTTON) == HIGH)
digitalWrite (LED, HIGH);
else
digitalWrite (LED, LOW);
} // end of switchPressed

void setup ()
{
pinMode (LED, OUTPUT); // so we can update the LED
digitalWrite (BUTTON, HIGH); // internal pull-up resistor
attachInterrupt (digitalPinToInterrupt (BUTTON), switchPressed, CHANGE); // attach interrupt handler
} // end of setup

void loop ()
{
// loop doing nothing
}

_----------------------------------------
C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Don \AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Don \AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Don \Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10805 -build-path C:\Users\Don \AppData\Local\Temp\arduino_build_88381 -warnings=none -build-cache C:\Users\Don \AppData\Local\Temp\arduino_cache_814920 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\Don Zrudsky\Documents\Arduino\Simple_ISR\Simple_ISR.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Don \AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Don \AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Don y\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10805 -build-path C:\Users\Don \AppData\Local\Temp\arduino_build_88381 -warnings=none -build-cache C:\Users\Don \AppData\Local\Temp\arduino_cache_814920 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\Don\Board ‘uno’ from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Using core ‘arduino’ from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr
Detecting libraries used…
“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “C:\Users\Don \AppData\Local\Temp\arduino_build_88381\sketch\Simple_ISR.ino.cpp” -o “nul”
Generating function prototypes…
“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “C:\Users\Don \AppData\Local\Temp\arduino_build_88381\sketch\Simple_ISR.ino.cpp” -o “C:\Users\Don \AppData\Local\Temp\arduino_build_88381\preproc\ctags_target_for_gcc_minus_e.cpp”
“C:\Program Files (x86)\Arduino\tools-builder\ctags\5.8-arduino11/ctags” -u --language-force=c++ -f - --c+±kinds=svpf --fields=KSTtzns --line-directives “C:\Users\Don \AppData\Local\Temp\arduino_build_88381\preproc\ctags_target_for_gcc_minus_e.cpp”
Compiling sketch…
“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard” “C:\Users\Don \AppData\Local\Temp\arduino_build_88381\sketch\Simple_ISR.ino.cpp” -o “C:\Users\Don \AppData\Local\Temp\arduino_build_88381\sketch\Simple_ISR.ino.cpp.o”
Compiling libraries…
Compiling core…
Using precompiled core
Linking everything together…
“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-gcc” -w -Os -g -flto -fuse-linker-plugin -Wl,–gc-sections -mmcu=atmega328p -o “C:\Users\Don \AppData\Local\Temp\arduino_build_88381/Simple_ISR.ino.elf” “C:\Users\Don \AppData\Local\Temp\arduino_build_88381\sketch\Simple_ISR.ino.cpp.o” “C:\Users\Don \AppData\Local\Temp\arduino_build_88381/…\arduino_cache_814920\core\core_arduino_avr_uno_0c812875ac70eb4a9b385d8fb077f54c.a” “-LC:\Users\Don \AppData\Local\Temp\arduino_build_88381” -lm
“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-objcopy” -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 “C:\Users\Don \AppData\Local\Temp\arduino_build_88381/Simple_ISR.ino.elf” “C:\Users\Don \AppData\Local\Temp\arduino_build_88381/Simple_ISR.ino.eep”
“C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-objcopy” -O ihex -R .eeprom “C:\Users\Don \AppData\Local\Temp\arduino_build_88381/Simple_ISR.ino.elf” “C:\Users\Don \AppData\Local\Temp\arduino_build_88381/Simple_ISR.ino.hex”
Sketch uses 1054 bytes (3%) of program storage space. Maximum is 32256 bytes.
Global variables use 13 bytes (0%) of dynamic memory, leaving 2035 bytes for local variables. Maximum is 2048 bytes.
C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM3 -b115200 -D -Uflash:w:C:\Users\Don \AppData\Local\Temp\arduino_build_88381/Simple_ISR.ino.hex:i

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is “C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf”

Using Port : COM3
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x20
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x20
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x20
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x20
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x20

avrdude done. Thank you.

An error occurred while uploading the sketch
Invalid library found in C:\Users\Don \Documents\Arduino\libraries\LMT01_Arduino_Example_Code_1.0: C:\Users\Don \Documents\Arduino\libraries\LMT01_Arduino_Example_Code_1.0
Invalid library found in C:\Users\Don \Documents\Arduino\libraries\LMT01_Arduino_Example_Code_1.0: C:\Users\Don \Documents\Arduino\libraries\LMT01_Arduino_Example_Code_1.0

Simple_ISP.pdf (91.6 KB)

Nothing to do with your code, suspect would have same problem with any sketch. What are you uploading to? Is correct board selected? Did the board previously work?

Thanks for your reply. I am running an Arduino/"genuino" uno with the USB cable attached to the computer. I have used it on 3 other programs and it worked perfectly. The USB port works. I tested the 5 V pin and it delivers a steady 5.8 V, when I hit reset the "TX" green light comes on momentarily. The red led labeled "ON" is on the the green LED labeled "L" both are on continuously. You are right about other programs won't run either - I just loaded "Blink" and it gave the same error code. So there are now no connections to any pins. I'll repeat only the last 3 or four lines. By the way the sketch shown in the error code "LMT01_Arduino_Example_Code_1.0" I was having lots of trouble with. I'm not sure why it is showing as the problem here.:

An error occurred while uploading the sketch Invalid library found in C:\Users\Don \Documents\Arduino\libraries\LMT01_Arduino_Example_Code_1.0: C:\Users\Don \Documents\Arduino\libraries\LMT01_Arduino_Example_Code_1.0 Invalid library found in C:\Users\Don \Documents\Arduino\libraries\LMT01_Arduino_Example_Code_1.0: C:\Users\Don \Documents\Arduino\libraries\LMT01_Arduino_Example_Code_1.0

I went into the Documents/Arduino/L\libraries and I found the trouble maker "LMT01_Arduino_Example_Code_1.0" and deleted it within Windows Explorer. This time I got the much shorter error message: Arduino: 1.8.5 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Don \AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Don \AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Don \Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10805 -build-path C:\Users\Don \AppData\Local\Temp\arduino_build_195675 -warnings=none -build-cache C:\Users\Don \AppData\Local\Temp\arduino_cache_373320 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Program Files (x86)\Arduino\examples\01.Basics\Blink\Blink.ino C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\Don \AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\Don \AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Don \Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10805 -build-path C:\Users\Don \AppData\Local\Temp\arduino_build_195675 -warnings=none -build-cache C:\Users\Don \AppData\Local\Temp\arduino_cache_373320 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Program Files (x86)\Arduino\examples\01.Basics\Blink\Blink.ino Using board 'uno' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr Using core 'arduino' from platform in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr Detecting libraries used... "C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\Don \AppData\Local\Temp\arduino_build_195675\sketch\Blink.ino.cpp" -o "nul" Generating function prototypes... "C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\Don \Data\Local\Temp\arduino_build_195675\sketch\Blink.ino.cpp" -o "C:\Users\Don \AppData\Local\Temp\arduino_build_195675\preproc\ctags_target_for_gcc_minus_e.cpp" "C:\Program Files (x86)\Arduino\tools-builder\ctags\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\Users\Don \AppData\Local\Temp\arduino_build_195675\preproc\ctags_target_for_gcc_minus_e.cpp" Compiling sketch... "C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10805 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" "-IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\standard" "C:\Users\Don \AppData\Local\Temp\arduino_build_195675\sketch\Blink.ino.cpp" -o "C:\Users\Don \AppData\Local\Temp\arduino_build_195675\sketch\Blink.ino.cpp.o" Compiling libraries... Compiling core... Using precompiled core Linking everything together... "C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\Users\Don \AppData\Local\Temp\arduino_build_195675/Blink.ino.elf" "C:\Users\Don \AppData\Local\Temp\arduino_build_195675\sketch\Blink.ino.cpp.o" "C:\Users\Don \AppData\Local\Temp\arduino_build_195675/..\arduino_cache_373320\core\core_arduino_avr_uno_0c812875ac70eb4a9b385d8fb077f54c.a" "-LC:\Users\Don \AppData\Local\Temp\arduino_build_195675" -lm "C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\Users\Don \AppData\Local\Temp\arduino_build_195675/Blink.ino.elf" "C:\Users\Don \AppData\Local\Temp\arduino_build_195675/Blink.ino.eep" "C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-objcopy" -O ihex -R .eeprom "C:\Users\Don \AppData\Local\Temp\arduino_build_195675/Blink.ino.elf" "C:\Users\Don \AppData\Local\Temp\arduino_build_195675/Blink.ino.hex" Sketch uses 928 bytes (2%) of program storage space. Maximum is 32256 bytes. Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes. C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM3 -b115200 -D -Uflash:w:C:\Users\Don \AppData\Local\Temp\arduino_build_195675/Blink.ino.hex:i

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/ Copyright (c) 2007-2014 Joerg Wunsch

System wide configuration file is "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

Using Port : COM3 Using Programmer : arduino Overriding Baud Rate : 115200 avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x30 avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x20 avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x30 avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x20 avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x30 avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x20 avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x30 avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x20 avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x30 avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x20

avrdude done. Thank you.

An error occurred while uploading the sketch

I think all my troubles started with "LMT01_Arduino_Example_Code_1.0". I may have somehow contaminated the IDE with an improper install of that program. Should I delete the IDE and start over reinstalling it.

All this stuff

         Using Port                    : COM3
         Using Programmer              : arduino
         Overriding Baud Rate          : 115200
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x30
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x20

says to me the USB interface chip on the board is not working. Can you run the Loopback test and prove/disprove that?

I'm fairly new to Arduinos. What is a loop back test? How do I run it? What results should I expect?

In the meantime, I tried another board that used to work - a feather. It just locked up continuously on upload, of the ultra simple "Blink," so its beginning to look more & more like the IDE 1.8.5 may somehow may be corrupted. What do you think - should I delete it & start over with a fresh download?

Also, if you think this is the problem, please respond to my questions about the loop back test. I need to learn everything I can about Arduino IDE!

Many thanks for your help.

hey im a newbie to arduino and i tried it but im not understanding it at all. i hate to say im giving up but its nerve wreaking to me. uploads, sketches. just not working editing i tried it all. im not computer wise at all i guess ill leave this to someone that has the time for it. think im try to sell all my arduino parts on ebay i guess. i have a variety of them nano boards,usb cables, power plugs, mega board can bus modules and shields jumpers and much more