예제 #1
0
wii.led = 1

print('data = [...')

while True:

  	buttons = wii.state['buttons']

  	# Detects whether + and - are held down and if they are it quits the program
  	if (buttons - cwiid.BTN_PLUS - cwiid.BTN_MINUS == 0):
    		# NOTE: This is how you RUMBLE the Wiimote
    		wii.rumble = 1
    		time.sleep(0.1)
    		wii.rumble = 0
    		exit(wii)


  	
  	if (buttons & cwiid.BTN_HOME):
    		wii.rpt_mode = cwiid.RPT_BTN | cwiid.RPT_ACC
    		check = 0
    		while check == 0:
			rawacc = wii.state['acc']
			cleanacc = extra.coeffcalc(rawacc)
      			print(cleanacc)
      			time.sleep(0.01)
      			check = (buttons & cwiid.BTN_HOME)
    		time.sleep(button_delay)


예제 #2
0
		speed = extra.increase(speed, factor)
		#print speed
    		time.sleep(button_delay)

  	if (B1 in powers):
    		print 'B1'
    		time.sleep(button_delay)
  	if (B2 in powers):
    		print 'B2'
    		time.sleep(button_delay)


  	if (HOME in powers):
    		wii.rpt_mode = cwiid.RPT_BTN | cwiid.RPT_ACC
    		while (HOME in powers):
			cleanacc = extra.coeffcalc(wii.state['acc'])
      			# print(cleanacc)
			turtlewii_func.move(cleanacc)
      			time.sleep(button_delay)
      			buttons = wii.state['buttons']
			powers = extra.powers_of_2(buttons)
    		time.sleep(button_delay)


#  	if (buttons & cwiid.BTN_HOME):
#    		wii.rpt_mode = cwiid.RPT_BTN | cwiid.RPT_ACC
#    		check = 0
#    		while check == 0:
#			cleanacc = extra.coeffcalc(wii.state['acc'])
#      			# print(cleanacc)
#			turtlewii_func.move(cleanacc)