Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

39 Zeilen
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)