Solved

ON/OFF Fan/Bulb in VB

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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
Course of the Month11 days, 13 hours left to enroll

623 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