Advertisement
dehqan

Untitled

Nov 14th, 2011
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. <!--<form action="" method="post" >
  2. <input type=text name=cmd />
  3. <input type="submit" value=" send " name=send />-->
  4.  
  5. <?php
  6.  
  7.  
  8. $filename = "/dev/ttyUSB1";
  9.  
  10.  
  11.  
  12. if (!$handle = fopen($filename, 'r+'))
  13.  
  14. {
  15.  
  16. echo "The device isn't detected";
  17.  
  18. exit;
  19.  
  20. }
  21.  
  22. else
  23.  
  24. {
  25.  
  26. if (fwrite($handle,"AT\n"))
  27.  
  28. {
  29. //while(!feof($handle))
  30.  
  31. $reply = fread ($handle,4);
  32. echo $reply;
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39. }
  40. else
  41.  
  42. echo "The device isn't read";
  43.  
  44. }
  45.  
  46. fclose($handle);
  47. die;
  48.  
  49. ?>
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement