Go Down

Topic: ATTiny84 and LCDviaI2C (Read 75 times) previous topic - next topic

zappa2

Hello Guys!

I have to display simple messages on a 16x2-lcd via PCF8574 from an ATTiny84.

I installed TinyWireM- and LiquidCrystal_I2C-libs but it didn't work. Has anybody a practicable way to do this ordinary task? Please tell me the concrete libs!

I would be very grateful!

spycatcher2k

Quote
I installed TinyWireM- and LiquidCrystal_I2C-libs but it didn't work.
This is a non quantifiable statement.

In what way did it not work? What code did you use?

Please post your attempt, and a link to these libraries, as their may be more than one library with the same name.
Mrs Drew
-=-
http://www.uk-pcb.co.uk - UK PCB Fab Company
I will design & code for you, but I will also charge you (PM me)
If you don't like my answers, realize : I'm not being cheeky, I'm Just trying to prompt you to use your own brain/google etc.

zappa2

#2
Aug 10, 2018, 09:16 am Last Edit: Aug 10, 2018, 09:23 am by zappa2
I thank you for your help!

At first I try it with TinyWireM by Adafruit Vers. 1.0.1 and LiquidCrystalI2C by Frank de Brabander Vers. 1.1.2 - installed by internal LibraryManager in Arduino.
I try this internal exampel:

Code: [Select]

//YWROBOT
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x20,20,4);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup()
{
  lcd.init();                      // initialize the lcd
  lcd.init();
  // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(3,0);
  lcd.print("Hello, world!");
  lcd.setCursor(2,1);
  lcd.print("Ywrobot Arduino!");
   lcd.setCursor(0,2);
  lcd.print("Arduino LCM IIC 2004");
   lcd.setCursor(2,3);
  lcd.print("Power By Ec-yuan!");
}


void loop()
{
}



In a next step I installed Newliquidcrystal_1.3.5 Francisco Malpartida, downloaded from https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads/

I try this source:

Code: [Select]

#include <TinyWireM.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x20);  // Set the LCD I2C address

//LiquidCrystal_I2C lcd(0x20, BACKLIGHT_PIN, POSITIVE);  // Set the LCD I2C address

void setup()
{ lcd.begin(16,2);               // initialize the lcd
  lcd.home ();                   // go home
  lcd.print("Hello, ARDUINO "); 
  lcd.setCursor ( 0, 1 );        // go to the next line
  lcd.print (" FORUM - fm   ");
  delay ( 1000 );
}

void loop()
{  lcd.home ();
   lcd.print (char(random(7)));
   lcd.setCursor ( 0, 1 );
   delay (200);
}




In a next step I do the workaround, described in http://lechacal.com/wiki/index.php/Use_a_LCD_i2c_with_attiny84
But that can not be compiled.

The thing is, I have an old Hex-File from Arduino, which works very fine when I load it up with avrdude.
I programmed this one with an old Arduino-Installation, which I installed about a year ago. But I neither have my own old sources neither the old Arduino-installation, the old PC is gone.

Addendum: I test all examples with the actually used address 0x20.

zappa2

#3
Aug 10, 2018, 07:00 pm Last Edit: Aug 10, 2018, 07:01 pm by zappa2
Solved!


I found these lib:
http://www.archiduino.com/liquidcrystal_i2c-h-library-arduino-ide-1-6-x/

In both files LiquidCrystal_I2C.h and .cpp I changed the Wire.M-Lines and -Calls to TinyWireM. and then it works very fine!


Nevertheless thank you spycatcher2k!

Go Up