Background: I am working on a project that is supposed to have an Arduino mega send data from ultra sonic sensors to the computer via USB and I keep getting the same errors. I have checked the device manager and I am sure that the Arduino is on the correct port.
My python errors:
Traceback (most recent call last):
File "----", line 6, in <module>
ser = serial.Serial('COM4', 115200)
File "C:\Python27\lib\site-packages\serial\serialwin32.py", line 38, in __init__
SerialBase.__init__(self, *args, **kwargs)
File "C:\Python27\lib\site-packages\serial\serialutil.py", line 282, in __init__
self.open()
File "C:\Python27\lib\site-packages\serial\serialwin32.py", line 66, in open
raise SerialException("could not open port %r: %r" % (self.portstr, ctypes.WinError()))
serial.serialutil.SerialException: could not open port 'COM4': WindowsError(5, 'Access is denied.')
[Finished in 0.1s]
My Arduino error:
[Stino - Start building "---"...]
Sketch uses 4,922 bytes (1.9%) of program storage space. Maximum is 258,048 bytes.
Global variables use 727 bytes (8.9%) of dynamic memory, leaving 7,469 bytes for local variables. Maximum is 8,196 bytes.
[Stino - Done building "----" in 0.1s.]
[Stino - Start uploading...]
avrdude: ser_open(): can't open device "\\.\COM4": Access is denied.
avrdude: ser_drain(): read error: The handle is invalid.
[Stino - Exit with error code 1.]
I have been working at this for awhile now and I still do not understand how to fix this. Please help.