Author Topic: serial communication  (Read 13679 times)

jpilarski

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
serial communication
« on: February 25, 2016, 11:14:38 AM »
I am trying to work in a 3dsoftware package called rhino/grasshopper. I've made an interface that samples the onscreen geometry into points and formats the points for the laser shark into the proper string. I then send the formated strings via serial through a paired virtual com port. I use the following command to grab the streaming points COPY COM2 CON | lasershark_stdin.exe. This seems to work or at least the shark launches and in the cmd I see the strings but it doesn't move. I believe it has to do with not having an enter at the end of each line or some such formatting issue. We also tried the same process but with a udp sender and receiver but the same thing happens which is the shark launches and all the commands are sent to cmd but the shark doesn't move. There are no errors in the prompt and I can quit the command with cntrl-c as expected. Basically I need some means of realtime playback. Do you have any ideas or thoughts

Macpod

  • Administrator
  • Full Member
  • *****
  • Posts: 179
  • Karma: +3/-0
    • View Profile
Re: serial communication
« Reply #1 on: February 25, 2016, 08:57:00 PM »
When you say "I see the strings", what are you referring to? Do you mean you have p= print command lines?

Have you tried piping the output to a file instead of lasershark_stdin.exe and reviewing/verifying the format there?

You say the galvos aren't moving. Is the laser not turning on/off too?

jpilarski

  • Newbie
  • *
  • Posts: 11
  • Karma: +0/-0
    • View Profile
Re: serial communication
« Reply #2 on: February 26, 2016, 02:42:09 AM »
Yes, I can make a text file and pipe it in so the formatting is good. When I stream the proper commands to the lasershark via serial (string of commands) it doesn't enable but it doesn't give any errors either. The streaming commands show up in cmd as if I typed them and they look correct but since there is no \n in the formatting, or at least I am guessing that is the issue, it's as if the enter key is never pressed. I was wondering if you can help me add something such as this into your application serial.Write("abcd\r\n"). Then I can add abcd to the end of each command r=1000abcd  it adds a CR and LF. I am not so well versed in programming so I hope what I am asking you about makes sense. If this works I can assure you the results will be really cool since rhino/grasshopper will generate all the points needed in real time to make a nice 3d light show.

Macpod

  • Administrator
  • Full Member
  • *****
  • Posts: 179
  • Karma: +3/-0
    • View Profile
Re: serial communication
« Reply #3 on: February 27, 2016, 12:50:16 AM »
Yes, I can make a text file and pipe it in so the formatting is good.
To confirm, you are generating this file by piping the output of your serial command to a file. You are then piping this file to the lasershark_stdin.exe app and it is working as expected?

This is a very important step to perform as it should indicate exactly what is going on.

When I stream the proper commands to the lasershark via serial (string of commands) it doesn't enable but it doesn't give any errors either. The streaming commands show up in cmd as if I typed them and they look correct but since there is no \n in the formatting, or at least I am guessing that is the issue, it's as if the enter key is never pressed.
It sounds like you are piping in data from an Arduino? I would prefer to have a sample copy of the output to identify what it is going on first before modifying the protocol. You can pipe the text from the arduino to a text file, zip it, and then attach it here.