Use a LCD i2c with attiny84: Difference between revisions

From lechacal
Jump to navigation Jump to search
Line 37: Line 37:
  by<br>
  by<br>
  '''void read(uint8_t);'''<br>
  '''void read(uint8_t);'''<br>
Open file TinyWire.cpp
On line 49 replace<br>
void USI_TWI::send(uint8_t data){ // buffers up data to send<br>
by<br>
'''void USI_TWI::write(uint8_t data){ // buffers up data to send'''<br>
On line 76 replace<br>
if (xferOK) return 0;<br>
by<br>
'''if (xferOK) return 1;'''<br>
On line 83 replace<br>
uint8_t USI_TWI::receive(){ // returns the bytes received one at a time<br>
by<br>
'''uint8_t USI_TWI::read(){ // returns the bytes received one at a time'''<br>

Revision as of 22:52, 24 April 2015

Using an ATtiny84 to drive an i2c LCD screen.

Target Hardware

  • ATtiny84 MCU
  • LCD display with i2c adaptor board.

Libraries installation

Three libraries are required.


Libraries Modification

Tiny Core

The tiny core will need to see the new.cpp and new.h from the arduino core. An easy way get this working is to copy the file. On Linux platform this will be something like

cp /usr/share/arduino/hardware/arduino/cores/arduino/new.* /home/user/sketchbook/hardware/tiny/cores/tiny/


TinyWireM

Open the file TinyWire.h.

On line 57 replace

void send(uint8_t);
by
void write(uint8_t);

On line 60 replace

void receive(uint8_t);
by
void read(uint8_t);


Open file TinyWire.cpp

On line 49 replace

void USI_TWI::send(uint8_t data){ // buffers up data to send
by
void USI_TWI::write(uint8_t data){ // buffers up data to send

On line 76 replace

if (xferOK) return 0;
by
if (xferOK) return 1;

On line 83 replace

uint8_t USI_TWI::receive(){ // returns the bytes received one at a time
by
uint8_t USI_TWI::read(){ // returns the bytes received one at a time