High All!
I have been trying for days, to figure out how to find/use a library that will allow me to use alternate pins to drive an I2C LCD Backpack 16X2 display on my ProMicro.
I have found a few old threads here but I can't seem to get them "bumped" up where anyone can help me get one going.
I am basically stuck with a system where I can use A0 for SDA and A1 for SCL. I don't care about speed, I just need to stuff a little data i the display.
I have been looking at the LiquidCrystal_I2C_BitBang.h lately. It seems to be the closest to what I need.
Isn't there anyone out there that has made this work?
I want to use a ProMicro, A0 for SDA and A1 for SCL. (there are a variety of reasons why. Please do not try to tell me to use other pins. They are all busy.
I can see the .cpp file where I can edit a range that should reassign the pins. I just don't know if I am doing this right.
PLEASE PLEASE help me. I am a quick learner and promise to not ask a bunch of stupid questions if someone gives me a boot up on this topic.
Here is the software I would like to run. It works fine as is but I need it to run on alternate pins.
// Simple i2c LCD First Test by Greg
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
uint8_t Brks;
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
void setup()
{
lcd.begin(16, 2);
lcd.clear();
}
void loop() {
for (Brks=0; Brks<255; Brks++) {
lcd.clear();
lcd.print("Brake ");
lcd.print(Brks, DEC);
delay(250);
}
}
I tried to make this modification to LiquidCrystal_I2C_BitBang
// LiquidCrystal_I2C V2.0
#include "LiquidCrystal_I2C_BitBang.h"
#include <inttypes.h>
#include <Arduino.h>
////////// HARDCODED ////////////////
#if defined(__AVR_ATtiny85__)
#define SDA_PORT PORTB
#define SDA_PIN 0
#define SCL_PORT PORTB
#define SCL_PIN 2
#define I2C_FASTMODE 1
#elif defined( __AVR_ATtinyX41__ )
// Ne koristiti 841 hardware I2C slave pinove PA6(SDA) i PA4(SCL) za bitbang I2C Master ( verovatno bug u 841 core - proveriti )
#define SDA_PORT PORTA
#define SDA_PIN PA7
#define SCL_PORT PORTA
#define SCL_PIN PA3
#define I2C_FASTMODE 1
#elif defined (__AVR_ATmega328P__)
#define SDA_PORT PORTD
#define SDA_PIN 3
#define SCL_PORT PORTD
#define SCL_PIN 5
#define I2C_FASTMODE 1
#elif defined (__AVR_ATmega32U4__) //ProMicro (Leonardo) I added this
#define SDA_PORT PORTF //ProMicro (Leonardo) I added this
#define SDA_PIN PF7 //SDA PF7 A0 //ProMicro (Leonardo) I added this
#define SCL_PORT PORTF //ProMicro (Leonardo) I added this
#define SCL_PIN PF6 //SCL PF6 A1 //ProMicro (Leonardo) I added this
#define I2C_FASTMODE 1 //ProMicro (Leonardo) I added this
#else
#error unknown MCU
#endif
For the purpose of making sure that my ATmega32U4 is in there. I want to use PF7 (A0) and PF6 (A1)
I just need to use a library that will let me run this on A0 and A1 respectively on a ProMicro
My above code works fine though it can only run on hardware I2C pins.
I will buy you breakfast if you can get me over this hump...
Now what do I do?
Thank You
G