Code:-
char input[12];
int count = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
if(Serial.available())
{
count = 0; // Reset the counter to zero
while(Serial.available() && count < 12)
{
input[count] = Serial.read();
count++; // increment counter
delay(5);
}
Serial.println("I received: ");
for(int i=0;i<12;i++)
Serial.print(input[i]);
Serial.println();
}
}
Comments
Post a Comment