i was just trying to create some kind of typewriter effect with TVout.h
but i get this error when compiling: error: invalid conversion from 'char' to 'char*'
i guess this is some trouble with the library cause with serial.print i got it working just fine.
is there a work around for this?
#include <TVout.h>
TVout TV;
int moveVert=0;
int moveHorz=0;
char myString[]={"I was wondering why this is so complicated"};
void setup() {
TV.start_render(_PAL);
Serial.begin(9600);
}
void loop() {
moveVert=0;
moveHorz=0;
TV.clear_screen();
//working:
for (unsigned int x = 0; x < strlen(myString); x++) {
Serial.print(myString[x]);
delay(random(200));}
Serial.println(" ");
// gives error:
for (unsigned int x = 0; x < strlen(myString); x++){
TV.print_str(moveHorz,moveVert,myString[x]);
moveHorz=moveHorz+5;
if (moveHorz >= 100) {moveVert=8;moveHorz=0;}
delay(random(200));
}
}
The TV.print_str function expects the 3rd argument to be a string, not a single character. You are calling the function with a single character, myString[x], not a string, myString.
found a solution to my problem, now discover an empty space in the string and do moveHorz-1 or something
#include <TVout.h>
TVout TV;
unsigned char x,y;
int moveVert=0;
int moveHorz=0;
int endLine=118;
int temp=0;
char text;
char myString[]={"I was wondering why this is so complicated I was wondering why this is so complicated I was wondering why this is so complicated"};
void setup() {
pinMode(13, OUTPUT);
digitalWrite(13, HIGH);
x=0;
y=0;
TV.start_render(_PAL);
//Serial.begin(9600);
}
void loop() {
moveVert=0;
moveHorz=0;
TV.clear_screen();
TV.select_font(_5X7);
for (int i = 0; i < 130; i++){
char temp_str[130];
strncpy(temp_str,&(myString[i]),130);
temp_str[1] = '\0';
TV.print_str(moveHorz,moveVert,temp_str);
moveHorz=moveHorz+5;
if (moveHorz >= endLine) {moveVert=moveVert+8;moveHorz=0;}
delay(random(200));
}
}