Commit f313b577 authored by Harshith Goka's avatar Harshith Goka

Debug done, First working model! (static only)

parent fb3b938d
...@@ -16,14 +16,14 @@ public class Frame{ ...@@ -16,14 +16,14 @@ public class Frame{
} }
else{ else{
upperBound = lrBound - (index+2)*((lrBound-upBound)/levels); lowerBound = lrBound - (index+2)*((lrBound-upBound)/levels);
lowerBound = lrBound - (index+1)*((lrBound-upBound)/levels); upperBound = lrBound - (index+1)*((lrBound-upBound)/levels);
} }
if(index == 8){ if(index == 8){
upperBound = upBound; upperBound = lrBound;
lowerBound = lrBound; lowerBound = upBound;
} }
} }
......
...@@ -3,11 +3,11 @@ package com.example.harshith.ddc; ...@@ -3,11 +3,11 @@ package com.example.harshith.ddc;
public class Gesture{ public class Gesture{
public int dataPoints = 15; public int dataPoints = 50;
public int sensors = 10; public int sensors = 10;
public int adcLevels = 2; public int adcLevels = 2;
public int adcUpper = 60; public int adcUpper = 0;
public int adcLower = 200; public int adcLower = 100;
public int mpuLevels = 3; public int mpuLevels = 3;
public int mpuUpper = 18000; public int mpuUpper = 18000;
public int mpuLower = -18000; public int mpuLower = -18000;
......
...@@ -31,7 +31,9 @@ public class Live { ...@@ -31,7 +31,9 @@ public class Live {
} }
public void update(int[] readings){ public void update(int[] readings){
reading = readings.clone(); for(int i = 0;i < sensors;i++){
reading[i] = readings[i];
}
} }
public void print(){ public void print(){
......
...@@ -3,6 +3,7 @@ package com.example.harshith.ddc; ...@@ -3,6 +3,7 @@ package com.example.harshith.ddc;
import android.bluetooth.BluetoothSocket; import android.bluetooth.BluetoothSocket;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.util.Log;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
...@@ -35,35 +36,35 @@ public class ReceiveDataThread extends Thread { ...@@ -35,35 +36,35 @@ public class ReceiveDataThread extends Thread {
int[]hand; int q=0; int[]hand; int q=0;
q=0; hand = new int [] {0,0,0,0,0,8,8,8,8,8,8}; q=0; hand = new int [] {0,0,0,0,8,8,8,8,8,8};
// neutral // neutral
a[q].updateFrame(hand); a[q].updateFrame(hand);
q=1; hand = new int [] {1,1,0,0,0,8,8,8,8,1,8}; q=1; hand = new int [] {1,1,0,0,8,8,8,8,1,8};
// voice search // voice search
a[q].updateFrame(hand); a[q].updateFrame(hand);
q=2; hand = new int [] {1,0,1,1,1,8,8,8,8,1,8}; q=2; hand = new int [] {1,0,1,1,8,8,8,8,1,8};
// tap // tap
a[q].updateFrame(hand); a[q].updateFrame(hand);
q=3; hand = new int [] {0,1,1,1,0,8,8,8,8,1,8}; q=3; hand = new int [] {0,1,1,1,8,8,8,8,1,8};
// call // call
a[q].updateFrame(hand); a[q].updateFrame(hand);
q=4; hand = new int [] {0,0,1,1,1,8,8,8,-1,8,8}; q=4; hand = new int [] {0,0,1,1,8,8,8,-1,8,8};
// cam open // cam open
a[q].updateFrame(hand); a[q].updateFrame(hand);
q=5; hand = new int [] {0,0,0,1,1,8,8,8,-1,8,8}; q=5; hand = new int [] {0,0,0,1,8,8,8,-1,8,8};
// cam click // cam click
a[q].updateFrame(hand); a[q].updateFrame(hand);
q=6; hand = new int [] {1,0,1,1,0,8,8,8,8,1,8}; q=6; hand = new int [] {1,0,1,1,8,8,8,8,1,8};
// music open // music open
a[q].updateFrame(hand); a[q].updateFrame(hand);
q=7; hand = new int [] {0,0,1,1,0,8,8,8,8,1,8}; q=7; hand = new int [] {0,0,1,1,8,8,8,8,1,8};
// music play // music play
a[q].updateFrame(hand); a[q].updateFrame(hand);
...@@ -128,14 +129,14 @@ public class ReceiveDataThread extends Thread { ...@@ -128,14 +129,14 @@ public class ReceiveDataThread extends Thread {
stringBuilder.delete(0, endOfLineIndex + 2); stringBuilder.delete(0, endOfLineIndex + 2);
if(count == no){ if(count == no){
L.m("Gesture " + gestActive + " is activated"); Log.d("Gesture","Gesture " + gestActive + " is activated");
count = 0; count = 0;
gestActive = -1; gestActive = -1;
//if( str.equals("n") ) { stay = false; break; } //if( str.equals("n") ) { stay = false; break; }
} }
if(count<no){ if(count<no){
if(readings.length == 11) { if(readings.length == 10) {
staticLive.update(readings); staticLive.update(readings);
} }
} }
...@@ -143,10 +144,10 @@ public class ReceiveDataThread extends Thread { ...@@ -143,10 +144,10 @@ public class ReceiveDataThread extends Thread {
for (int i=0; i<8; i++) { for (int i=0; i<8; i++) {
if(a[i].isInFrame(staticLive)){ if(a[i].isInFrame(staticLive)){
if(gestActive == i){ if(gestActive == i){
count++; continue; count++; break;
} }
else{ else{
gestActive = i; count = 1; continue; gestActive = i; count = 1; break;
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment