how to control lights with parallel port

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
rondacosta
Newbie
Posts: 2
Joined: Wed Jul 04, 2012 3:36 pm

how to control lights with parallel port

Post by rondacosta » Wed Jul 04, 2012 4:03 pm

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

User avatar
burger2227
Veteran
Posts: 2420
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 » Wed Jul 04, 2012 9:27 pm

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.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0

rondacosta
Newbie
Posts: 2
Joined: Wed Jul 04, 2012 3:36 pm

Post by rondacosta » Fri Jul 06, 2012 7:33 am

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.

User avatar
burger2227
Veteran
Posts: 2420
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 » Fri Jul 06, 2012 11:15 am

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.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0

iamdenteddisk
Veteran
Posts: 185
Joined: Mon Jun 30, 2008 4:10 pm

Post by iamdenteddisk » Fri Aug 10, 2012 4:19 pm

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

Post Reply