Communicating with a PC
dphens
Posts: 10
Hi all,
I don't have a propeller yet, but I am hoping someone can give me some simple examples of how a Propeller could communicate with a PC over TCP or UDP. One example of what I want to do is having a command sent to a PC whenever I press a button or toggle a switch.
I am very new to this, so I hope what I am asking makes sense.
I don't have a propeller yet, but I am hoping someone can give me some simple examples of how a Propeller could communicate with a PC over TCP or UDP. One example of what I want to do is having a command sent to a PC whenever I press a button or toggle a switch.
I am very new to this, so I hope what I am asking makes sense.
Comments
Welcome to the Propeller, (and the forums)..
Question: What type of connection do you intend between the Propeller and your PC? A serial (programming) connection is already present which you could use readily. An Ethernet connection might lead you toward the Spinneret product which is a combination of Propeller and Ethernet.
OBC
That's one thing I am trying to determine. I know that I can send commands to the software using a TCP address/port or by UDP. I don't know from where (USB, Serial, ethernet) I would be sending them at this point. Can a USB or Serial port send to TCP or UDP?
OBC
Being completely new to microcontrollers and programming, I am having a hard time determining on my own if this possible with the Propeller. If it is, I am willing to purchase one and invest the time needed to learn how it all works and how to accomplish this project.
Thanks!
What simulation software do you have?
I have some RC (Radio Control) flight software that I have done simular things with in the past.
Their are a few options that you can do to make this work on option is have real world switches and indicators wired to your Propeller and have it send the signals to the PC via most any communication but USB would be rather easy to do if its setup as a virtual serial port on the PC side.
The PC could have a background program running that when the Prop sends it data it could issue your simulation software keystroke commands just like you was pressign the buttons on the keyboard.
Also some simulation software allows remoting via a custom software program and the keystroke method is not needed. let us know what the sim software is and we might be able to help more.
I currently use Microsoft's Flight Simulator and Eagle Dynamics A-10C Warthog sim. Both allow input and output but in different ways.
That's exactly what I'd like to do. My main focus is the A-10c sim at the moment and it uses LUA for sending and receiving these signals (something else I am learning about).
I think either of these would work, but the second option using some custom software would seem most flexible. I have learned that the sim is using a LUA interpreter to send/receive data over a TCP port. I am still trying to learn and understand the specifics about this as well.
I am a bit over my head in all of this, but hope to determine if it's possible and then learn about all the pieces needed to make it work.
I'm not really sure how much of a "beginner" you are, so sorry if this is all simple stuff to you. :-)
http://luaforge.net/projects/luasys/
I am a complete beginner really, so thanks for the link to the tutorial! I'll be going through that. I did code a couple very simple programs in VB years ago, but I've forgotten everything I had learned, so I am starting all over.
martinh - yes, that is my understanding. Thanks for the link!
I found that the Eagle Dynamics Sim software on startup actually start a file called Export.lua which allows the sim software to export/import its data from a socket connection.
Nowing that you could use the propeller to send data over a USB-Serial connection to say a custom VB.net program that would then allow you to pass that info to a TCP/UDP socket connection to the Eagle Dynamics Sim software.
One cool option with the custom Vb.net program you can add mutiple monitors like the real bird you are simulating and the extra screens could be setup as a moving map display or even use a touchscreen monitor skys the limit.
Or you should be able to use the Spinneret Web Server and make a connection directly with the ED Sim software
You might not be aware what the Spinneret Web Server is it is a Propeller board that allows ethernet comunication.
Example to set your rudder to the right .5 is like this
LoSetCommand (3, 0.5)
You should be able to use a terminal program like hyperterminal to setup a socket connection and send the above command to the Sim software to test the commands out that you want.
If you need a list of commands let me know I will help as much as I can.
Thanks again! If you don't mind, I may PM you about the command list once I reach a point where I need that.
Dave
Great! Looking forward to seeing that!
Thanks! My project won't have a motion platform, but I do hope to eventually have working guages.
Here are some sites for you to read through the first is really helpful.
http://www.digitalcombatsimulator.com/en/dev_journal/lua-export/
http://w3.impa.br/~diego/software/luasocket/
http://lua-users.org/wiki/SerialCommunication