• Unity: How to access IO ports of a USB connected Arduino through Unity
    2 replies, posted
I have some sensors reading values on a Arduino board. I am trying to read them through unity on a computer. I cannot access the Data pins through Unity at all. After many hours of searching, all the guides I found are really out of date or use some absurd work around solution, like hosting a server on a raspberry pi and sending it over network. Is there a simple solution just to get Unity to read the arduino through USB?
Have you tried talking to the Arudino via the serial/COM port? There's some documentation here. You'd have to write some boilerplate stuff to serialize/deserialize the sensor data on the board by reading the pins then forwarding it to the host PC. You should be able to use the C# SerialPort class (although I've never tried via C# before).
After playing with it for a bit, it seems that Unity changed the location of the net core setting (it needs to be set to 2.0), your first method of using the C# serial port class worked. Enjoy your coins
Sorry, you need to Log In to post a reply to this thread.