I'm new at arduino and I would like to retrieve the data that is sent after pressing a button in a program on my pc.
The program sends a signal through RS-232 serial port to another controller.
Then the other controller sends a response to the pc.
I'm not interested in the response only in the signal that is sent.
What i've tried is connecting the transmit pin (from the serial port pin n°3) to the arduino A0 pin and print the signal that is sent.
I get a bunch of numbers but when i try to rewrite it to A1 (and A1 is connected to the otherside of the cut transmit wire) the program says that the communication is interrupted.
So the connection of the serial is completly the same only the transmit wire is cut and arduino is put in the middle.
What I would like to accomplish is making a universal system for getting data from al of the different controller manufactures.
Are you really using the old fashioned "serial port" on a PC?
If so, the voltages on the TX and RX pins are not compatible with the Arduino and could damage it. Also, the logic levels are inverted. You will need an RS232-TTL serial adapter to correct that situation.
And to answer your question I use RS232 to connect the serial to the usb on the pc.
That is not clear. If you have a USB to RS232 connector then you need a voltage and logic level translator. If you have a USB to TTL serial connector then you do not.
With the code from crossroads i get the following results:
16
0......
So what were you sending? And what did you expect?
Do I do this with the following?:
digitalWrite(1,incomingByte);
Absolutely not.
However your explanation of what you actually want to do is not clear enough for me to understand.
Yes, if you do not have 0-5V levels you need to connect an RS232 chip (such as MAX3232) to the Rx/Tx lines and then look at the TX output with the Arduino's Rx pin.
Uses 0.1uF caps
Or older MAX232, uses 1uF caps, only supports slower speeds