I2C LCD Display on Adafruit Feather M0

I'm trying to use an I2C LCD that's connected to a Feather M0 that's soldered into a PCB board. The M0 has two pinouts labeled SCL and SDA that are, as expected, connected to the SCL and SDA pins on the I2C "backpack" of the LCD. I assume that SCL is "Serial Clock" and SDA is "Serial Data".

When I try using the HelloWorld_i2c example sketch from the Adafruit LiquidCrystal library, it does not work. I think it's because the header of that example includes the following:

/*
 Demonstration sketch for Adafruit i2c/SPI LCD backpack
 using MCP23008 I2C expander
 ( http://www.ladyada.net/products/i2cspilcdbackpack/index.html )

 This sketch prints "Hello World!" to the LCD
 and shows the time.
 
  The circuit:
 * 5V to Arduino 5V pin
 * GND to Arduino GND pin
 * CLK to Analog #5
 * DAT to Analog #4
*/

Note that this assumes that CLK and DAT are connected to the board's Analog 5 & 4 respectively. But the pin numbers for SCL and SDA are not the Analog 5 & 4 of, say, my Arduino UNO. They are pins 21 and 20 on the Feather.
In the call to initialize the LCD, the example uses the code:

// Connect via i2c, default address #0 (A0-A2 not jumpered)
Adafruit_LiquidCrystal lcd(0);

Is there a way to add optional parameters to indicate which pins are connected to SCL and SDA? Or is there a separate call to do this?
Thanks for your thoughts,

Any reason why you aren’t asking on Adafruit’s message board?
After all you are using their parts.

Yeah, well I'm a Noob and don't really get the full distinction between Adafruit and Arduino. I will go to that board next time - thanks. Meanwhile, I came across this library hd44780 thanks to bperrybap and it works like a charm. It's a "formal" Arduino library and can be installed from the Manage Libraries list in the IDE. Thanks Bill!

You ask: "Is there a way to add optional parameters to indicate which pins are connected to SCL and SDA? Or is there a separate call to do this?" Yes there are many but until you get more experienced I would highly recommend just setting them keeping your code much easier to read. Consider acquiring the Arduino Cookbook, it will have similar examples. If you understand them use them, if not do not use them until you understand them. This saves lots of debug time.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.