All post of ElecFreaksHack Hack

Post IIC-SPI LCD Library to Arduino 1.0

By November 29, 2012 No Comments
LCD_Char_1602_IIC_02

When many starters post the LiquidCrystal_I2C / IIC-SPI LCD Library to Arduino 1.0 ,they will encounter many problems. The LiquidCrystal_I2C /  IIC-SPI LCD Library is for I2C/SPI LCD1602 Module, which is provided by Adafruit.  It  does not support the Arduino 1.0+ version,but  just supports 0022/0023…  So we post it,  and update it . Hope there are something helpful.

You can directly get the library from here.

At firs, you need modify all of the #include “WProgram.h” to #include “Arduino.h”.  When you compily the code with Arduino 1.0 , there will display the error as bleow:


1
2
c:\Progr-MCU\Arduino\arduino-1.0\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:81: error: conflicting return type specified for 'virtual void LiquidCrystal_I2C::write(uint8_t)'
c:\Progr-MCU\Arduino\arduino-1.0\hardware\arduino\cores\arduino/Print.h:48: error:   overriding 'virtual size_t Print::write(uint8_t)'

There is a problem in LiquidCrystal_I2C.h and LiquidCrystal_I2C.cpp because it was written for pre 1.0 Arduino:

LiquidCrystal_I2C.h:
change line in these files from

virtual void write(uint8_t);
to
virtual size_t write(uint8_t);

LiquidCrystal_I2C.cpp:
change line in these files from
inline void LiquidCrystal_I2C::write(uint8_t value) {
to
inline size_t LiquidCrystal_I2C::write(uint8_t value) {

 

Second , compiled  abd there are new error display.

 


D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp: In member function 'void MCP23008::begin(uint8_t)':
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:23: error: 'class TwoWire' has no member named 'send'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:24: error: 'class TwoWire' has no member named 'send'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:25: error: 'class TwoWire' has no member named 'send'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:26: error: 'class TwoWire' has no member named 'send'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:27: error: 'class TwoWire' has no member named 'send'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:28: error: 'class TwoWire' has no member named 'send'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:29: error: 'class TwoWire' has no member named 'send'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:30: error: 'class TwoWire' has no member named 'send'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:31: error: 'class TwoWire' has no member named 'send'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:32: error: 'class TwoWire' has no member named 'send'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:33: error: 'class TwoWire' has no member named 'send'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp: In member function 'void MCP23008::pinMode(uint8_t, uint8_t)':
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:52: error: 'class TwoWire' has no member named 'send'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:56: error: 'class TwoWire' has no member named 'receive'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:67: error: 'class TwoWire' has no member named 'send'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:68: error: 'class TwoWire' has no member named 'send'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp: In member function 'void MCP23008::digitalWrite(uint8_t, uint8_t)':
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:82: error: 'class TwoWire' has no member named 'send'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:86: error: 'class TwoWire' has no member named 'receive'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:97: error: 'class TwoWire' has no member named 'send'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:98: error: 'class TwoWire' has no member named 'send'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp: In member function 'void MCP23008::pullUp(uint8_t, uint8_t)':
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:111: error: 'class TwoWire' has no member named 'send'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:115: error: 'class TwoWire' has no member named 'receive'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:126: error: 'class TwoWire' has no member named 'send'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:127: error: 'class TwoWire' has no member named 'send'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp: In member function 'uint8_t MCP23008::digitalRead(uint8_t)':
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:138: error: 'class TwoWire' has no member named 'send'
D:\arduino\driver\arduino-1.0.1\libraries\SPI_IIC_LCD\MCP23008.cpp:142: error: 'class TwoWire' has no member named 'receive'

 

That means the Wire.h is not compatible. Follow the prompts, we need modify all of the MCP23008.cpp ‘s   ‘send’ to ‘write’ and  ‘receive’ to  ‘read’

Okay, the  compatible will pass now. Just enjoy !

VN:F [1.9.13_1145]
Rating: 3.0/10 (1 vote cast)
VN:F [1.9.13_1145]
Rating: 0 (from 0 votes)
Post IIC-SPI LCD Library to Arduino 1.0, 3.0 out of 10 based on 1 rating
robi

Author robi

ElecFreaks - Community for electronics enthusiasts, provide all you need.

More posts by robi

Leave a Reply