Please help me to solve my problem.
I´m sending "!" to serial port, no problem with that, but I need to check if I get the same character "!" in return before I can send my string.
I want to send "!" maximum 5 times (100msec in between).
If I get "!" in return in less then 5 tries then I could use "Jump" - (If last action successful) and send rest of my string.
But how can I check that I get "!" in return? (read serial port - python script ?) and how to limit to maximum 5 tries?
I would be really happy in someone could help me out!!!
Using Pythonscript with eg.result and Read Serial Port...
- Bitmonster
- Site Admin
- Posts: 2239
- Joined: Mon Feb 06, 2006 10:28 pm
Re: Using Pythonscript with eg.result and Read Serial Port...
Untested:
Code: Select all
Serial = eg.plugins.Serial
for i in range(5):
Serial.Write("!")
# read one byte with 0.1 sec timeout
answer = Serial.Read(1, 0.1)
if answer == "!":
eg.result = True
eg.Exit()
eg.result = False
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
Re: Using Pythonscript with eg.result and Read Serial Port...
Bitmonster: Thanks for quick reply...
Sadly it didnt work.
Got theese messages:
----------------------
Python Script
Traceback (most recent call last):
Python script "24", line 4, in <module>
Serial.Write("!")
File "C:\Program Files\EventGhost\plugins\Serial\__init__.py", line 269, in __call__
AttributeError: 'NoneType' object has no attribute 'write'
----------------------
Any idea someone ???
Thanks in advance!!!
*** Update: Seems to be working on another installation... Must check this further... I will come back with results ***
Sadly it didnt work.
Got theese messages:
----------------------
Python Script
Traceback (most recent call last):
Python script "24", line 4, in <module>
Serial.Write("!")
File "C:\Program Files\EventGhost\plugins\Serial\__init__.py", line 269, in __call__
AttributeError: 'NoneType' object has no attribute 'write'
----------------------
Any idea someone ???
Thanks in advance!!!
*** Update: Seems to be working on another installation... Must check this further... I will come back with results ***
- Bitmonster
- Site Admin
- Posts: 2239
- Joined: Mon Feb 06, 2006 10:28 pm
Re: Using Pythonscript with eg.result and Read Serial Port...
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!