Hi all and thanks for taking the time to read my question.
This is a combination of questions that I have. I've only had my Arduino Uno about a week so I apologize in advance if I ask something that seems dumb.
Facts:
I am currently running an arduino uno r3 with a parallax 16char x 2 char display model # 27922-RT.
I have the display up and running simple texts that I feed it in my "setup" class.
I wanted to try something a little more difficult and have the text loop one time on the display from right to left on line 1.
Additionally, I want line 2 to display a static text.
here is the code I have written to do so with some pseudo code at the top (commented out) to help me jot my thoughts down as I approached the problem.
Code:
/* Pseudo code
if the length of the string is greater than 16
then display the first character at the far right
then display the first and second character
then display the first, second, and third character....
till you hit the 17 char then display char 2-16 and so on
until you hit the end. then display the blank char at length-15 + one blank
if the length of the string is greater than 16,
add 16 blank spaces to it " "
add this new string with 16 blanks to a temporary variable
then, itterate through the string to display it.
*/
const int TxPin = 6;
#include <SoftwareSerial.h>
SoftwareSerial mySerial = SoftwareSerial(255, TxPin);
int delayTime = 2000;
String x = "Hello, teo from Meow, AKA Slim, AKA The Prince of Darkness";
void setup() {
pinMode(TxPin, OUTPUT);
digitalWrite(TxPin, HIGH);
mySerial.begin(9600);
delay(100);
mySerial.write(22); // disable cursor disable blink
mySerial.write(12); // Clear
mySerial.write(17); // Turn backlight on
delay(5); // Required delay
if(x.length() > 16){
String tempX = x + " ";
int tempXLen = tempX.length();
for(int i = 0; i < tempXLen; i++){
String tempDisp = tempDisp.substring(i, i+15);
mySerial.print(tempDisp);
delay(2000);
}
}
else {
mySerial.write(x);
}
mySerial.write(13); // Form feed
mySerial.print("from the cat!"); // Second line
mySerial.write(212); // Quarter note
mySerial.write(220); // A tone
delay(3000); // Wait 3 seconds
mySerial.write(18); // Turn backlight off
}
void loop() {
}
//
I'm getting an error that points to the following line
mySerial.write(x);
the error states "no matching function for call to 'SoftwareSerial::write(String&)'
Questions:
- Can I get the parallax display to scroll text using a loop the way that I have?
- Is there a better way to get the display to scroll text than how I have approached it?
- Why does my code not function the way it is written?
I thank anyone and everyone for looking.
Best,
Warmonger0