How to get more Pins on an Attiny 85?

Hey Guys,

i made one attiny write Zero to every adress in the eeprom (4 Adresses per second he blink every write) and a other one is reading when his led is high, and also write a Zero to every adress (onl y 511 instead of 512, the would get differents times of finishing).
But i need more Pins on my Attinys for more a monitor on each attiny (the 16x2 monitor).
Can you help me get a solution for more pins on my attinys?

Thanks

My Codes:

First Attiny

#include <EEPROM.h>
void setup() {
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT); 

}

int addr;
int val;
int i;
  
void loop() {              
  EEPROM.write(addr, val);
  addr ++;
  val = 1;  
  delay(125);
  i = EEPROM.read(addr);

  if (i == val){
      digitalWrite(3, HIGH);  
      delay(125);  
      digitalWrite(3, LOW); 
  }

  if (addr == EEPROM.length()) {
    addr = 0;
    digitalWrite(4, HIGH);  
    delay(10000);
    digitalWrite(4, LOW); 
  }
}

Second one:

#include <EEPROM.h>

const int int1 = 1; // other one pin 3
int ints = 0;//status 1

void setup() {
  pinMode(int1, INPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  
}

int addr = 1;
int val;
int i;

void loop() {
    ints = digitalRead(int1);
    if (ints == HIGH) {
          EEPROM.write(addr, val);
          addr ++;
          val = 1;  
          delay(125);
          i = EEPROM.read(addr);
    if (i == val){
      digitalWrite(3, HIGH);  
      delay(125);  
      digitalWrite(3, LOW); 
    }

    if (addr == EEPROM.length()) {
      addr = 0;
      digitalWrite(4, HIGH);  
      delay(10000);
      digitalWrite(4, LOW); 
    }
    }
}

Use an I2C enabled LCD.

any example? im not the best with arduinos

but then i also have the problem with not enough pins, i need two for leds

Character LCDs with I2C backpacks are commonly available from many vendors. How to use an I2C LCD. I like the hd44780 library for I2C LCDs. It is the best library and is well maintained. The hd44780 library is available through the IDE library manager.

Then add a MCP23008 I2C expander. MCP23008 will give you 8 more GPIO pins with internal pullup and pin change interrupt capabilities. An MCP23017 will give you 16 more GPIO pins.
The MCP23008 will share the I2C bus with the I2C LCD so only the same 2 pins used for both the LCD and MCP23008. How to use the MCP23008.

thank you that hepled a lot!

The two codes you posted are going to exceed the number of writes your EEPROM can manage quite quickly, your EEPROM will be burnt out.

Time to drop the tiny and use something more powerful ?

1 Like

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