Parallel Port Pins High/Low
-
- Posts: 9
- Joined: Tue Jul 28, 2009 4:53 am
Parallel Port Pins High/Low
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.
-
- Posts: 2
- Joined: Sun Sep 20, 2009 12:50 pm
Re: Parallel Port Pins High/Low
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]
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]
- Attachments
-
- LPT.7z
- (17.79 KiB) Downloaded 499 times
Re: Parallel Port Pins High/Low
Nice plugin!
Could you please explain how to read the pins?
(Want to see if my garagedoor is open or closed)
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
Hi,
If you want to read the bit, a following command should be added to the plugin (at the end):
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
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]"sjolof wrote:Nice plugin!
Could you please explain how to read the pins?
(Want to see if my garagedoor is open or closed)
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)
Code: Select all
self.AddAction(Read)
Regards
Prinz
Mein HTPC:
Mainboard: Gigabyte GA-G33M-DS2R
CPU: Intel E5200
OS: WinXP SP3
Graphic card: NVIDIA GeForce 210 512MB
TV-Cards: 2 * Digital Everywhere FloppyDTV-C, Terratec Cinergy 1200 DVB-C
HTPC software: DVB Viewer / EventGhost
Mainboard: Gigabyte GA-G33M-DS2R
CPU: Intel E5200
OS: WinXP SP3
Graphic card: NVIDIA GeForce 210 512MB
TV-Cards: 2 * Digital Everywhere FloppyDTV-C, Terratec Cinergy 1200 DVB-C
HTPC software: DVB Viewer / EventGhost
Re: Parallel Port Pins High/Low
Thanks!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.Code: Select all
self.AddAction(Read)
Regards
Prinz
I hope I can give it a try in the weekend.
Re: Parallel Port Pins High/Low
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:
i want it to change in this:
i get this error:
i'm new to phyton script so excuse me if it is something stupid
thanks in advanced
Diabl0
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)
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)
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
thanks in advanced
Diabl0
Re: Parallel Port Pins High/Low
The else-statement must start in the same column as the if-statement it belongs to. In your case i think it must beDiabl0570 wrote:i want it to change in this:i get this error: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)
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
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
thanks that worked!
Re: Parallel Port Pins High/Low
can I use this plugin with a ParallelPort Relay Controller?
Re: Parallel Port Pins High/Low
Also interested in doing this with a parallel port relay I saw on Ebay, anyone know if this should work? Thanks