I have just started working on my first Arduino project using the Digispark Attiny 85 and I am trying to use a 16x2 LCD display paired with an I2C bus adapter. I thought it would be easier to use the I2C to manage only 4 connections vs. trying to figure out how to wire the 16 pins to the 6 I/O pins on the Digispark.
I have P0 connected to the SDA, and P2 connected to the SCL on the I2C bus.
I'm currently unable to get the display to do anything but turn on. I have the backlight lit, the top row does display all white boxes, and I can see the dark blue boxes on the bottom row.
I have been trying to get this working for 2 whole days without any success, I currently have the example DigisparkLCD>BasicUsage loaded. But after searching through several other sketches I am thinking it is missing the syntax that correctly sets up the pins to use the I2C bus. Can anyone take a look, and give me a piece of advice?
If everything appears to be correct, is there a way to test the outputs of P0 and P2 to see if the signal is coming through ?
What I have tried:
Replacing the LiquidCrystal_I2C.cpp & LiquidCrystal_I2C.h files located within my digistump folder from this link.(possible wrong location?)
link 1
Using the code from this link, as well as trying to modify the example code with this syntax. If need be, I can reload this code to show the error, but I don't believe these libraries work with the Attiny85.
Link 2
The code I am using:
/* ATtiny85 as an I2C Master Ex2 BroHogan 1/21/11
* Modified for Digistump - Digispark LCD Shield by Erik Kettenburg 11/2012
* SETUP:
* ATtiny Pin 1 = (RESET) N/U ATtiny Pin 2 = (D3) N/U
* ATtiny Pin 3 = (D4) to LED1 ATtiny Pin 4 = GND
* ATtiny Pin 5 = SDA on DS1621 & GPIO ATtiny Pin 6 = (D1) to LED2
* ATtiny Pin 7 = SCK on DS1621 & GPIO ATtiny Pin 8 = VCC (2.7-5.5V)
* NOTE! - It's very important to use pullups on the SDA & SCL lines!
* PCA8574A GPIO was used wired per instructions in "info" folder in the LiquidCrystal_I2C lib.
* This ex assumes A0-A2 are set HIGH for an addeess of 0x3F
* LiquidCrystal_I2C lib was modified for ATtiny - on Playground with TinyWireM lib.
* TinyWireM USAGE & CREDITS: - see TinyWireM.h
*/
//#define DEBUG
#include <TinyWireM.h> // I2C Master lib for ATTinys which use USI - comment this out to use with standard arduinos
#include <LiquidCrystal_I2C.h> // for LCD w/ GPIO MODIFIED for the ATtiny85
#define GPIO_ADDR 0x27 // (PCA8574A A0-A2 @5V) typ. A0-A3 Gnd 0x20 / 0x38 for A - 0x27 is the address of the Digispark LCD modules.
LiquidCrystal_I2C lcd(GPIO_ADDR,16,2); // set address & 16 chars / 2 lines
void setup(){
TinyWireM.begin(); // initialize I2C lib - comment this out to use with standard arduinos
lcd.init(); // initialize the lcd
lcd.backlight(); // Print a message to the LCD.
lcd.print("Digispark!");
}
void loop(){
}