Trouble uploading analog serial read code

Hello,

I am currently using an Uno board with myoware attachment while running the analog serial read code for a project. I am experiencing trouble uploading the code to my board, it uploads once but will only plot points for a few seconds then it stops and wont restart unless the board is unplugged. I've copied my error message below. I have looked online for help as well as at other posts on this forum, however after trying a new board, clearing my computers ports, etc. I am still having this problem

Thanks!

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 -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Leila\Documents\Arduino\libraries -fqbn=arduino:avr:uno -vid-pid=0X2341_0X0043 -ide-version=10805 -build-path C:\Users\Leila\AppData\Local\Temp\arduino_build_549129 -warnings=none -build-cache C:\Users\Leila\AppData\Local\Temp\arduino_cache_289114 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.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.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\Leila\Documents\Arduino\sketch_sep25b\sketch_sep25b.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\Leila\Documents\Arduino\libraries -fqbn=arduino:avr:uno -vid-pid=0X2341_0X0043 -ide-version=10805 -build-path C:\Users\Leila\AppData\Local\Temp\arduino_build_549129 -warnings=none -build-cache C:\Users\Leila\AppData\Local\Temp\arduino_cache_289114 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.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.avrdude.path=C:\Program Files (x86)\Arduino\hardware\tools\avr -verbose C:\Users\Leila\Documents\Arduino\sketch_sep25b\sketch_sep25b.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\Leila\AppData\Local\Temp\arduino_build_549129\sketch\sketch_sep25b.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\Leila\AppData\Local\Temp\arduino_build_549129\sketch\sketch_sep25b.ino.cpp" -o "C:\Users\Leila\AppData\Local\Temp\arduino_build_549129\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\Leila\AppData\Local\Temp\arduino_build_549129\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\Leila\AppData\Local\Temp\arduino_build_549129\sketch\sketch_sep25b.ino.cpp" -o "C:\Users\Leila\AppData\Local\Temp\arduino_build_549129\sketch\sketch_sep25b.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\Leila\AppData\Local\Temp\arduino_build_549129/sketch_sep25b.ino.elf" "C:\Users\Leila\AppData\Local\Temp\arduino_build_549129\sketch\sketch_sep25b.ino.cpp.o" "C:\Users\Leila\AppData\Local\Temp\arduino_build_549129/..\arduino_cache_289114\core\core_arduino_avr_uno_0c812875ac70eb4a9b385d8fb077f54c.a" "-LC:\Users\Leila\AppData\Local\Temp\arduino_build_549129" -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\Leila\AppData\Local\Temp\arduino_build_549129/sketch_sep25b.ino.elf" "C:\Users\Leila\AppData\Local\Temp\arduino_build_549129/sketch_sep25b.ino.eep"
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-objcopy" -O ihex -R .eeprom  "C:\Users\Leila\AppData\Local\Temp\arduino_build_549129/sketch_sep25b.ino.elf" "C:\Users\Leila\AppData\Local\Temp\arduino_build_549129/sketch_sep25b.ino.hex"
Sketch uses 2098 bytes (6%) of program storage space. Maximum is 32256 bytes.
Global variables use 200 bytes (9%) of dynamic memory, leaving 1848 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\Leila\AppData\Local\Temp\arduino_build_549129/sketch_sep25b.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
An error occurred while uploading the sketch
avrdude: ser_open(): can't set com-state for "\\.\COM3"

avrdude done.

Thank you.

Modified for clarity.

With NOTHING ELSE connected to the board can you use it normally to upload sample sketches such as BLINK etc. ?

It is uploading ok , but then stops after a while .

Do you have anything connected and powered by the Arduino ? That may over heat and shutdown the regulator , causing this problem. If not that there is likely to be an error in the code .