New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP32 and BMX055 Wifi i2c #2495
Comments
Are you sure you want a binary 'OR' Serial.println("Gyrokonvertierung Ende");
//Alarmausgabe
if ((xAccldiff < -350| xAccldiff > 350) || (yAccldiff < -350|| yAccldiff > 350) || (zAccldiff < -450|| zAccldiff > 450) || (yGyrodiff < -30000|| yGyrodiff > 30000))
{ Why do you read one byte at a time? for (int i = 0; i < 6; i++)
{
// Start I2C Transmission
Wire.beginTransmission(Addr_Mag);
// Select data register
Wire.write((66 + i));
// Stop I2C Transmission
Wire.endTransmission();
// Request 1 byte of data
Wire.requestFrom(Addr_Mag, 1);
// Read 6 bytes of data
// xMag lsb, xMag msb, yMag lsb, yMag msb, zMag lsb, zMag msb
if (Wire.available() == 1)
{
data[i] = Wire.read();
}
} I would rewrite it to this: // Start I2C Transmission
Wire.beginTransmission(Addr_Mag);
// Select data register
Wire.write((66));
// Stop I2C Transmission
Wire.endTransmission();
If(Wire.lastError == I2C_ERROR_OK){ // device answered, accepted data
Wire.requestFrom(Addr_Mag, 6);
If (Wire.lastError !=I2C_ERROR_OK){// problem reading data
Serial.printf("Problem reading Mag data err=%d(%s)\n",Wire.lastError(),Wire.getErrorText(Wire.lastError()));
}
else { // good data
for(uint8_t i = 0;a <6; a++){
data[i] = Wire.read();
}
}
}
else { // Problem setting address pointer
Serial.printf(" Problem communicating with sensor at 0x%02X err=%d(%s)\n",Addr,Mag, Wire.lastError(), Wire.getErrorText(Wire.lastError()));
} You state you are having problems with I2C communications, but nowhere in you code do you check the I2C error returns? I would test the error return after every Chuck. |
Hello chuck, thank you so much for your help. In this line I get the debug message: Invalid use of non-static member function
Do you know what could be the reason?
Hella |
Wire.lastError() is a function. You are using it as a variable. |
hmm okay... Thanks for the hint. I am a beginner at programming and new on github. Will know it for the future. |
@stickbreaker |
The only interaction b/w the WiFi and i2c is power. Your power supply is not delivering enough current to drive all your requirements. |
@Hellakoe |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This stale issue has been automatically closed. Thank you for your contributions. |
Hello,
I use the ESP32 to read out the positionsensor Bmx055 from Bosch via i2c, process it and show it on the web server.
The data processing works until I comment in Wifi.softAp(). After that only zeros are shown and i2c doesnt work anymore.
I have already tried the help of @stickbreaker and added his files to the Esp32 file. Unfortunately it doesnt work.
I also do not get any debug messages.
Do you have any idea?
I would be so grateful.
----------------------------- Remove above -----------------------------
Hardware:
Board: ESP32 Dev Module
Core Installation/update date: 222/2/19
IDE name: Arduino IDE
Flash Frequency: 40Mhz
PSRAM enabled: no
Upload Speed: 115200
Computer OS: Windows 10
Description:
Describe your problem here
Sketch: (leave the backquotes for code formatting)
The text was updated successfully, but these errors were encountered: