Search Unity

Send data to a serial port?

Discussion in 'Editor & General Support' started by bigkahuna, Jul 14, 2006.

  1. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Is it possible to send data (ie. an object's x, y, z position) to a serial port? Would something like PySerial ( http://pyserial.sourceforge.net/ ) work for this?

    Thanks!
     
  2. jeremyace

    jeremyace

    Joined:
    Oct 12, 2005
    Posts:
    1,661
    You would need Pro and you would need to write a plugin to do it.
    -Jeremy
     
  3. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Thanks. I'm also investigating if it would be possible to pass the information over a network instead of a serial cable. I think the other app (which is Windows only) supports this.
     
  4. elias723

    elias723

    Joined:
    Feb 10, 2006
    Posts:
    178
    You could send it over a network - you just need to learn a little .NET along the way. Or, you could do it a simpler way like putting the data as a string into a guiText item and copy-pasting that (during a pause in the game usage) into a text document, and then move your text doc over the network or onto a USB keyring memory stick. I guess it depends on what exactly you're trying to do with the data.
     
  5. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    I guess I should have been a bit more clear on what I meant by "data". What I'm interested in learning how to do is to pass a "data stream" of numbers from Unity to another application. The application is a GPS (Global Positioning) reader and the data I want to pass is NMEA 1392 (basically a series of text strings sent out at a regular interval, usually every second).

    I know the software supports data though a serial port, and I believe it also can receive it through a network connection, but how that is done I'm not sure yet.

    So what I'm hoping to do is to move an object around the screen and feed it's X,Y position to this GPS app so it can display, in real time, the object's position.
     
  6. elias723

    elias723

    Joined:
    Feb 10, 2006
    Posts:
    178
    In that case, it's beyond me. How are you using this GPS with your game? It sounds interesting.
     
  7. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    I'm not using a GPS in the game, what I want to do is interface software that reads data from a GPS with my sim. I got this to -almost- work in Blender Game Engine, so I'm hoping I'll be able to get it working 100% in Unity.