Hi: I was recently catching up on some hobby devices I have connected and discovered they stopped publishing to the console back on January 2, 2023? I started reading troubleshooting articles and testing old code etc. but cannot get any of them to publish data to the console like before. I checked that I have delays for frequency, updated firmware, and I am not maxed out on the sandbox data usage. Did something change in publishing requirements for photon (1.0) around this time?
Here is a snip of some of the basic code I have been using:
void setup() {
Blynk.begin(auth);
// Set variable
Particle.variable("i2cdevice","ADXL345");
Particle.variable("xAccl",xAccl);
Particle.variable("yAccl",yAccl);
Particle.variable("zAccl",zAccl);
// Initialise I2C communication as MASTER
Wire.begin();
// Initialise serial communication, set baud rate = 9600
Serial.begin(9600);
// Start I2C transmission
Wire.beginTransmission(Addr);
// Select bandwidth rate register
Wire.write(0x2C);
// Select output data rate = 100 Hz
Wire.write(0x0A);
// Stop I2C Transmission
Wire.endTransmission();
// Start I2C transmission
Wire.beginTransmission(Addr);
// Select power control register
Wire.write(0x2D);
// Select auto sleep disable
Wire.write(0x08);
// Stop I2C transmission
Wire.endTransmission();
// Start I2C transmission
Wire.beginTransmission(Addr);
// Select data format register
Wire.write(0x31);
// Select full resolution, +/-2g (0X08) , for 16g it shoudl be (0x0B)
Wire.write(0x0B);
// End I2C transmission
Wire.endTransmission();
delay(300);
}
void loop() {
///Blynk.Run();
unsigned int data[6];
for(int i = 0; i < 6; i++) {
// Start I2C transmission
Wire.beginTransmission(Addr);
// Select data register
Wire.write((50+i));
// Stop I2C transmission
Wire.endTransmission();
// Request 1 byte of data from the device
Wire.requestFrom(Addr,1);
// Read 6 bytes of data
// xAccl lsb, xAccl msb, yAccl lsb, yAccl msb, zAccl lsb, zAccl msb
if(Wire.available()==1) {
data[i] = Wire.read();
}
delay(300);
}
// Convert the data to 10-bits
int xAccl = (((data[1] & 0x03) * 256) + data[0]);
if(xAccl > 511) {
xAccl -= 1024;
}
int yAccl = (((data[3] & 0x03) * 256) + data[2]);
if(yAccl > 511) {
yAccl -= 1024;
}
int zAccl = (((data[5] & 0x03) * 256) + data[4]);
if(zAccl > 511) {
zAccl -= 1024;
}
//convert to G's************************************
///xg1 = 4/(1023*xAccl) + (2/1023);
///yg1 = 4/(1023*yAccl) + (2/1023);
///zg1 = 4/(1023*zAccl) + (2/1023);
//convert to G's*************************************
// Output data to dashboard
Particle.publish("Acceleration in X-Axis is :", String(xAccl));
Particle.publish("Acceleration in Y-Axis is :", String(yAccl));
Particle.publish("Acceleration in Z-Axis is :", String(zAccl));
....