I am becoming very disappointed with Arduino as of late. I'm not an idiot, I code C on AVR. I use Arduino for quick and dirty jobs hat will never have more than one made of them. The whole point of using Arduino was the good documentation making it easy to hack something together without writing my own libraries because it's pointless trying to reverse engineer anyone elses undocumented library...
So the liquid crystal library. Firstly I see no clear distinction between write and print but never mind.
States: data: the data to print (char, byte, int, long, or string)
Yet so far no variable type works producing a compile error. I take it that the only acceptable variable type is char and that my int number needs manually breaking down.....
write will send straight the byte value. Print will transform your argument in ASCII
so lcd.write('C'); is indeed the same as lcd.print('C'); or as lcd.print("C"); but lcd.write(67) and lcd.print(67); are very different. The write will output a 'C' because 67 is the ASCII code for 'C' (the associated char) whereas the print will output "67" on the screen, the ASCII representation of the number (the associated text)
That's what the doc states (if you read carefully and go check also what print and write in Stream do a put some good will into it :)) )
It's difficult I know. I detest most (all?) of these third-party libraries as well. Still, without seeing any code and/or error message, then it's just a rant. I happen to use the LiquidCrystal library (one of very few) quite a bit and without any problems, compile or otherwise.
SparkyLabs:
I am becoming very disappointed with Arduino as of late. I'm not an idiot, I code C on AVR. I use Arduino for quick and dirty jobs hat will never have more than one made of them. The whole point of using Arduino was the good documentation making it easy to hack something together without writing my own libraries because it's pointless trying to reverse engineer anyone elses undocumented library...
So the liquid crystal library. Firstly I see no clear distinction between write and print but never mind.
print formats a number intro a string so lcd.print(45) will produce "45"
write simply sends the data so lcd.print(45) will produce the ascii(45) which is '-'
States: data: the data to print (char, byte, int, long, or string)
Yet so far no variable type works producing a compile error. I take it that the only acceptable variable type is char and that my int number needs manually breaking down.....
Nope, they all work just fine. Why don't you post your code and people will be able to help you?
race_end:34:35: error: no matching function for call to 'write(char&, int)'
Yep I got print and write mixed up seems to be working now but I stand by what I said the documentation is poor. Considering this is for kids and artists all i can say is good luck
race_end:34:35: error: no matching function for call to 'write(char&, int)'
Yep I got print and write mixed up seems to be working now but I stand by what I said the documentation is poor. Considering this is for kids and artists all i can say is good luck
indeed you were calling an investing write() function (this prototype does not exist);
I'd have to reverse engineer it to understand it remember. Only those that wrote it know how it works. Seem's everyone else know's how it works so why are the examples and explanations not more extensive?
I don't know who writes the instructions but they do make and sell the boards that i buy so it's not like it is free. i paid £35 for a PCB that is massed produced.
SparkyLabs:
I'd have to reverse engineer it to understand it remember. Only those that wrote it know how it works. Seem's everyone else know's how it works so why are the examples and explanations not more extensive?
usually one comes to print and write form the Serial class, so the context is already understood. Again if you don't need to mess around with sending bytes value, stick to print and life will be glorious and beautiful.
SparkyLabs:
I'd have to reverse engineer it to understand it remember.
Well, it wouldn't require THAT much reverse engineering. If you'd bother to spend two minutes looking at the library's source code, you'd see that the LiquidCrystal class inherits from the Print class -- as does HardwareSerial, SoftwareSerial, etc. So the basic interface should already be familiar to you.
The source code is always the definitive documentation.
Hmm. I agree that the LCD.print/write documentation is painfully brief. It should look more like the Serial documentation, or at least refer to that, for a better description of what formatting is supported.
(I think it assumes that people will already be familiar with Serial.xxx() usage, which it "inherits" in the best C++ traditions.