Skip to content
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

I2C not working corretly on ATTiny85 clone #133

Open
bill-orange opened this issue Dec 15, 2019 · 0 comments
Open

I2C not working corretly on ATTiny85 clone #133

bill-orange opened this issue Dec 15, 2019 · 0 comments

Comments

@bill-orange
Copy link

bill-orange commented Dec 15, 2019

I am using the Arduino 1.8.9 IDE on a ATTiny85 clone.

I can compile properly. I can serial print to NotePad using keyboard.h. I can blink LEDs successfully.

What I can not do is successfully implement I2C. I do not know how to troubleshoot the problem.

If I use I2C scanner, the device is detected but I get back address 0x40 for a BME280. Clearly this is wrong. The address is 0x76.

If I try reading the BME280 (at any address), I get decimal 12378. Something is definitely wrong. I am very familiar with the ESP8266 family but I am too new with this device to work toward a solution by myself.

#include <Wire.h>
#include <DigiKeyboard.h>
#include <TinyBME280.h>

// ATtiny85 Pins
int const sda = PB0;
int const scl = PB2;

void setup()
{
  Wire.begin();  
  BME280setI2Caddress(0x40);
  //BME280setI2Caddress(0x76);
  BME280setup();

  DigiKeyboard.delay(3000);
}

void loop()
{
int32_t tempc;  
  tempc = BME280temperature();
  DigiKeyboard.print("temp: "); DigiKeyboard.println(tempc);

  DigiKeyboard.delay(5000);           // wait 5 seconds for next scan
}

Thoughts? Suggestion? How do I troubleshoot this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant