I've moved two conflicting 'Wire' libraries' from \libraries to a temporary holding folder.
(The \libraries folder currently therefore now has no such entry.)
Examining the properties, I was able to rename them. So the one that generated those five libraries yesterday when using 'Include Library' arose from my Tiny programming attempts, using the third of these:
https://mcudude.github.io/MiniCore/package_MCUdude_MiniCore_index.json
http://digistump.com/package_digistump_index.json
http://drazzy.com/package_drazzy.com_index.json
https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
https://raw.githubusercontent.com/MHEtLive/arduino-boards-index/master/package_mhetlive_index.json
In case it proves relevant, its properties are:
name=Wire
version=2.0.0
author=Spence Konde and others
maintainer=Spence Konde <spencekonde@gmail.com>
sentence=Supports I2C master or slave operation on all ATTinyCore-supported parts
paragraph=YOU MUST ALWAYS USE HARDWARE PULLUP RESISTORS! Otherwise, this is intended as a "drop-in" replacement for the normal Wire library. Unlike ATmega parts, most classic ATtiny devices do not have a proper hardware TWI interface - they have a USI, or slave only interface. This library picks the appropriate hardware and presents a compatible API. Changing clock speed doesn't work. ATtiny841, 1634, 828, and 441 as master provide no way to determine if a timeout occurred.
category=Communication
url=http://www.arduino.cc/en/Reference/Wire
architectures=avr
I'm technically out of my depth here. How do others interpret "...this is intended as a "drop-in" replacement for the normal Wire library"?
When using it instead of the built-in library for the sketch below, on a UNO, it would not compile. Is that to be expected? This question only arises because at present I am repeatedly switching between developing sketches for UNO and Tiny.
(Probably a lost cause - too much like hard work!).
Rephrasing an earlier gripe as a question: why does the Arduino team not insist that developers give libraries UNIQUE names before they get space on the Arduino IDE? For example 'Wire_DrAzzy', etc.
EDIT: Forgot the sketch:
/* Thu 25 Apr 2024; working OK on UNO, initially with default
* date/time. Entering 'u' in the Serial Monitor switches to
* Edit Mode. Then enter the 6 elements for current date & time,
* pressing Enter after each.
*
* To have any chance of working on my Tiny board this will at
* least need removal of all Serial code. I will no doubt hit
* problems again with the Wire library. From previous experience
* they could remain afterwards, when running on UNO etc.
*/
#include <Wire.h> // for I2C communication, 2 devices in this case
#include <LiquidCrystal_I2C.h> // for LCD
#include <RTClib.h> // for RTC
LiquidCrystal_I2C lcd(0x27, 16, 2); // LCD with I2C address 0x27, 16 characters per line, 2 lines
RTC_DS3231 rtc; // RTC for DS3231 module, address fixed at 0x68
/************************************************************/
void setup()
{
Serial.begin(115200);
delay(200);
Serial.print(F( "\n" __FILE__ "\n" __DATE__ " " __TIME__ "\n" ));
lcd.init(); // initialize the lcd
lcd.backlight();
// Show LCD is working & identify sketch name
lcd.setCursor(0, 0);
lcd.print("Sketch name:");
lcd.setCursor(0, 1);
lcd.print("LCD-RTClib-3");
delay(3000);
lcd.clear();
rtc.begin(); // initialize rtc
}
/************************************************************/
void loop()
{
updateLCD(); // Update LCD text
if (Serial.available())
{
char input = Serial.read();
if (input == 'u') updateRTC(); // update RTC time
}
}
/************************************************************/
// Update RTC time with user input
void updateRTC()
{
lcd.clear(); // clear LCD display
lcd.setCursor(0, 0);
lcd.print("Edit Mode...");
// Ask for new date and time
const char txt[6][15] = { "year [4-digit]", "month [1~12]", "day [1~31]",
"hours [0~23]", "minutes [0~59]", "seconds [0~59]"
};
String str = "";
long newDate[6];
while (Serial.available())
{
Serial.read(); // clear serial buffer
}
for (int i = 0; i < 6; i++)
{
Serial.print("Enter ");
Serial.print(txt[i]);
Serial.print(": ");
while (!Serial.available())
{
; // wait for user input
}
str = Serial.readString(); // read user input
newDate[i] = str.toInt(); // convert user input to number and save to array
Serial.println(newDate[i]); // show user input
}
// update RTC
rtc.adjust(DateTime(newDate[0], newDate[1], newDate[2], newDate[3], newDate[4], newDate[5]));
Serial.println("RTC Updated!");
}
/************************************************************/
void updateLCD()
{
/*
create array to convert digit days to words:
0 = Sunday | 4 = Thursday
1 = Monday | 5 = Friday
2 = Tuesday | 6 = Saturday
3 = Wednesday |
*/
const char dayInWords[7][4] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
/*
create array to convert digit months to words:
0 = [unused] |
1 = January | 6 = June
2 = February | 7 = July
3 = March | 8 = August
4 = April | 9 = September
5 = May | 10 = October
6 = June | 11 = November
7 = July | 12 = December
*/
const char monthInWords[13][4] = {" ", "JAN", "FEB", "MAR", "APR", "MAY", "JUN",
"JUL", "AUG", "SEP", "OCT", "NOV", "DEC"
};
// get time and date from RTC and save in variables
DateTime rtcTime = rtc.now();
int ss = rtcTime.second();
int mm = rtcTime.minute();
int hh = rtcTime.twelveHour();
int DD = rtcTime.dayOfTheWeek();
int dd = rtcTime.day();
int MM = rtcTime.month();
int yyyy = rtcTime.year();
// move LCD cursor to upper-left position
lcd.setCursor(0, 0);
// print date in dd-MMM-yyyy format and day of week
if (dd < 10) lcd.print("0"); // add preceeding '0' if number is less than 10
lcd.print(dd);
lcd.print("-");
lcd.print(monthInWords[MM]);
lcd.print("-");
lcd.print(yyyy);
lcd.print(" ");
lcd.print(dayInWords[DD]);
// move LCD cursor to lower-left position
lcd.setCursor(0, 1);
// print time in 12H format
if (hh < 10) lcd.print("0");
lcd.print(hh);
lcd.print(':');
if (mm < 10) lcd.print("0");
lcd.print(mm);
lcd.print(':');
if (ss < 10) lcd.print("0");
lcd.print(ss);
if (rtcTime.isPM()) lcd.print(" PM"); // print AM/PM indication
else lcd.print(" AM");
}