Ok nothing shows up in Console I think I have tried everything
// This #include statement was automatically added by the Particle IDE.
#include <MPU6050.h>
// This #include statement was automatically added by the Particle IDE.
#include <DS18B20.h>
#include <math.h>
int ledPin = D7;
// MPU variables:
MPU6050 accelgyro;
int16_t ax, ay, az;
int16_t gx, gy, gz;
const int MAXRETRY = 4;
const uint32_t msSAMPLE_INTERVAL = 2500;
const uint32_t msMETRIC_PUBLISH = 30000;
DS18B20 ds18b20(D3, true); //Sets Pin D2 for Water Temp Sensor and
// this is the only sensor on bus
char szInfo[64];
double celsius;
double fahrenheit;
int Yaxis;
uint32_t msLastMetric;
uint32_t msLastSample;
void setup() {
pinMode(ledPin, OUTPUT);
Wire.begin();
Serial.begin(9600);
// The following line will wait until you connect to the Spark.io using serial and hit enter. This gives
// you enough time to start capturing the data when you are ready instead of just spewing data to the UART.
//
// So, open a serial connection using something like:
// screen /dev/tty.usbmodem1411 9600
while(!Serial.available()) SPARK_WLAN_Loop();
Serial.println("Initializing I2C devices...");
accelgyro.initialize();
// Cerify the connection:
Serial.println("Testing device connections...");
Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");
Particle.variable("sg1",&ay );
Particle.variable("tempferm", &fahrenheit, DOUBLE);
}
void loop() {
// read raw accel/gyro measurements from device
accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
getTemp();
publishData();
delay(3000);
}
void publishData(){
sprintf(szInfo, "%2.2f", fahrenheit);
Particle.publish("dsTmp", szInfo,PRIVATE);
Particle.publish("angle",ay);
Particle.publish("temp",fahrenheit);
Serial.print("a/g:\t");
Serial.print(ax); Serial.print("\t");
Serial.print(ay); Serial.print("\t");
Serial.print(az); Serial.print("\t");
Serial.print(gx); Serial.print("\t");
Serial.print(gy); Serial.print("\t");
Serial.println(gz);
Serial.println(fahrenheit);
}
void getTemp(){
float _temp;
int i = 0;
do {
_temp = ds18b20.getTemperature();
} while (!ds18b20.crcCheck() && MAXRETRY > i++);
if (i < MAXRETRY) {
celsius = _temp;
fahrenheit = ds18b20.convertToFahrenheit(_temp);
}
else {
celsius = fahrenheit = NAN;
Serial.println("Invalid reading");
}
msLastSample = millis();
}