diff --git a/app.zip b/app.zip new file mode 100644 index 0000000..079e30a Binary files /dev/null and b/app.zip differ diff --git a/config.xml b/config.xml index a6527d9..c08b684 100644 --- a/config.xml +++ b/config.xml @@ -3,7 +3,7 @@ xmlns:gap = "http://phonegap.com/ns/1.0" id = "com.phonegap.example" versionCode="10" - version = "0.0.3"> + version = "0.0.0.0.0.0.1"> diff --git a/index.html b/index.html index 451a338..e4905f5 100644 --- a/index.html +++ b/index.html @@ -8,6 +8,6 @@ -
Waiting for heading...
+
bitte warten
\ No newline at end of file diff --git a/main.js b/main.js index 7b95fb0..8d092ab 100644 --- a/main.js +++ b/main.js @@ -1,20 +1,35 @@ function onSuccess(acceleration) { - alert('Acceleration X: ' + acceleration.x + '\n' + + /*alert('Acceleration X: ' + acceleration.x + '\n' + 'Acceleration Y: ' + acceleration.y + '\n' + 'Acceleration Z: ' + acceleration.z + '\n' + - 'Timestamp: ' + acceleration.timestamp + '\n'); + 'Timestamp: ' + acceleration.timestamp + '\n' + + ((Math.atan(acceleration.y / acceleration.x))/Math.PI*180)+90 + );*/ + + var element = document.getElementById('textfeld'); + element.innerHTML = "x:"+ acceleration.x + "y:"+ acceleration.y +"
"+ "
"+ "
"+getAngle(acceleration.x, acceleration.y); + drawDial(-getAngle(acceleration.x, acceleration.y)* Math.PI/180) ; }; +function getAngle (x, y) { + if (x == 0) + x += 0.00001; + x = -x; + if (x < 0) + return (360 - Math.atan(y / x) * 360 / 2 / Math.PI - 90); + else + return -(Math.atan(y / x) * 360 / 2 / Math.PI - 90); +} function onError() { alert('onError!'); }; var startup = function(){ - watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError); + watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError,options); lockinit(); } -var options = { frequency: 1000 }; +var options = { frequency: 100 }; document.addEventListener("deviceready", startup, false); \ No newline at end of file