Solved

ON/OFF Fan/Bulb in VB

Posted on 2004-03-22
6
370 Views
Last Modified: 2013-12-25
Hi,

Can enlight or forward me code reguarding ON/OFF Fan or Bulb in VB.

Thnaks in advance.
0
Comment
Question by:vb_asp_master
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 10655654
There are no Fan or Bulb objects in VB. On/Off could be a Boolean Type.

I think you need to give a bit more explanation.
0
 

Author Comment

by:vb_asp_master
ID: 10655721
Fan & Bulb are Harware device which can connect to PC through Parallel port or Serial port or any Logi card provided.

Can any of u forward Sample code & Document reference how it manage, i.e from PC how it possible.

Bye/
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 10656128
The code would depend on which port on the PC end is used and on the controller device at the other end.
If you used the serial port the the MSComm control would be best.
Fans and bulbs are simple electrical components so they would need to be switched using some sort of device which understands the RS232 protocol.
0
 
LVL 11

Accepted Solution

by:
bingie earned 500 total points
ID: 10662045
The easiest way to do this is by using the Parallel Port.

I use NTPORT to communicate via the parallel port. It is very easy to use. All you have to do is install it and add the componant to your project.

You can download it here: http://www.download.com/3001-2070_4-9604068.html?idl=n

The download file comes complete with all code examples, but here they are:

To output data on the data lines, which is what you need to do.

NTPORT1.address = 888   'address for data lines
NTPORT1.bitsize = 8          
NTPORT1.value = 1           'activate D0 line...output in decimal

This will turn on the line, which outputs approximatly 5 volts DC. This 5 V can be used to turn on an AC or DC device.

=-=-=-=-=-=-=-=-  DC DEVICE =-=-=-=-==-=-=-=-=-=

For a DC device, which is any device that takes batteries, you need to connected the 5v to a voltage amplifier to amplify the voltage to the required voltage and current needed to run the device. The port by its self cannot run the device, due to a lack of current. Thus, the 5v line will be used to activate a control circuit which will provide the necessary DC power.

=-=-=-=-=-=-=-=-  AC DEVICE =-=-=-=-==-=-=-=-=-=

For an AC device, any device connected to the wall outlet, you will need to use a Triac to control the power to the device. The 5 V can be used to control the gate, which turns on the triac, allowing the device to have power.

If you can post you home line level voltage (110V or 220V) and the type of load you want to control, whith power requirements, i can draw you a circuit.

bingie
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question