Arduino program to send switching commands to aten video switch VS0401 through RS232 to TTL converter.
This is the Arduino program i have uploaded to Arduino UNO r3
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX pins for the TTL converter
void setup() {
// Set up the TTL serial communication
mySerial.begin(9600);
// Wait for the TTL serial communication to be ready
delay(1000);
}
void loop() {
// Send the command to the Aten video switch
mySerial.write("swi01\r\n"); // Sends command to switch input to port 1
// Wait for the Aten video switch to respond
delay(1000);
// Read any response from the Aten video switch
while (mySerial.available() > 0) {
char c = mySerial.read();
Serial.print(c);
}
}
Welcome to the forum
Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'
Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination
Can u help me that how to communicate with ATEN video switch VS0401 through RS232 to TTL converter using Arduino program
Do you have the interface specification available?
For Aten video switch VS0401 it will accept only
"swi01,swi02,swi03,swi04" these commands for switching it's ports and i am trying to send these commands via Arduino program. But when I connected ATEN video switch directly to PC via COM port , aten is accept these commands. Please suggest something
try and change
mySerial.write("swi01\r\n"); // Sends command to switch input to port 1
to
mySerial.println("swi01"); // Sends command to switch input to port 1
and check what happens.
If you can provide a user-manual the users here will be able to help.
What does the user manual say about the specification of the serial interface?
Also checked these .It will only print the command on serial monitor but aten doesn't change its port
what does the user-manual say about the specification of the serial port?
What baudrate?
what number of databits?
what parity?
hardware flow-control yes/no?
This is the user manual for ATEN video switch
inside this manual you have the specifications
Yes
adjust your code according to the specifications
Make sure you have the RS-232 wiring correct, if you are using the same cable to connect to the RS2232-to-TTL converter as you used for the PC, there is a high probability that the RS232 Tx and Rx lines are crossed.
Just check the baud rate bro...in code i set 9600
But in rs332 baud rate is 19200
Which would i choose
I have used seperate cable for PC to aten and rs232 to TTL to aten
The baudrate shown in the
specification of your device
You need Serial.begin() in setup().
They didn't give the baud rate for Aten they give only for RS232