Here's the changes made to tiny core's print.cpp and print.h:
/* default implementation: may be overridden */
//void Print::write(const char *str)
//{
// while (*str)
// write(*str++);
//}
//jc100 above is original, below from arduino
size_t Print::write(const char *str)
{
size_t n = 0;
while (*str){
write(*str++);
}
return n;
}
/* default implementation: may be overridden */
//void Print::write(const uint8_t *buffer, size_t size)
// while (size--)
// write(*buffer++);
//}
//jc100 below is from arduino, above original tiny
size_t Print::write(const uint8_t *buffer, size_t size)
{
size_t n = 0;
while (size--) {
n += write(*buffer++);
}
return n;
}
public:
virtual size_t write(uint8_t) = 0;
// virtual void write(const char *str);
// virtual void write(const uint8_t *buffer, size_t size);
//jc100 below is from working arduino file, above is original
size_t write(const char *str) { return write((const uint8_t *)str, strlen(str)); }
virtual size_t write(const uint8_t *buffer, size_t size);
here's the program:
//#include <Wire.h>
#include <LCD.h> // franscisco's example? instead of wire.h
#include <LiquidCrystal_SR.h>
LiquidCrystal_SR iLCD(1,0);
void setup(){
iLCD.begin(16,2); // initialize the lcd
iLCD.home (); // go home
iLCD.print("LiquidCrystal_SR");
}
void loop(){
}
and here's the compile result:
C:\Documents and Settings\H1\My Documents\Downloads\arduino-1.0.1-windows\arduino-1.0.1\hardware\tiny\cores\tiny\Print.cpp:39: error: redefinition of 'size_t Print::write(const char*)'
C:\Documents and Settings\H1\My Documents\Downloads\arduino-1.0.1-windows\arduino-1.0.1\hardware\tiny\cores\tiny\/Print.h:77: error: 'size_t Print::write(const char*)' previously defined here
After using #include <lcd.h> instead of <wire.h> per the fransciso's example
(https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/schematics#!non-latching-shift-register)
a lot of errors were eliminated - I pared down the HelloWorld_SR to the basics with that change and attempted to follow suggestions here and by Nick Gammon here:
Arduino Forum
Coding Badly, I appreciate your desire to pare code to a minimum, but from what I can tell, haven't the write routines been changed (somewhere between arduino 0022 and 1.0.1) to return a value?
ie: from LCD.h
#if (ARDUINO < 100)
virtual void write(uint8_t value);
#else
virtual size_t write(uint8_t value);
#endif
suggestions? - john