How can i do this? Thanks for help
Extend the program to read an integer (with at most 2 digits) from the Serial Monitor and print out a group of stars that is equal to the integer value. The star should be arranged in rows of ten.
The result example:
This is a test
incorrect input
5234
incorrect input
20
0
8
char buf[100] = {0};Â // this is an array
char inChar;
bool stringComplete = false;
int i = 0;
// declare the function
char ConvertString(char);
void setup()
{
 // Initialize serial and wait for port to open
 Serial.begin(115200);
 while (!Serial)
 {
  // Wait for serial port to connect, needed for native USB port only
 }
}
void loop()
{
 while (Serial.available())
 {
  inChar = (char)Serial.read();
  if (inChar == '\n') // change '\n' to '~' when using Tinkercad
  {
   buf[i++] = inChar; // last character is newline
   buf[i] = 0;    // string array should be terminated with a zero
   stringComplete = true;
  }
  else
  {
  Â
   buf[i++] = inChar;
  }
 }
 if (stringComplete)
 {
  Serial.print(buf);  // the printing of string will be stopped when zero is reached
  stringComplete = false;
  i = 0;
 }
}