Go Down

Topic: Projector Control (Read 728 times) previous topic - next topic

LHunter

Hello
I'm looking to control a projector via an RS232 Port.
I have an UNO and a MAX232 - SP3232E IC.

The projector i'm looking to control is a Hitachi. Page 16 of the Technical section shows the 8 bit codes needed to control the projector. see link below
http://www.hitachiserviceeu.com/scripts/userguide.php/CP-A300NMEF_EN.pdf

I am wanting to write code to send commands. This is my first project - be nice :)

I was had started coding this - can anyone tell me if i'm heading in the right direction.
I have coded for the POWER ON command.

Code: [Select]
int digitalInput = 0;   

void setup() {
  // open the serial port at 9600 bps:
  Serial.begin(9600);
}

void loop() {
  // read the digital input on pin 2:
  digitalInput = digitalRead(2);

//power on command

if (digitalInput = HIGH){
  Serial.println('BEEF'); 
   Serial.println('0x03');
    Serial.println('0600');
     Serial.println('BAD2');
      Serial.println('0100');
       Serial.println('0060');
        Serial.println('0100');

  // delay 10 milliseconds before the next reading:
  delay(10);
 
  }
}


Do I need to declare the TX and RX for the system or are pins 0 and 1 automatically selected on the UNO?

Any advice would be great
Thank you
L

AWOL

#1
Apr 21, 2012, 09:52 pm Last Edit: Apr 21, 2012, 09:54 pm by AWOL Reason: 1
Quote
Serial.println('BEEF');

Double quotes for strings.

Why the crazy indentation?

Fortunately for you, pins are inputs by default.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Steen

are you sure you want to do println() ? that sends newline and carriage return with it everytime you send something. i don't think that's what the projector wants to receive, unless you're sure about this, use print()

and what do you want to send with '0060' ? just the numer 60, or something different? because those ' are quite strange in every println command..

PaulS

You want to create an array with values in it:
byte cmd[] = {0xBE, 0xEF, 0x03, 0x06, 0x00, 0xBA, 0xD2, 0x01, 0x00, 0x00, 0x60, 0x01, 0x00};

Then, send this command using
Code: [Select]
Serial.write(cmd, sizeof(cmd));

Go Up