Skip to content

Commit 4bade02

Browse files
authored
Update LiquidCrystal_PCF8574.cpp
1 parent b3b83e7 commit 4bade02

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/LiquidCrystal_PCF8574.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,13 @@ void LiquidCrystal_PCF8574::home()
9494
/// Set the cursor to a new position.
9595
void LiquidCrystal_PCF8574::setCursor(int col, int row)
9696
{
97-
int row_offsets[] = {0x00, 0x40, 0x14, 0x54};
97+
int *row_offsets;
98+
99+
if (this->_lines == 4)
100+
row_offsets = new int[4] {0x00, 0x40, 0x10, 0x50};
101+
else
102+
row_offsets = new int[4] {0x00, 0x40, 0x14, 0x54};
103+
98104
// Instruction: Set DDRAM address = 0x80
99105
_send(0x80 | (row_offsets[row] + col));
100106
} // setCursor()

0 commit comments

Comments
 (0)