Page 1 of 1
Parallel Port Pins High/Low
Posted: Wed Jul 29, 2009 4:31 am
by Chaemelion
I know there have been a few discussions here about parallel port support, but as far as I can tell, they're all about actually connecting devices to them. I was wondering if it'd be possible in upcoming releases add a function to set/read parallel port pins.
Re: Parallel Port Pins High/Low
Posted: Sun Sep 20, 2009 12:56 pm
by NikoMitDaMacht
Yeah i had the same problem so I decided to code a plugin for that.
It is very fundamental and it is my first piece of code in python after a few minutes reading the docs, so don't be supprised that i am using the bitvector class i downloaded somewhere to do the bitcalculations - quick and dirty.
As LPT "driver" I am using the Inpout32 DLL which you can find here
http://logix4u.net/Legacy_Ports/Paralle ... NT/XP.html. Just put it into the folder of your EventGhost executable.
[EDIT]I think i forgot to atach the plugin[/EDIT]
Re: Parallel Port Pins High/Low
Posted: Sun Nov 29, 2009 11:51 pm
by sjolof
Nice plugin!
Could you please explain how to read the pins?
(Want to see if my garagedoor is open or closed)
Re: Parallel Port Pins High/Low
Posted: Mon Nov 30, 2009 9:52 am
by Prinz
Hi,
sjolof wrote:Nice plugin!
Could you please explain how to read the pins?
(Want to see if my garagedoor is open or closed)
I think, a event will be generated, if the status of a pin is changed. The event name should be something like "LPT IN CHANGED
[I/O status]"
If you want to read the bit, a following command should be added to the plugin (at the end):
Code: Select all
class Read(eg.ActionBase):
name = "Reads the Bits"
description = "You won't guess what this action does."
def __call__(self):
return self.inpout.Inp32(0x379)
After the line 19 following instruction must be inserted:
If haven't checked it, I have only modified the given code in the way, which should work.
Regards
Prinz
Re: Parallel Port Pins High/Low
Posted: Tue Dec 01, 2009 8:46 pm
by sjolof
Prinz wrote:Hi,
After the line 19 following instruction must be inserted:
If haven't checked it, I have only modified the given code in the way, which should work.
Regards
Prinz
Thanks!
I hope I can give it a try in the weekend.
Re: Parallel Port Pins High/Low
Posted: Sat Apr 24, 2010 9:49 pm
by Diabl0570
i'm using the plugin now for a while,
i tryd to edit this plugin a little this is the part i want to edit:
Code: Select all
def ThreadLoop(self, stopThreadEvent):
while not stopThreadEvent.isSet():
input = self.inpout.Inp32(0x379)
if self.oldInput != input:
self.oldInput = input
self.TriggerEvent("LPT IN CHANGED " + str(input))
stopThreadEvent.wait(0.1)
i want it to change in this:
Code: Select all
def ThreadLoop(self, stopThreadEvent):
while not stopThreadEvent.isSet():
input = self.inpout.Inp32(0x379)
if self.oldInput != input:
self.oldInput = input
if input == 63:
self.TriggerEvent("LPT PIN 63 is on")
else:
self.TriggerEvent("LPT IN CHANGED " + str(input))
stopThreadEvent.wait(0.1)
i get this error:
Code: Select all
Traceback (most recent call last) (1462):
File "C:\Program Files\EventGhost\eg\Classes\PluginManager.py", line 178, in LoadPluginInfo
File "C:\Program Files\EventGhost\eg\Classes\PluginInfo.py", line 126, in ImportPlugin
File "C:\Program Files\EventGhost\plugins\LPT\__init__.py", line 51
if input == 63:
^
IndentationError: unexpected indent
i'm new to phyton script so excuse me if it is something stupid
thanks in advanced
Diabl0
Re: Parallel Port Pins High/Low
Posted: Sun Apr 25, 2010 8:01 am
by topix
Diabl0570 wrote:i want it to change in this:
Code: Select all
def ThreadLoop(self, stopThreadEvent):
while not stopThreadEvent.isSet():
input = self.inpout.Inp32(0x379)
if self.oldInput != input:
self.oldInput = input
if input == 63:
self.TriggerEvent("LPT PIN 63 is on")
else:
self.TriggerEvent("LPT IN CHANGED " + str(input))
stopThreadEvent.wait(0.1)
i get this error:
Code: Select all
Traceback (most recent call last) (1462):
File "C:\Program Files\EventGhost\eg\Classes\PluginManager.py", line 178, in LoadPluginInfo
File "C:\Program Files\EventGhost\eg\Classes\PluginInfo.py", line 126, in ImportPlugin
File "C:\Program Files\EventGhost\plugins\LPT\__init__.py", line 51
if input == 63:
^
IndentationError: unexpected indent
The else-statement must start in the same column as the if-statement it belongs to. In your case i think it must be
Code: Select all
def ThreadLoop(self, stopThreadEvent):
while not stopThreadEvent.isSet():
input = self.inpout.Inp32(0x379)
if self.oldInput != input:
self.oldInput = input
if input == 63:
self.TriggerEvent("LPT PIN 63 is on")
else:
self.TriggerEvent("LPT IN CHANGED " + str(input))
stopThreadEvent.wait(0.1)
Re: Parallel Port Pins High/Low
Posted: Sun Apr 25, 2010 3:11 pm
by Diabl0570
thanks that worked!
Re: Parallel Port Pins High/Low
Posted: Mon Apr 26, 2010 2:32 am
by bskchaos
can I use this plugin with a ParallelPort Relay Controller?
Re: Parallel Port Pins High/Low
Posted: Tue Dec 28, 2010 9:59 pm
by Tal56
Also interested in doing this with a parallel port relay I saw on Ebay, anyone know if this should work? Thanks