Advertisement
dehqan

Untitled

Nov 10th, 2011
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. <?php
  2.  
  3. // declare variables
  4. $handle = $reply = null;
  5. $filename = '/dev/ttyUSB1';
  6. $handle = fopen($filename, 'r+');
  7.  
  8. // validate file handle
  9. // main code.
  10.  
  11. if ( fwrite($handle, 'AT') ) {
  12. echo 'Command is sent';
  13. $reply = fread($handle, 4);
  14. echo $reply;
  15.  
  16.  
  17. }else{
  18. echo 'The device isn\'t read';
  19. }
  20.  
  21. fclose( $handle );
  22.  
  23.  
  24. die;
  25.  
  26. ?>
  27.  
  28.  
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement