I using Arduino IDE 1.04 trying to program an ATiny13. The code below compiled and ran on my Uno.
The error is:
Documents\arduino-1.0.4\hardware\attiny13\cores\core13/Print.h:42: error: overriding 'virtual int Print::write(uint8_t)
The number it is trying to print should be a temp with 2 decimal places.
/*You may copy, alter and reuse this code in any way you like but please leave
reference to hobbycomponents.com in your comments if you redistribute this code. */
/* Include the SPI/IIC Library */
#include <Wire.h>
#include <OneWire.h>
#include <LiquidCrystal_I2C.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 2
int pin = 3;
int readone=0;
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
/* Initialise the LiquidCrystal library. The default address is 0x27 and this is a 16x2 line display */
LiquidCrystal_I2C lcd(0x27,16,2);
void setup()
{
/* Initialise the LCD */
lcd.init();
lcd.init();
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
sensors.begin();
lcd.backlight();
}
/* Main program loop */
void loop()
{
/* Make sure the backlight is turned on */
sensors.requestTemperatures(); // Send the command to get temperatures
/* Output the test message to the LCD */
lcd.setCursor(0,0);
lcd.print("Lake Temp @ 3ft");
lcd.setCursor(0,1);
readone = (sensors.getTempCByIndex(0));
readone = readone * 9/5 + 32;
lcd.print("readone"); // Error Here **************************************
delay(5000);
}
PeterH:
When it compiled and ran OK on the UNO, was that with the same Arduino IDE version and the same version of any libraries you have added?
Yes, but now I am thinking the ATiny can't handle it. I read about a problem with Wire.h on the ATiny. I think that means either a buffer size limitation or a change it what write is supposed to return in the Print.h but I can't get around it. Even removing the last lcd.print still gives me the error.
C:\Users\Public\Documents\arduino-1.0.4\hardware\tools\avr\bin\avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=attiny13 -DF_CPU=1200000 -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=104 -IC:\Users\Public\Documents\arduino-1.0.4\hardware\attiny13\cores\core13 -IC:\Users\Public\Documents\arduino-1.0.4\libraries\Wire -IC:\Users\Public\Documents\arduino-1.0.4\libraries\OneWire -IC:\Users\Public\Documents\arduino-1.0.4\libraries\LiquidCrystal_I2C1602V1 -IC:\Users\Public\Documents\arduino-1.0.4\libraries\DallasTemperature C:\Users\Rick\AppData\Local\Temp\build3935294746400875127.tmp\sketch_may21a.cpp -o C:\Users\Rick\AppData\Local\Temp\build3935294746400875127.tmp\sketch_may21a.cpp.o
In file included from sketch_may21a.ino:8:
C:\Users\Public\Documents\arduino-1.0.4\libraries\Wire/Wire.h:26:20: error: Stream.h: No such file or directory
In file included from sketch_may21a.ino:8:
C:\Users\Public\Documents\arduino-1.0.4\libraries\Wire/Wire.h:31: error: expected class-name before '{' token
C:\Users\Public\Documents\arduino-1.0.4\libraries\Wire/Wire.h:60: error: 'size_t' does not name a type
C:\Users\Public\Documents\arduino-1.0.4\libraries\Wire/Wire.h:61: error: 'size_t' does not name a type
C:\Users\Public\Documents\arduino-1.0.4\libraries\Wire/Wire.h:69: error: 'size_t' does not name a type
C:\Users\Public\Documents\arduino-1.0.4\libraries\Wire/Wire.h:70: error: 'size_t' does not name a type
C:\Users\Public\Documents\arduino-1.0.4\libraries\Wire/Wire.h:71: error: 'size_t' does not name a type
C:\Users\Public\Documents\arduino-1.0.4\libraries\Wire/Wire.h:72: error: 'size_t' does not name a type
C:\Users\Public\Documents\arduino-1.0.4\libraries\Wire/Wire.h:73: error: 'Print' has not been declared
In file included from C:\Users\Public\Documents\arduino-1.0.4\libraries\LiquidCrystal_I2C1602V1/LiquidCrystal_I2C.h:6,
from sketch_may21a.ino:10:
C:\Users\Public\Documents\arduino-1.0.4\hardware\attiny13\cores\core13/Print.h:42: error: ISO C++ forbids declaration of 'write' with no type
In file included from sketch_may21a.ino:10:
C:\Users\Public\Documents\arduino-1.0.4\libraries\LiquidCrystal_I2C1602V1/LiquidCrystal_I2C.h:82: error: conflicting return type specified for 'virtual size_t LiquidCrystal_I2C::write(uint8_t)'
C:\Users\Public\Documents\arduino-1.0.4\hardware\attiny13\cores\core13/Print.h:42: error: overriding 'virtual int Print::write(uint8_t)'