Go Down

Topic: Control Serial Devices (Read 585 times) previous topic - next topic

Brooks

Does anyone have any suggestions on interfacing with a projector?  

I would like to send a serial commands to a projector via the press of button on the arduino.  

I have sent strings to the device using a max232.  I would like to program multiple buttons to perform specfic tasks such as turn projector on or off and switch between sources.  

I have not been able to find any sketches that would allow a button to trigger a stored ascii string.



fdufnews

You have the idea.
Code it.
We will help you to troubleshot your code if any problem.

IamGoogle

Here is a starting point:

if button 1 = high
Serial.print("ASCII")

ect

start by writting in plain language and then people can help.

Here is an example:

Setup
button 1 = lamp on
button 2 = lamp off
button 3 = input 1
button 4 = input 2
button 5 = shutter close

loop
if button 1 = pressed
send "lamp on"
if button 2 = pressed
Send "lamp off"
if button 3 = pressed
send "input 1"
if button 4 = pressed
Send "input 2"
if button 5 = pressed
send "shutter"

I would suggest looking at the "button" example file to understand how to setup the inputs. From there replace the button action with your serial commands.

Groove

Quote
if button 1 = high


Oh dear!  :o
Per Arduino ad Astra

BillHo

Code: [Select]
 if (button1State == HIGH)    
     Serial.println("lamp on");


Brooks

Thanks this is information is very helpful.  I will work on this tonight and post the code.

pwillard

Quote
Oh dear!  Shocked


To be fair... he did indicate he was writing pseudo code first... which is a good idea for anyone new to this stuff.

The thing you need to decide is if you want to be able to DEBUG with USB and send to device at the same time.  If so, you might need to look into the SOFTSERIAL library as part of the solution.

Go Up