Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

pause button

  • Loading branch information...
commit 435b75170f7aea7c4e7133d8ab0b64cf072f07d3 1 parent d765373
unknown authored
Showing with 14 additions and 1 deletion.
  1. +10 −1 fusion1.pde
  2. +4 −0 imu.pde
View
11 fusion1.pde
@@ -5,6 +5,7 @@ float MPERSSQUARED_PER_BIT = (1/256.0)*9.807; //(g/LSB)*(m*s^-2/g)=m*s^-2/LSB
IMU imu;
PFont font;
+boolean running;
class State{
float s;
@@ -39,6 +40,13 @@ void keyPressed(){
if(key==' '){
state.s=0;
state.v=0;
+ } else if(key=='p'){
+ if(running){
+ running=false;
+ } else {
+ imu.clear();
+ running=true;
+ }
}
}
@@ -51,11 +59,12 @@ void setup(){
imu = new IMU(this, serialPort);
state=null;
+ running=true;
}
void draw(){
// until the serial stream runs dry
- while(true){
+ while(running){
try{
// grab a reading from the IMU
View
4 imu.pde
@@ -47,6 +47,10 @@ class IMU{
return chunk;
}
+ void clear(){
+ serial.clear();
+ }
+
IMUReading read() throws IMUParseException{
String raw = readRaw();
if(raw==null){
Please sign in to comment.
Something went wrong with that request. Please try again.