Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Home Automation - USB Relay Controller

Status
Not open for further replies.

electrolearner

Newbie level 5
Newbie level 5
Joined
Jul 12, 2009
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,331
Hi
I am working on home automation project (for fun ) and trying to control appliances using this **broken link removed** by Protosmart in Visual basic. I have tested the board with provided software & it all works fine.
Also, I tried controlling the relays using hyper terminal and they worked as expected.
Now, I am programming in visual basic (am a beginner) to control the Relays and dont know how to send <ENTER> ?

Relays can be controller by sending very simple commands. For example,

O0=1<ENTER> turns on Relay 1

and I am not sure how to send "enter" key?

I will appreciate any help in this regards.

Thanks

The question is refering to the PC side programming, moved to PC Programming and Interfacing [Alexan_e]
 

The BASIC language has a keyword named INPUT.

Typical syntax is:
INPUT a
or
INPUT a$

The program then halts as you type the keys for the number or letters you want. Then press the 'return' or 'enter' key. The variable is given the value you input.

If you don't want the program to halt, then you cannot use 'INPUT'. Instead you must periodically check for keypresses with a different command. It might be something like 'INKEY' or "GETKEY", etc. This is called polling.

Check your Visual Basic manual to see what code it gives the 'enter' key. It probably has the ascii value of 13 (carriage return).

It may be tricky to use polling. You will have to detect all keypresses.

You'll have to string separate keypresses together. You'll have to store it in a variable, on the chance the next keypress is the 'Enter' key.

Then you'll have to process the string to see if it's made up of letters or numbers, etc.
 
Last edited:

The BASIC language has a keyword named INPUT.
I fear, the question is very unclear. It's actually asking how to send a specific string to the COM port. "<ENTER>" is somewhat misleading, because it obviously means carriage return, or a carriage return/linefeed combination.
 

for the end of line combination you can use vbCRlf, e.g. using the SerialPort component in Visual Studio 2010
Code:
SerialPort1.Write(vbCrLf)
 

for the end of line combination you can use vbCRlf, e.g. using the SerialPort component in Visual Studio 2010
Code:
SerialPort1.Write(vbCrLf)

Many thanks. Exactly what I needed (vbCr).

(I needed <CR> only)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top