Skip to content

Commit

Permalink
More cleaning
Browse files Browse the repository at this point in the history
	modified:   ../DogeFit.ino
  • Loading branch information
akrontab committed Jan 22, 2014
1 parent 28ff7ca commit f32b2fb
Showing 1 changed file with 11 additions and 20 deletions.
31 changes: 11 additions & 20 deletions DogeFit/DogeFit.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,30 @@
#include <MPU6050.h>

#include <Wire.h>

#include <Adafruit_NeoPixel.h>

//#include <GSM.h>

// DEFINES for Adafruit NEopixel
#define N_PIXELS 6
#define LED_PIN 15
//====the offset of gyro===========
#define Gx_offset -1.50
#define Gy_offset 0
#define Gz_offset 0.80
//#define Gx_offset -1.50
//#define Gy_offset 0
//#define Gz_offset 0.80
//====the offset of accelerator===========
#define Ax_offset -0.03
#define Ay_offset 0.02
#define Az_offset 0.14
//====================

MPU6050 accelgyro;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(N_PIXELS, LED_PIN, NEO_GRB + NEO_KHZ800);

int16_t ax,ay,az;//original data;
int16_t gx,gy,gz;//original data;
float Ax,Ay,Az, Aplane, Azplane;//Unit g(9.8m/s^2)
float Gx,Gy,Gz;//Unit
float Vx, Vy, Vz, Vplane;
float Dx, Dy, Dz;

float DAUG, DAUGScore, Time_s;
float Ax,Ay,Az;
float DAUG, DAUGScore;
int Time;

MPU6050 accelgyro;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(N_PIXELS, LED_PIN, NEO_GRB + NEO_KHZ800);

void setup()
{
strip.setBrightness(100);
Expand All @@ -42,19 +35,18 @@ void setup()
Serial.begin(9600);
Serial1.begin(38400); // Serial1 is used for the Bluetooth

Serial.println("Initializing I2C device.....");
//Serial.println("Initializing I2C device.....");
accelgyro.initialize();

Serial.println("Testing device connections...");
Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful":"MPU6050 connection failure");
//Serial.println("Testing device connections...");
//Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful":"MPU6050 connection failure");

// Needed for the Xadow BLE slave
DDRB|=0x21;
PORTB |= 0x21;

//setting up initial variables
Time = 100;
Time_s = Time/1000; //first in milliseconds, second in seconds
DAUGScore = 0;
}

Expand Down Expand Up @@ -114,7 +106,6 @@ void SendDaugsOverBT()
dtostrf(DAUG, 3, 2, &tmp[1]);
if(DAUG > 0.2)//above threshold, send value
{
//Serial1.write("DAUG =");
Serial1.write(tmp);
}
else if (DAUG <= 0.2)//below threshold, send zero
Expand Down

0 comments on commit f32b2fb

Please sign in to comment.