You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 satır
869B

  1. #!/usr/bin/env python
  2. #######################################################################
  3. # Aufgabe 2 #
  4. #######################################################################
  5. from linuxWiimoteLib import *
  6. # initialize wiimote
  7. wiimote = Wiimote()
  8. #Insert address and name of device here
  9. # hcitool scan
  10. #
  11. device = ('', '')
  12. connected = False
  13. try:
  14. print "Press any key on wiimote to connect"
  15. while (not connected):
  16. connected = wiimote.Connect(device)
  17. print "succesfully connected"
  18. wiimote.SetAccelerometerMode()
  19. wiistate = wiimote.WiimoteState
  20. while True:
  21. # re-calibrate accelerometer
  22. if (wiistate.ButtonState.Home):
  23. print 're-calibrating'
  24. wiimote.calibrateAccelerometer()
  25. sleep(0.1)
  26. except KeyboardInterrupt:
  27. print "Exiting through keyboard event (CTRL + C)"
  28. exit(wiimote)