Solved

ON/OFF Fan/Bulb in VB

Posted on 2004-03-22
6
364 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 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now