Pages: [1]   Go Down
Author Topic: Projector Control  (Read 519 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley

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:
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
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24284
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Serial.println('BEEF');
Double quotes for strings.

Why the crazy indentation?

Fortunately for you, pins are inputs by default.
« Last Edit: April 21, 2012, 02:54:35 pm by AWOL » Logged

"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.

Belgium
Offline Offline
Full Member
***
Karma: 0
Posts: 187
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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..
Logged


Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 547
Posts: 45976
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
Serial.write(cmd, sizeof(cmd));
Logged

Pages: [1]   Go Up
Jump to: