1
1
Fork 0

Inital commit

This commit is contained in:
Simon Giesel 2019-01-05 22:22:45 +01:00
commit 1a88043b7a
4 changed files with 74 additions and 0 deletions

12
AndroidManifest.xml Normal file
View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="">
<uses-sdk android:minSdkVersion="17" android:targetSdkVersion="26"/>
<application android:icon="@drawable/icon" android:label="">
<activity android:name=".MainActivity" android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>

59
VMC_Processing_Step1.pde Normal file
View file

@ -0,0 +1,59 @@
import ketai.sensors.*;
KetaiSensor sensor;
float fontSize = 130*displayDensity;
float accelerometerX, accelerometerY, accelerometerZ, rotationX, rotationY, rotationZ;
void setup()
{
sensor = new KetaiSensor(this);
sensor.start();
textAlign(CENTER, CENTER);
textSize(fontSize);
}
float mapNum;
void draw()
{
background(78, 93, 75);
fill(255);
text("Accelerometer:", 0, -fontSize*5.5, width, height);
mapNum = mapColor(accelerometerX);
fill(mapNum, 255-mapNum, 0);
text("x: " + nfp(accelerometerX, 1, 3), 0, -fontSize*4, width, height);
mapNum = mapColor(accelerometerY);
fill(mapNum, 255-mapNum, 0);
text("y: " + nfp(accelerometerY, 1, 3), 0, -fontSize*3, width, height);
mapNum = mapColor(accelerometerZ);
fill(mapNum, 255-mapNum, 0);
text("z: " + nfp(accelerometerZ, 1, 3), 0, -fontSize*2, width, height);
fill(255);
text("Gyroscope:", 0, fontSize*1.5, width, height);
mapNum = mapColor(rotationX);
fill(mapNum, 255-mapNum, 0);
text("x: " + nfp(rotationX, 1, 3), 0, fontSize*3, width, height);
mapNum = mapColor(rotationY);
fill(mapNum, 255-mapNum, 0);
text("y: " + nfp(rotationY, 1, 3), 0, fontSize*4, width, height);
mapNum = mapColor(rotationZ);
fill(mapNum, 255-mapNum, 0);
text("z: " + nfp(rotationZ, 1, 3), 0, fontSize*5, width, height);
}
float mapColor(float in){
return map(in, -9.83, 9.83, 0, 255);
}
void onAccelerometerEvent(float x, float y, float z)
{
accelerometerX = x;
accelerometerY = y;
accelerometerZ = z;
}
void onGyroscopeEvent(float x, float y, float z)
{
rotationX = x;
rotationY = y;
rotationZ = z;
}

1
code/sketch.properties Normal file
View file

@ -0,0 +1 @@
component=app

2
sketch.properties Normal file
View file

@ -0,0 +1,2 @@
mode=Android
mode.id=processing.mode.android.AndroidMode