Paying $50 to whomever can get my digispark to work with I2C & 16x2 LCD

not yet, I am going bake through all of the previous libraries Ive used to see if any will work using the 0X3F library.

that's the first address we tried... try David's suggestion on the library. I can see why I2C is so important on attiny. what are you making? Why not just use a 328?

Do we still know if pin 5 and 7 are still good?

OK try this…

Go here and download:
https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads/

seems not all the libraries work with ATTINY.

Open file I2CIO.cpp

After line 34 insert the code below:

#if defined(AVR_ATtiny84) || (AVR_ATtiny2313)
#include “TinyWireM.h” // include this if ATtiny85 or ATtiny2313
#define Wire TinyWireM
#else
#include <Wire.h> // original lib include
#endif

#include <TinyWireM.h>                 // ATtiny I2C communication

#include <LiquidCrystal.I2C.h>  

#define GPIO_ADDR     0x3F  
LiquidCrystal_I2C lcd(GPIO_ADDR, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);
long secs = 0;

void setup()
{

  lcd.begin(16, 2); // set up the LCD's number of columns and rows.
  lcd.setBacklight(ON);
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Hello World!");
}

void loop()
{
 
}

wolframore: that's the first address we tried... try David's suggestion on the library. I can see why I2C is so important on attiny. what are you making? Why not just use a 328?

Do we still know if pin 5 and 7 are still good?

I want to use a micro controller that is under $3 for my project. Eventually, I would like to just use the Attiny85 alone and not on the digispark. I just Received my Uno, so I can test the screen and I2C.

I will also try your recommendation and reply.

Good luck... I get 328P chips for $1.50 and make my own. Attiny isn't a huge savings for the issues it can cause.

Im a man of my word, Wofl please send me a personal message to declare how you would like your payment.

The code below worked for me.

/*
 * Interactive nametag sketch for ATtiny85. Based on the Digispark
 * ATtiny LCD example and the Adafruit "Measuring Sound Levels" example.
 * Every 12000 milliseconds will change the display from my name to my website.
 * On the second line, will measure and display sound levels.
 * For more info check: https://platis.solutions/blog/2015/03/22/diy-interactive-name-tag/
 * ATtiny85 I2C pins:
 * ATtiny Pin 5 = SDA on DS1621  & GPIO
 * ATtiny Pin 7 = SCK on DS1621  & GPIO
 */

#include <TinyWireM.h>                  // I2C Master lib for ATTinys which use USI - comment this out to use with standard arduinos
#include <LiquidCrystal_attiny.h>          // for LCD w/ GPIO MODIFIED for the ATtiny85

#define GPIO_ADDR     0x3F
LiquidCrystal_I2C lcd(GPIO_ADDR, 16, 2); // set address & 16 chars / 2 lines

const short micPin = A3;
const short sampleWindow = 50; // Sample window width in mS (50 mS = 20Hz)
const unsigned long nameInterval = 12000;
unsigned long prevNameChange = 0;
short state = 1;
unsigned int sample;

void setup() {
  lcd.init();                           // initialize the lcd
  lcd.backlight();                      // Print a message to the LCD.
  lcd.print("Name: Dimitris");
}

void loop() {
  printName();
  printTemp();
}

void printName() {
  if (millis() - prevNameChange > nameInterval) {
    lcd.setCursor(0, 0);
    if (state) {
      lcd.print("platis.solutions");
    } else {
      lcd.print("Name: Dimitris  ");
    }
    prevNameChange = millis();
    state = !state;
  }
}

void printTemp()
{
  unsigned long startMillis = millis(); // Start of sample window
  unsigned int peakToPeak = 0;   // peak-to-peak level

  unsigned int signalMax = 0;
  unsigned int signalMin = 1024;

  // collect data for 50 mS
  while (millis() - startMillis < sampleWindow)
  {
    sample = analogRead(micPin);
    if (sample < 1024)  // toss out spurious readings
    {
      if (sample > signalMax)
      {
        signalMax = sample;  // save just the max levels
      }
      else if (sample < signalMin)
      {
        signalMin = sample;  // save just the min levels
      }
    }
  }
  peakToPeak = signalMax - signalMin;  // max - min = peak-peak amplitude
  printBars(peakToPeak);
}

void printBars(int bars) {
  if (bars > 14) bars = 14;
  for (int i = 0; i < 15; i++) {
    lcd.setCursor(i, 1);
    if (i <= bars) {
      lcd.print("*");
    } else {
      lcd.print(" ");
    }
  }
}

matt_funder27: I want to use a micro controller that is under $3 for my project. Eventually, I would like to just use the Attiny85 alone and not on the digispark. I just Received my Uno, so I can test the screen and I2C.

If you want a minimal system, the Pro Mini will cost you less than $2 from China (where else?), is more capable, and you get the PCB with all support parts fitted. I can't see the point in re-inventing the wheel with bare chips. :roll_eyes:

Matt I just read through your code. That’s pretty fun. Is this for s maker faire or a hacker event???