Error in Serial Port opening/closing

Hi everyone,

I'm brand new to Arduino and have been going through the beginner projects book. When I try to get my Arduino to print to the IDE's Serial Monitor, I get the following error messages:

[12/26/2015, 11:43:32 AM] - [arduino ide - serial monitor] Error in serial port opening: Argument 0 (port) is null or undefined but it must be not null.
[12/26/2015, 11:43:41 AM] - [arduino ide - serial monitor] Error in serial port closing: Cannot call method 'close' of null

The code is the "Love-o-meter" in the projects book.

It uses:


and later:

Serial.print("Sensor Value: ");



where "sensorVal" is a variable storing the analog temp sensor input
and "temperature" is a variable based on "sensorVal"

I hope this all makes sense. Help would be much appreciated!



Did you select the correct COM port in the Arduino IDE ( Tools -> Port ) ?

Hi Guix,

Yes, I have the COM selected, in my case COM3.

I'm also noticing in the code that "Serial" doesn't show up as a color, as if the IDE doesn't recognize the command. Is this normal?

No it should show red. This isn't a programming problem, so you should ask in Installation & Troubleshooting. Sorry, I can't help you more than that :confused:

If your pc is a windows machine, go into device manager serial devices and see if the arduino is identified as a com port.