473,396 Members | 1,913 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Turning Lights On with Computer

I wanted to make a program to turn on my bedroom lights. I wanted to use the serial port, and i need to know a function that handles serial port outputs. I wanted to give either 0 or 1 at the output of a single pin, then i would make a circuit that let AC go through the wires if the computer returned 1 via such pin. I need to know what function can handle this, this would be great for learning but also it would be awesome to turn on the lights trough the computer! Imagine, using serial port i could turn on many devices, lights, tv, dvd player and a lot more! It would be great, please help me here!

Help is much appreciated.

Paul.
Thank You a lot!
Aug 28 '07 #1
8 2350
Banfa
9,065 Expert Mod 8TB
What OS are you using?

Also what you are suggesting is not a real use for a serial port, I guess you probably could toggle one of the ports control lines to get you 0 or 1 but it is hardly serial programming.

Serial programming would be connecting the port to a digital io module and reading/writing data via RS232..
Aug 28 '07 #2
I wanted to make a program to turn on my bedroom lights. I wanted to use the serial port, and i need to know a function that handles serial port outputs. I wanted to give either 0 or 1 at the output of a single pin, then i would make a circuit that let AC go through the wires if the computer returned 1 via such pin. I need to know what function can handle this, this would be great for learning but also it would be awesome to turn on the lights trough the computer! Imagine, using serial port i could turn on many devices, lights, tv, dvd player and a lot more! It would be great, please help me here!

Help is much appreciated.

Paul.
Thank You a lot!
this sounds a little difficult. you might just want to use an X-10 system, there is probably a version for your OS
Aug 29 '07 #3
When you say it is not necessary to use serial port you are right, but i really want to avoid using parallel, and i don't know any other ports i could use. All i need to know is a function to handle serial port outputs. I searched info about it but i cannot get anything interesting. All the help i need is what function i can use in c++. Please help me. I really want to make this work!!
Aug 29 '07 #4
Banfa
9,065 Expert Mod 8TB
When you say it is not necessary to use serial port you are right, but i really want to avoid using parallel, and i don't know any other ports i could use. All i need to know is a function to handle serial port outputs. I searched info about it but i cannot get anything interesting. All the help i need is what function i can use in c++. Please help me. I really want to make this work!!
You still haven't said which OS you are using. There are no standard library functions for handling serial ports (because so many platforms don't have/need them).
Aug 29 '07 #5
It should work under Windows XP
Aug 30 '07 #6
Banfa
9,065 Expert Mod 8TB
When you say it is not necessary to use serial port you are right, but i really want to avoid using parallel, and i don't know any other ports i could use. All i need to know is a function to handle serial port outputs.
I didn't say that it was not neccessary to use the serial port, I said that this was not a proper use of it. The serial port does not really have outputs in the way you want to handle them, what you should do if you want to do this is connect a serial IO device, like those available from Weeder Technologies to your port and send RS232 data in the normal way to the device.

However it you really want to do it your way then you will need to look at the communication function reference (ExxcapeCommFunction looks like your only option) as well as looking up the functions CreateFile, ReadFile, WriteFile and CloseHandle on the MSDN website.
Aug 30 '07 #7
JosAH
11,448 Expert 8TB
It should work under Windows XP
As already suggested above, use one or more X10 units. You don't want those poor
5Volt thingies next to those 110/220V wires.

kind regards,

Jos
Aug 30 '07 #8
As already suggested above, use one or more X10 units. You don't want those poor
5Volt thingies next to those 110/220V wires.

kind regards,

Jos
Thanks for your post, but i didn't mean that. I meant using serial port as a signal. I will make a device that lets 110/220v turn on the lights only if serial port sends a positive signal. I am not using serial to turn on the lights under any circumstances! I need a function that sets voltage in serial pins to high or low when i want. That's what i need. Just to tell my device whether it should turn on the lights or not. Thank you all for your help!
Sep 6 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Macca | last post by:
Hi, I would like to create a control that looks like a set of traffic lights. This will output alarm states and if the user clicks on the control it will open up a dialog that gives more...
1
by: Wayfarer | last post by:
XP Pro w/SP1 IIS 5.1 Microsoft.NET Framework 1.1.4322 Two things: -- 1. I'm currently converting from ASP to ASP.NET. I used Microsquash's Migration Assistant and, after trying to run the...
0
by: Siew-Ming | last post by:
Hi, Try to figure a way to turn off a folder Read-only property for a specific folder (Windows 2003) at multi sites. When we do our application upgrade/patch, we manually turn off the...
1
by: ALIABBAS J PETIWALA | last post by:
N -ROOM LIGHTS PROBLEM ======================== THERE IS A BIG SQURE ROOM OF SIDE N WHICH CONSISTS OF N X N SMALLER SQUARE ROOMS(ARRANGED LIKE CHESS BOARD) EACH ROOM HAS A LIGHT. WHEN the...
4
kestrel
by: kestrel | last post by:
I have a Sony Vaio FS920. My OS is Windows XP Home Edition Version 2002 Service Pack 2 Recently (starting 2 months ago), my computer has been freezing up and turning one solid color. The first...
0
by: Now You Know | last post by:
Best Christmas Lights Decoration Sale Installation in Los Angeles 818-386-1022 (These types of Innovative lights will definetly add to your Christmas decor) Here are the tips to use: The most...
0
by: Now You Know | last post by:
Best Christmas Lights Decoration Sale Installation in Los Angeles 818-386-1022 (These types of Innovative lights will definetly add to your Christmas decor) Here are the tips to use: The most...
0
by: Now You Know | last post by:
Christmas Lights installation Holiday Decoration Los Angeles 310-925-1720
0
by: info | last post by:
Christmas Lights Installation Los Angeles, Beverly Hills, Santa Monica, Culver City, Marina Del Rey, Calabasas, Agoura Hills Thousand Oaks Holiday Lights Installation 1-310-925-1720...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.