I'm trying to get Python to read connect to an Arduino Uno on Serial port 3 so that would be COM3 in the python code. I am using Python33, The latest version on Arduino and pySerial 2.7. This is the code for the Arduino:
void setup() {
Serial.begin(9600); // set the baud rate
Serial.println("Ready"); // print "Ready" once
}
void loop() {
char inByte = ' ';
if(Serial.available()){ // only send data back if data has been sent
char inByte = Serial.read(); // read the incoming data
Serial.println(inByte); // send the data back in a new line so that it is not all one long line
}
delay(100); // delay for 1/10 of a second
}
And this is the python code:
import serial
ser = serial.Serial("COM3", 9600)
then I get this error:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
ser = serial.Serial("COM3", 9600)
File "C:\Python33\lib\site-packages\serial\serialwin32.py", line 38, in __init__
SerialBase.__init__(self, *args, **kwargs)
File "C:\Python33\lib\site-packages\serial\serialutil.py", line 282, in __init__
self.open()
File "C:\Python33\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 'COM3': FileNotFoundError(2, 'The system cannot find the file specified.', None, 2)
This is probably something easy to fix and I have looked pretty much everywhere and I still can't seem to find the answer to the problem.