Advertisement
mesmariusz

serial_php_002

May 22nd, 2018
298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. <html>
  2. <body>
  3.  
  4. <form method="post" action="002.php">
  5. <input type="submit" value="cd dp1" name="submit1">
  6. </form>
  7.  
  8. <?php
  9.  
  10. ini_set( 'display_errors', 'On' );
  11. error_reporting( E_ALL );
  12.  
  13. include("serial.conf.php");
  14.  
  15. function display()
  16. {
  17. global $serial;
  18. $str = $_POST['submit1'];
  19. //$str = "\r";
  20. print $str;
  21. $serial->deviceOpen();
  22. //$serial->sendMessage($str);
  23. //$serial->sendMessage("\r");
  24. usleep(200000);
  25. $read = $serial->readPort();
  26. print $read;
  27. $serial->deviceClose();
  28. }
  29.  
  30. if(isset($_POST['submit1']))
  31. {
  32. display();
  33. }
  34. ?>
  35.  
  36. </body>
  37. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement