|
#1
|
|||
|
|||
|
This tool outputs the Orientation, X, Y, and Z readings from the accelerometer to the screen. It may be useful to programmers who want to know how the accelerometer works, the relationships between the axis', and how the axis readings relate to the orientation of the device.
Attached are versions for firmware 1.11.X and 1.12.X., respectively listed. Special thanks to ThievingSix and Legostein Last edited by Tetrajak; 03-24-2010 at 09:54 PM. Reason: Update for new firmware |
|
|
|||
|
|
|
#2
|
|||
|
|||
|
I couldn't get the orientation to work either. Might be something creative typo'd.(Not the first time either).
__________________
Only ONE more functions in the Wiki need addressing! Zen X-Fi2 LUA Wiki Want to protect your applications? Click Here! Tower Defense Thread Zen Lock - Protect Your Zen! |
|
#3
|
|||
|
|||
|
Ah ok, thanks for letting me know. I'll put this on Xeroo then as it is as complete as it can be with the current script available.
EDIT: Included are versions for the new firmware and old firmware. If you have updated, please download the new version. I am pleased to report that orientation now works in the new firmware (1.12.X) |
|
#4
|
||||
|
||||
|
Great, you already adjusted it to work with firmware 1.12.
![]() But I don't see a real difference in the code. Can you explain what the difference is in the use of the accelerometer? I think it would help a lot of people adjusting their code for the new firmware. I also noticed that you assign four variables, while asking for just three (x,y,z): Code:
x_acc,y_acc,z_acc,orient = accelerometer.getdata("xyz")
|
|
#5
|
|||
|
|||
|
I disposed of the piece that was in the water level app, which determined whether accelerometer.set_datatype worked or not, and if not, used the accelerometer.set_senddatatype, which worked in the old firmware. It appears that the new firmware doesn't like this small set of if statements, so I disposed of them and left the set_datatype statement on its own.
As for why accelerometer.getdata gets the orientation even when I only ask it for xyz, that's because the string you put in getdata is trumped by the set_datatype statement, and will return a 4th value (the orientation) even when not asked for it. I'll adjust the code and re-upload it to make it a little cleaner. EDIT2:Turns out "xyz" now returns orientation as well, even when set_datatype is given "xyz" beforehand. EDIT: changes have been made and the new version has been uploaded. Give the forum a few minutes to update before trying to redownload. Last edited by Tetrajak; 03-24-2010 at 08:50 PM. |
|
#6
|
|||
|
|||
|
My wha? The water level app was not mine =P
__________________
Only ONE more functions in the Wiki need addressing! Zen X-Fi2 LUA Wiki Want to protect your applications? Click Here! Tower Defense Thread Zen Lock - Protect Your Zen! |
|
#7
|
|||
|
|||
|
My bad, post edited.
|
|
#8
|
|||
|
|||
|
would it be possible to make the app write a log-file of the acceleration?
|
|
#9
|
||||
|
||||
|
Quote:
But yeah it would be possible I guess, but I have the feeling it will be quite buggy, and I don't have time to play around with it right now. |
|
#10
|
||||
|
||||
|
I think it is very much possible. If you can type it out on the screen then you can type it to a file which is then saved. You just have to decide on an interval to log it and add that into the code. I don't think Tetra checks his threads since he doesn't own the device anymore. I might take a look at it once I get more free time, but I'm busy until the end of July and then I have my own big project to work on. But I might squeeze this in if I hit a dead end somewhere and need to take a break.
Brett, could you just tell me quickly how to save a file as a .txt from the Zen? I believe it's possible in your notepad but I don't remember exactly how it was done.
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it! Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it. Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^ |
|
#11
|
||||
|
||||
|
Quote:
datawrite:write(os.date() .. "\t" .."data" .. "\r\n") datawrite:close() ![]() a+ is update mode, see the lua wiki for more. |
|
#12
|
|||
|
|||
|
Using the code for firmware version 1.11.01, the program works fine for a while, (except for orientation), but then locks up the Zen. Why, is it just my unit?
Thanks for the code, very useful for a nobie in Lua programming. Jerry |
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 08:59 PM.













Linear Mode
