Page 1 of 1

how to control lights with parallel port

Posted: Wed Jul 04, 2012 4:03 pm
by rondacosta
Hi all, couldn't find related postings on this site.
I need to learn how to use Qbasic.4.5 under Windows 98SE to control individual lights using the parallel port (ECP).
1. just downloaded Qbasic.
2. my Basic programming skills are 20+ years in the freezer
3 I have the hardware for 8 115VAC controlled outlets,,,, all I need is how to use Qbasic to turn individual pins on, off, and query their status at any given time.
4. Out of this learning I hope to be able to apply #3 in a future home perimeter security program.
Any help with (basic) examples of the three functions I want to accomplish would be greatly appreciated. That would be my launching pad.
The one thing I need to clarify is if when turning a pin on, it will stay so until turned off, or, the program has to maintain it on constantly via a loop....
Thanks, Ron

Posted: Wed Jul 04, 2012 9:27 pm
by burger2227
Well you are not gonna run 110 volts through ANY port on a computer so you need 8 Optical chips and relays on a LPT port.

Download my Q-basics demo program in my signature and run it in QB. Chapter 11 part 6 covers parallel ports! I must WARN you
that the port can only run LEDs, not relays so you will need an external power supply no matter what programming language
you decide on.

INP and OUT are the best ways to deal with parallel ports! You could try QB64 on a newer machine. It won't run on a 98.

Posted: Fri Jul 06, 2012 7:33 am
by rondacosta
thanks burger2227 for your reply.
I fully agree on all points you made about using 110vac on/with a parallel port. I will investigate the chapter you mentioned on your demo program in about a week's time.
Since you mentioned "QB64 on a new machine", question: parallel ports are not available in most computers anymore, any idea or suggestion on how can I create 8 individually controlled ports out of USB, the only port available? Thanks again.

Posted: Fri Jul 06, 2012 11:15 am
by burger2227
You can buy a parallel port like one of these:

http://www.newegg.com/Product/Product.a ... 6815166031

or a USB parallel port. I can help you with using it on QB64.

Please follow the instructions in my Qbasic11.BAS module for using relays. Opto-Isolators keep current draw low.

Posted: Fri Aug 10, 2012 4:19 pm
by iamdenteddisk
if you can switch and power LED's using the port, you can use them to activate light sensitive night-lights to run many high voltage low current appliances also you can use lamp-dimmers to control current in these optically isolated circuits.

still maintain voltage/current ratings and do not exceed capacity's..

safety first..TTFN