Hello
Had anyone any working sniper using gyroscope/accelerometer ?
Example of OnGyroscope/OnAccelerometrr
-
- Posts: 267
- Joined: Fri Feb 24, 2012 9:34 am
Re: Example of OnGyroscope/OnAccelerometrr
i try sometimes with the gyroscope, but i don´t can understand how this is working
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Example of OnGyroscope/OnAccelerometrr
Just use Google and look at the Android examples. Hollywood directly maps what Android returns here so there should be plenty of documentation on how to interpret these values.
Re: Example of OnGyroscope/OnAccelerometrr
My point is to make hollywood return ..somethink.. after that i will interprent these values..
Christos
Re: Example of OnGyroscope/OnAccelerometrr
was simpel after all.. dunno what i did wrong
here is a working example showing data and a simple LEVEL for future refence..
here is a working example showing data and a simple LEVEL for future refence..
Code: Select all
@DISPLAY {Title = "Gyroscope and Accelerometer Test",Mode = "AutoFullScreen", X = #LEFT, Y = #TOP, Width = 414,
Height = 896, Color = #BLACK}
Accx=1
accy=1
accz=1
gyrox=1
gyroy=1
gyroz=1
Function p_OnAccelerometer(msg)
accx=msg.x*10
accy=msg.y*10
accz=msg.z*10
EndFunction
Function p_OnGyroscope(msg)
gyrox=msg.x*10
gyroy=msg.y*10
gyroz=msg.z*10
EndFunction
InstallEventHandler({OnAccelerometer = p_OnAccelerometer,OnGyroscope = p_OnGyroscope})
Repeat
CheckEvents()
Wait(5)
Cls()
Locate(0,0)
NPrint("Acc X = "..accX)
NPrint("Acc Y = "..accY)
NPrint("Acc X = "..accZ)
NPrint("")
NPrint("Gyro X = "..accx)
NPrint("Gyro Y = "..accy)
NPrint("Gyro Z = "..accz)
SetFillStyle(#FILLCOLOR)
Circle(180,180,40,#YELLOW)
Circle(200+accx,200-accy,20,#GREEN)
SetFillStyle(#FILLNONE)
Circle(200,200,20,#BLACK)
Forever
Christos
-
- Posts: 267
- Joined: Fri Feb 24, 2012 9:34 am
Re: Example of OnGyroscope/OnAccelerometrr
Wow, thank you, i must test it ASAP!
Re: Example of OnGyroscope/OnAccelerometrr
Tested and it works here, thank you.
Just added Orientation = #ORIENTATION_PORTRAIT to the Display command to avoid the screen rotation when testing.
Just added Orientation = #ORIENTATION_PORTRAIT to the Display command to avoid the screen rotation when testing.