Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ON/OFF Fan/Bulb in VB

Posted on 2004-03-22
6
Medium Priority
?
375 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
  • 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

916 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