Hello!
I’m trying to make a proyector turn on and off only when the openFrameworks application I’m programming tells it to. Is this possible? I’ve been reading a bit about this and I know oF has a directory called OF_serialTest but I don’t know where to start.
First of all, Serial or RS-232, are they the same?
Also the manual that came with the proyector says it is possible and shows me code like this.
Name Op. Type CRC Header Command Response
Power ON BE, EF, 10, 05, 00, C6, FF, 11, 11, 01, 00, 01, 00 06
i have done this with a benq projector.
i connected this guy http://www.sparkfun.com/products/449 to an arduino and the arduino to my computer.
the computer communicated to the arudino through the regular of_serial.
the ardunio communicated to the RS232 Shifter of the software serial lirbray on pin 2/3.
Thanks stephanschulz!
So the OF_serialTest uses the Arduino as a Serial Port in order to control anything that works with RS-232?
How about if one would like to use just a usb to serial converter? Does oF have an addon for such functionality?
What kind of software serial library do you mean?
I read that there are some crossover serial cables too. How would I know that I need them?
I’m trying out the serialExample that comes with oF but I don’t really know where to start sending the codes.
you can use the same of_serial commands to talk to/via a standard usb to serial adapter. i used to use the keyspan adapter. but i found that such an adapter costs just as much as an arduino.
if i remember right i try using the usb to serial adapter with the rs232 but had too many problems with drivers and such.
i’ve also done this with a computer with an rs232 port directly using ofSerial and also with an ethernet to rs232 converter using ofxTCPSender and it works without problem
Hello again!
I got to control the proyector with an external program and now I would like to learn how to integrate sending serial messages to the proyect using an existing openF project.
I starting by trying to send a string using this part of the serialExample that comes with openF v0.062 and CodeBlocks:
// (1) write the letter "a" to serial:
serial.writeByte('a');
But it didn’t work. I know I have to send a HEX string such as this to turn on the projector:
BEEF100500C6FF111101000100
… but I read about serial.writeBytes(), tried it like the ofserial.cpp files says but it didn’t work and I have no idea how to tell it to send those pairs together. Can it be done in some way? or is the solution I already have the best one?
I’ve never really gotten into this until now so thanks! =D
you can convert the hexadecimal values to decimal and that correspond to an ascii value from 0 to 255 so for example BE is 190 which is ´ EF = ï
but that would be really weird and probably you will have problems with some characters, a better option is to put the hex values in a char array like:
Everything worked just fine and I got every projector command working just as I wanted.
I thank you both very much for your patience. =)
Now I will try to save the world one hex at a time.