1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

USB Relay not running with Autohotkey

Discussion in 'Relay Modules' started by Paul Schaerer, Jul 12, 2016.

  1. Paul Schaerer

    Paul Schaerer New Member

    Joined:
    Jul 12, 2016
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Location:
    Switzerland
    Hello Comunity.
    I just installed my new USB Relay onto my XP machine.
    Trying with hyperterm was a real success.
    But trying the sample USB Relay.ahk was not.
    I can see two different behavior, depending on sending on/off or read.
    While sending either a on or a off command, the script ends immideately wthout any errormessage, but without reaction of the relayboard.
    If i send a read command, the script hangs somewhere inside the "Read from RS232 Port"
    For me, it looks like the commands are sent correctly to the board, but the board can not read or not understand them.
    Did somebody see this and can help me?
    Kindest regards, Paul
    I just tried to monitor the RS232. Strange.....
    The command "relay on 0" is transmitted as "r.e.l.a.y. " where every dot means a 00 wile transmitted.
    Any ideas?
     
    Last edited: Jul 13, 2016
  2. टिनु

    टिनु New Member

    Joined:
    Jul 13, 2016
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Location:
    Gadag
    Hi Paul,
    it looks like UTF16 is sent over the serial port instead of plain ASCII.
    The following post on the autohotkey forum seems to solve the problem of converting the data, search for Write_to_COM and Read_from_COM functions:
    https://autohotkey.com/boards/viewtopic.php?t=15550
    I guess the read is blocking since the sent message can't be understood by the USB relay and thus it does not answer.
    I hope that helps you solve the problem.
    - टिनु
     
  3. Paul Schaerer

    Paul Schaerer New Member

    Joined:
    Jul 12, 2016
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Gender:
    Male
    Location:
    Switzerland
    Hello
    Thanks for response.
    I tried your tip and was not realy successful. The whole script from the forum works, but is much to slow for me. But you schowed me a way what works for me. Now, i am sending each character separately and this runs. The blocking inside the readrutine was realy because the numato relay was unable to understand my original request and therefore was unable to respond.
    So, my problem seems to be solved.
    Thanks again and regards,
    Paul
     

Share This Page