Opening serial port in windows service (Solved)
Hey, this is my "first" time coding anything other than Arduino. I'm trying to create a Windows service to open a serial port to my Arduino, so the Arduino knows when my PC is on or off. So far, so good. I've managed to create a Windows service, and it seems to open the COM port correctly (according to the event log). When the service is running, I'm (as expected) not able to connect to the Arduino via the serial monitor anymore, which further shows that the port is opened by the service.
However, for some reason, the Arduino doesn't recognize that the port is open. The Arduino does correctly recognize it when I open the port using the serial monitor, but not when I open it in the service.
4 Replies
Here is the Windows Service code:
and if it helps the Arduino code, tho im sure it works:
from what i understand you are not really sending data, just monitoring a pin that should change state when port is open?
because i don't exactly remember the default configuration of the serial port from windows but you could need to change it
dunno if it'll help, but i specifically check
Serial.dtr()
to check if a new connection was made
i'm sure i did that for a reason but i can't remember exactly what it was
that's using a MCU with built in USB being used as a serial portThanks for the replies, I figured it out. You have to enable drt on the C# code, for the Arduino to recognize the open port.