printing ASCII and 3 variables to RS232 to control video mixer

Hello,

Im trying to have easier access to a couple settings on a production video mixer. v440HD.

I have the addresses of the parameters I want to control. And my goal would be to put an arduino in a lil project box, dc power, and a couple pots that can control the settings.

I ordered already in advance an rs232 board for an Arduino.HERE

Can someone point me in the right direction. I haven't dealt with serial communication in a long long time. This seems like a simple enough project.

my main thing is that it needs to just operate on some code and not be connected to a computer once programed.

thanks so much. code, tutorials, everything is helpful.

example of parameter from manual
zoom -
midi address = 0x0200A06
rs232 address = 0x0A06
parameter range =100-1000

example from manual regarding rs232 remote connection.

A command consists of an ASCII code sequence containing “stx,” three uppercase letters of the alphabet, and a semicolon (“;”). The three letters of the alphabet indicate the command type. If the command has an argument, a colon (“:”) is inserted between the two letters of the alphabet and the argument. When multiple arguments occur, they are separated by commas (“,”).
“stx” This is the ASCII code signal name (code number 02H [hexadecimal]) and code that signals the command start.
“:” This is the code used by the Presenter to separate the command and its arguments.
“;” This is the code used by the Presenter to signify the end of a command.
Example 1) When transmitting the A-BUS channel select command → the ASCII code string stxSIA; is transmitted.
Example 2) When setting the SD section P in P horizontal placement at 50%, vertical placement at 25%, and size at 50% → the ASCII code string stxSPI:50,70,95; is transmitted.

THIS is the parameter im looking at.

stxHPI:a,b,c;
a: P in P horizontal position (%) (-40 to 40)
b: P in P vertical position (%) (-40 to 40)
c: P in P size (%) (20 to 100)
This makes the settings for the P in P currently being displayed. ACK is returned by the V-440HD upon proper reception of the command.

trying piece together from other code.. I don't think im referencing my values correctly when trying to do the serial.print.

am I even close?

/*

  • SerialOutput sketch
  • Print numbers to the serial port
    */
    void setup()
    {
    Serial.begin(9600); // send and receive at 9600 baud
    }
    int potPin = 2; // select the input pin for the potentiometer
    int val2 = 0; // variable to store the value coming from the sensor
    int potPin = 3; // select the input pin for the potentiometer
    int val3 = 0; // variable to store the value coming from the sensor
    int potPin = 4; // select the input pin for the potentiometer
    int val4 = 0; // variable to store the value coming from the sensor

void loop()
{
val = analogRead(potPin); // read the value from the sensor
Serial.print("stxHPI:(val2),(val3),(val4)");

}

int potPin = 2;
...
int potPin = 3;
...
int potPin = 4;

So the final number for the potPin is A4 ?

Better name them someting like pot1Pin, pot2Pin, and pot3Pin.

Serial.print("stxHPI:(val2),(val3),(val4)"); // don't think this is even possible

I don't fully understand your story. I would first concentrate on reading the pots.
The important thing there is how many different values you want.
Example: 0 to 100% is 101 values, and -40 to +40 would be 81 values.
There are 1024 values available with a 10-bit A/D.
The map() command can reduce that to the number needed.
Leo..

Thank you for the response. I should have noted that im comfortable figuring the mapping part out. and have done it in the past. I know I have to do scaling on the pots.

im more concerned with what to write and how to write out to the rs232 connection and mixer with the variables.

/*

  • SerialOutput sketch
  • Print numbers to the serial port
    */
    void setup()
    {
    Serial.begin(9600); // send and receive at 9600 baud
    }
    int pot1Pin = 2; // select the input pin for the potentiometer
    int val2 = 0; // variable to store the value coming from the sensor
    int pot2Pin = 3; // select the input pin for the potentiometer
    int val3 = 0; // variable to store the value coming from the sensor
    int pot3Pin = 4; // select the input pin for the potentiometer
    int val4 = 0; // variable to store the value coming from the sensor

void loop()
{
val2 = analogRead(pot1Pin); // read the value from the sensor
val3 = analogRead(pot2Pin); // read the value from the sensor
val4 = analogRead(pot3Pin); // read the value from the sensor
val2 = map(val2, 0, 1023, 0, 80);
val3 = map(val3, 0, 1023, 0, 80);
val4 = map(val4, 0, 1023, 0, 101);

Serial.print(stxHPI:(val2),(val3),(val4)); // THIS IS where im lost. I can debug and accomplish the map/read

}

something with the print vs printIN, but im not understanding. ??

println adds a carriage return and line feed. Leave it out if your receiving device does not expect it.

If I understand your story correctly,
then you also need to set up SoftwareSerial for your RS232 board.
You can't just use the default TX/RX pins, because they are already used by the USB<>Serial chip.
Look at the SoftwareSerial examples that come with the IDE.
Which Arduino are you planning to use.
Example (untested) attached.
Leo..

#include <SoftwareSerial.h>
SoftwareSerial videoSerial(10, 11); // RX, TX
int value1, value2, value3;

void setup() {
  Serial.begin(9600); // serial monitor
  videoSerial.begin(9600); // RS232 board
}

void loop() {
  value1 = map(analogRead(A2), 0, 1023, 0, 80); // 81 values
  value2 = map(analogRead(A3), 0, 1023, 0, 80);
  value3 = map(analogRead(A4), 0, 1023, 0, 101); // 102 values

  // printing to serial monitor for debugging
  Serial.print("value1: ");
  Serial.print(value1);
  Serial.print("\tvalue2: ");
  Serial.print(value2);
  Serial.print("\tvalue3: ");
  Serial.println(value3);

  // videoSerial.print(xxxxxxx); // print or write to the RS232 board here
}