Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. import cwiid
  2. import time
  3. import i2c
  4. #connecting to the Wiimote. This allows several attempts
  5. # as first few often fail.
  6. print 'Press 1+2 on your Wiimote now...'
  7. wm = None
  8. i=2
  9. while not wm:
  10. try:
  11. wm=cwiid.Wiimote()
  12. except RuntimeError:
  13. if (i>10):
  14. quit()
  15. break
  16. print "Error opening wiimote connection"
  17. print "attempt " + str(i)
  18. i +=1
  19.  
  20. #set Wiimote to report button presses and accelerometer state
  21. wm.rpt_mode = cwiid.RPT_BTN | cwiid.RPT_ACC
  22.  
  23. #turn on led to show connected
  24. wm.led = 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement