Using printf, is there a way to print the same char x times to the Serial monitor?
Yes
Great... care to provide an example?
for(int n=0;n<5;n++) Serial.print('a');
Thanks... I should have been clearer in my original post... is it possible doing it with just using printf and providing it parameters.
Build your output in a buffer, then print that. Not typing that on this phone, sorry.
When is our assignment due?
@van_der_decken ... appreciate the link... will check it out.
Essentially: no.
Pretty much. There's some hacks that will work in some situations in that link I provided but... I wouldn't use any of them in anything I'd be willing to admit writing.
Not even the suggested
void repeat (char input , int count )
{
for (int i=0; i != count; i++ )
{
printf("%c", input);
}
}
int main()
{
repeat ('#', 5);
return 0;
}
(I would use < instead of != and probably not printf() which is overkill for just one char - but creating a function is the right approach since printf does not have the feature)