Problem with programming ATtiny85

Hi,

I am Siva Raman. I am a beginner to Arduino Projects. I can understand all the schematics and do the hardware, but when it comes to programming I am a novice. I am doing a project watching a Youtube video Maxint R&D.

The link is https://www.youtube.com/watch?v=FfmRCfF5qQI&t=3s. Here he runs a clock using 6x5 LED matrix with TM1637 chip and RTC with ATtiny85.

I run the test code in TM1637 6x5 display it works fine, but when I try to upload the clock code to Attiny85 via USbasp I am getting the following errors. I am really a novice in programming, please help me in this regard. I need to program this to Attiny85. Thank you.

Code // Digital clock **********************************************

const int RTCaddress = 0x68; const int DisplayAddress = 0x70; int Colon = 2;

char Segment[10] = {0x3F, 0x06, 0x5B, 0x4F, 0x66, 0x6D, 0x7D, 0x07, 0x7F, 0x6F};

void SetClock (int hr, int min) { TinyI2C.start(RTCaddress, 0); TinyI2C.write(0); TinyI2C.write(0); TinyI2C.write(min); TinyI2C.write(hr); TinyI2C.stop(); }

void InitDisplay () { TinyI2C.start(DisplayAddress, 0); TinyI2C.write(0x21); TinyI2C.restart(DisplayAddress, 0); TinyI2C.write(0x81); TinyI2C.restart(DisplayAddress, 0); TinyI2C.write(0xe1); TinyI2C.stop(); }

void WriteWord (uint8_t b) { TinyI2C.write(b); TinyI2C.write(0); }

// Setup **********************************************

void setup() { TinyI2C.init(); InitDisplay(); SetClock(0x12, 0x34); // Set the time to 12:34 }

void loop () { // Read the time from the RTC TinyI2C.start(RTCaddress, 0); TinyI2C.write(1); TinyI2C.restart(RTCaddress, 2); int mins = TinyI2C.read(); int hrs = TinyI2C.read(); TinyI2C.stop();

// Write the time to the display TinyI2C.start(DisplayAddress, 0); TinyI2C.write(0); WriteWord(Segment[hrs / 16]); WriteWord(Segment[hrs % 16]); WriteWord(Colon); WriteWord(Segment[mins / 16]); WriteWord(Segment[mins % 16]); TinyI2C.stop(); // Flash the colon Colon = 2 - Colon; delay(1000); }

Error

C:\Users\Siva Raman\Desktop\DigitalClock\DigitalClock.ino: In function 'void SetClock(int, int)':

DigitalClock:20:3: error: 'TinyI2C' was not declared in this scope

TinyI2C.start(RTCaddress, 0);

^~~~~~~

C:\Users\Siva Raman\Desktop\DigitalClock\DigitalClock.ino: In function 'void InitDisplay()':

DigitalClock:29:3: error: 'TinyI2C' was not declared in this scope

TinyI2C.start(DisplayAddress, 0);

^~~~~~~

C:\Users\Siva Raman\Desktop\DigitalClock\DigitalClock.ino: In function 'void WriteWord(uint8_t)':

DigitalClock:39:3: error: 'TinyI2C' was not declared in this scope

TinyI2C.write(b);

^~~~~~~

C:\Users\Siva Raman\Desktop\DigitalClock\DigitalClock.ino: In function 'void setup()':

DigitalClock:46:3: error: 'TinyI2C' was not declared in this scope

TinyI2C.init();

^~~~~~~

C:\Users\Siva Raman\Desktop\DigitalClock\DigitalClock.ino: In function 'void loop()':

DigitalClock:53:3: error: 'TinyI2C' was not declared in this scope

TinyI2C.start(RTCaddress, 0);

^~~~~~~

exit status 1 'TinyI2C' was not declared in this scope

Duplicate topics merged

Cross-posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes (or more) writing a detailed answer on this topic, without knowing that someone else already did the same in the other topic.

Repeated cross-posting will result in a suspension from the forum.

In the future, please take some time to pick the forum board that best suits the topic of your question and then only post once to that forum board. This is basic forum etiquette, as explained in the sticky "How to use this forum - please read." post you will find at the top of every forum board. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.

Please post a link to where you got this code.

As I pointed out in the other thread, the OP forgot to

#include <TinyI2C.h>;  // I think that is the name, don't have the library installed.

Other than that, it is the exact example that comes with the library.

blh64:
As I pointed out in the other thread, the OP forgot to

#include <TinyI2C.h>;  // I think that is the name, don't have the library installed.

Other than that, it is the exact example that comes with the library.

It may be

#include <TinyI2CMaster.h>

there are links under the video that the OP linked.

david_2018:
It may be

#include <TinyI2CMaster.h>

there are links under the video that the OP linked.

Yep. That’s the name.