User Tools

Site Tools


ha:sr201

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
ha:sr201 [11/07/2023 12:26] – created - external edit 127.0.0.1ha:sr201 [16/06/2025 23:15] (current) – [Testing from BASH] andrew
Line 22: Line 22:
 on the header next to the RJ45 connector.  CLR is adjacent to the +5V on the header next to the RJ45 connector.  CLR is adjacent to the +5V
 and P30 pins. and P30 pins.
-    + 
 + 
 +===== Testing from BASH ===== 
 + 
 + 
 +Below is a quick play about from BASH to test the relay with raw TCP.  ''nc'' is Netcat, a really useful utility to communicate with raw TCP/IP, either to send packets as here, but also you can use it to set up a listener on a port. See the repo link above to work out the data fed to nc from the printf. Using printf as echo by default sends a newline / CR which will upset the module. 
 +If you're stuck on windows you probably don't have netcat, yet another reason to upgrade to Linux. 
 + 
 +<code> 
 +#    Commands are ASCII strings that must be sent in one packet 
 +#    (even for TCP): 
 +
 +#        0R     No operation (but return status). 
 +
 +#        1R*    Close relay if it's open, wait approx 1/2 a second, open 
 +#               relay. 
 +
 +#        1R     Close relay if it's open. 
 +
 +#        1R:0   Close relay if it's open. 
 +
 +#        1R:n   Close relay if it's open, then in n seconds (1 <= n <= 65535) 
 +#               open it. 
 +
 +#        2R     Open relay if it's closed. 
 +
 +#    Where: 
 +
 +#        R      is the relay number, '1' .. '8' The main board has relay'
 +#               '1' and '2', the extension board (if present) has the rest. 
 +#               If R is 'X' all relays are effected. 
 +
 +#    If the command is sent over TCP (not UDP, TCP only), the relay will 
 +#    reply with a string of 8 0's and 1's, representing the "before" command 
 +#    was executed" state of relay's 1..8 in that order.  A '0' is sent if the 
 +#    relay is open, '1' if closed. 
 +</code>
      
      
-This page has been accessed for:- \\+<code> 
 +$ printf "11:" | nc 192.168.1.91 6722 
 +10000000 
 +$ printf "12:" | nc 192.168.1.91 6722 
 +11000000 
 +$ printf "02:" | nc 192.168.1.91 6722 
 +11000000 
 +
 +</code> 
 + 
 +  
 +   
 +This page has been accessed:- \\
 Today: {{counter|today}} \\ Today: {{counter|today}} \\
 Yesterday: {{counter|yesterday}} \\ Yesterday: {{counter|yesterday}} \\
 Until now: {{counter|total}} \\   Until now: {{counter|total}} \\  
ha/sr201.1689078397.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki