daily pastebin goal
33%
SHARE
TWEET

PC led toggle client python

snakerdlk Aug 8th, 2011 111 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import bluetooth
  2. bd_addr = “INSERT MODULE MAC ADDRESS”
  3.  
  4. port = 1
  5.  
  6. print “creating socket
  7. sock=bluetooth.BluetoothSocket( bluetooth.RFCOMM )
  8.  
  9. print “connecting: “+bd_addr+”:”+str(port)
  10. sock.connect((bd_addr, port))
  11.  
  12. print “sending string
  13. sock.send(“led”)
  14.  
  15. print “waiting for answer”
  16. buff = “”
  17. while(buff != “OK” and buff != “ERROR”):
  18.         buff += sock.recv(1)
  19. print buff
  20.  
  21. print “closing socket
  22. sock.close()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top