Showing posts with label wiimote. Show all posts
Showing posts with label wiimote. Show all posts

Tuesday, February 15, 2011

GlovePIE code

// Nunchuck accelerometers for movements

var.xNunchuk = 0
var.yNunchuk = 0

a = Wiimote.Nunchuk.Roll + var.xNunchuk < -40
d = Wiimote.Nunchuk.Roll + var.xNunchuk > 40
w = Wiimote.Nunchuk.Pitch + var.yNunchuk < -20
s = Wiimote.Nunchuk.Pitch + var.yNunchuk > 20


// Relative positioning mouse


if wiimote.PointerVisible then
if abs(wiimote.PointerX - var.prevX) + abs(wiimote.PointerY - var.prevY) < 0.1
mouse.x += (wiimote.PointerX - var.prevX) /1
mouse.y += (wiimote.PointerY - var.prevY)*(-1) /1
endif
endif

var.prevX = wiimote.PointerX
var.prevY = wiimote.PointerY