Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ON/OFF Fan/Bulb in VB

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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

722 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