I have a ATTiny85 on a Sparkfun AVR Programmer with a LCD display connected. I run the I2C_scanner sketch but I see on the Serial Monitor that it doesn’t find any display at all. The display lights up the upper row but that’s all. The display has a backpack wired SCL > PB2 and SDA > PB0. The display is tested on my MEGA and is working fine. I’m running the tiny at 8MHZ and I have burned the bootloader. I have two 4.7 kOhm resistors Vcc-SCL and Vcc-SDA. I’ve run out of ideas. Any help much appreciated.
#include <TinyWireM.h>
#include <SoftwareSerial.h>
const int Rx = 3;
const int Tx = 4;
SoftwareSerial SSerial(Rx, Tx);
void setup()
{
pinMode(Rx, INPUT);
pinMode(Tx, OUTPUT);
SSerial.begin(9600);
TinyWireM.begin();
while (!SSerial); // Leonardo: wait for serial monitor
delay(1000);
SSerial.println("\nI2C Scanner");
}
void loop()
{
byte error, address;
int nDevices;
SSerial.println("Scanning...");
nDevices = 0;
for (address = 1; address < 127; address++ )
{
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
TinyWireM.beginTransmission(address);
error = TinyWireM.endTransmission();
if (error == 0)
{
SSerial.print("I2C device found at address 0x");
if (address < 16)
SSerial.print("0");
SSerial.print(address, HEX);
SSerial.println(" !");
nDevices++;
}
else if (error == 4)
{
SSerial.print("Unknown error at address 0x");
if (address < 16)
SSerial.print("0");
SSerial.println(address, HEX);
}
}
if (nDevices == 0)
SSerial.println("No I2C devices found\n");
else
SSerial.println("done\n");
delay(5000); // wait 5 seconds for next scan
}