Jump to content

arthur64

New Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by arthur64

  1. I'm starting a new project to replace the $700 hot tub controller board with a "Roll your own". Haven't decided on the CPU - ESP32-? or a less than $100 micro pc. As needed the relay board ( LCUS-8 USB Relay Module 8 Channel DC 5V ) will drive T9AS1D12 30A relays. Web page for display and control. Anyhow looking for how to control the relay board using PHP - Google wasn't any help. I found a 70+ line python script ( I dislike py ) so I used it as a base for a 19 line PHP script. #!/usr/bin/php <?php $on = array ("", "\xa0\x01\x01\xa2", "\xa0\x02\x01\xa3", "\xa0\x03\x01\xa4", "\xa0\x04\x01\xa5", "\xa0\x05\x01\xa6", "\xa0\x06\x01\xa7", "\xa0\x07\x01\xa8", "\xa0\x08\x01\xa9"); $off = array ("", "\xa0\x01\x00\xa1", "\xa0\x02\x00\xa2", "\xa0\x03\x00\xa3", "\xa0\x04\x00\xa4", "\xa0\x05\x00\xa5", "\xa0\x06\x00\xa6", "\xa0\x07\x00\xa7", "\xa0\x08\x00\xa8"); $relay = $argv[1]; $oo = $argv[2]; $fd = fopen ("/dev/ttyUSB0", "r+"); switch ($oo) { case 0: fprintf ($fd, "0x%s", $off[$relay]); break; case 1: fprintf ($fd, "0x%s", $on[$relay]); break; } fclose ($fd);
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.